var.put.nc(RNetCDF)
var.put.nc()所属R语言包:RNetCDF
Put Data Into a NetCDF Variable
将数据放入一个NetCDF变量
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Write the contents of a NetCDF variable.
写一个NetCDF变量的内容。
用法----------Usage----------
var.put.nc(ncfile, variable, data, start=NA, count=NA, na.mode=0, pack=FALSE)
参数----------Arguments----------
参数:ncfile
Object of class "NetCDF" which points to the NetCDF dataset (as returned from open.nc).
类的对象“NetCDF”,这点到NetCDF的数据集(从open.nc返回)。
参数:variable
ID or name of the variable.
ID或名称的变量。
参数:data
The (multidimensional) array containing the data to write.
(多维)数组,包含要写入的数据。
参数:start
A vector of indices indicating where to start writing the passed values (beginning at 1). The length of this vector must equal the number of dimensions the variable has. Order is leftmost varying fastest (as got from print.nc; opposite to the CDL conventions). If set to NA, writing starts for each dimension at position 1.
的矢量指数表明从哪里开始写传递的值(从1开始)。此向量的长度必须等于变量具有的尺寸的数量。订单是最左边的的不同速度最快(从print.nc;相反到CDL公约)。如果设置为NA,写作开始的每个维度在位置1。
参数:count
A vector of integers indicating the count of values to write along each dimension. Order is leftmost varying fastest (as got from print.nc; opposite to the CDL conventions). The length of this vector must equal the number of dimensions the variable has. If set to NA, the dimesions are taken from data.
一个向量的整数表示的计数的值,写每个维度。订单是最左边的的不同速度最快(从print.nc;相反到CDL公约)。此向量的长度必须等于变量具有的尺寸的数量。如果设置为NA,的dimesions从data。
参数:na.mode
Set the mode how missing values (NA) are handled: 0=accept _FillValue or missing_value attribute, 1=accept only _FillValue attribute, 2=accept only missing_value attribute.
将模式如何丢失的值(NA)的处理方式:0 =接受_FillValue或missing_value属性,1 =只接受_FillValue属性,2 =只接受<X >属性。
参数:pack
Variables are packed if pack=TRUE and the attributes add_offset and scale_factor are defined. Default is FALSE.
如果pack=TRUE属性add_offset和scale_factor定义的变量包装。默认是FALSE。
Details
详细信息----------Details----------
This function writes values to a NetCDF variable. Type conversion is done by the NetCDF library itself. This means, that double precision values are passed from R to the corresponding C-function, no matter which type the variable has.
这个函数写一个NetCDF变量的值。类型转换是通过创建NetCDF库本身。这意味着,通过双精度值从R到相应的C函数,无论是哪一类的变量。
Only the R type character is treated separately. When writing values of type NC_CHAR, it is mandatory that the first element of count contains the value of this dimension's length (usually max_string_length), the maximum string length is given by this value. R arrays of type character need therefore one additional dimension when written to a NetCDF dataset.
只有R型character分开处理。当写入的类型NC_CHAR值,count的第一个元素包含的价值维度的长度(通常是max_string_length),字符串的最大长度是由这个值,它是强制性的。 ŕ类型的数组character因此需要一个额外的维度时写入到NetCDF的数据集。
Values of NA are supported if the variable's missing value attribute (as defined in na.mode) is set. They are converted to the corresponding value before written to disk. If na.mode=0 and both attributes are defined, the value of _FillValue is used.
值NA支持变量的遗漏值的属性(中定义na.mode)的设置。它们被转换为相应的值写入到磁盘前。如果na.mode=0和两个属性定义,_FillValue使用。
To reduce the storage space required by a NetCDF file, numeric variables can be "packed" into types of lower precision. The packing operation involves subtraction of attribute add_offset before division by attribute scale_factor. This packing operation is performed automatically for variables defined with the two attributes add_offset and scale_factor if argument pack is set to TRUE. If pack is FALSE, data values are assumed to be packed correctly and are written to the variable without alteration.
为了减少所需的存储空间由NetCDF文件,可以是数值变量“打包”到类型的精度较低。包装操作涉及减法的属性add_offset分割前的属性scale_factor。包装操作自动执行这两个属性定义的变量add_offset和scale_factor,如果参数pack设置为TRUE。 pack如果是FALSE,data值被假定为正确的包装和写入变量没有改变。
Data in a NetCDF file is conceived as being a multi-dimensional array. The number and length of dimensions is determined when the variable is created. The start and count indices that this routine takes indicate where the writing starts along each dimension, and the count of values along each dimension to write.
在NetCDF文件的数据被设想作为一个多维数组。变量被创建时确定的数量和长度的尺寸。 start和count指数,这个程序需要指出的写作开始沿着每个维和值的计数每个维度写。
Awkwardness arises mainly from one thing: NetCDF data are written with the last dimension varying fastest, whereas R works opposite. Thus, the order of the dimensions according to the CDL conventions (e.g., time, latitude, longitude) is reversed in the R array (e.g., longitude, latitude, time).
重仓股,主要源于一件事:NetCDF数据被写入不同速度最快的最后一个维度,而R作品相反。因此,根据在CDL公约的尺寸的顺序(例如,时间,纬度,经度)是相反的R阵列中(例如,经度,纬度,时间)。
注意----------Note----------
NC_BYTE is always interpreted as signed. For best performance, it is recommended that the definition of dimensions, variables and attributes is completed before variables are read or written.
NC_BYTE总是被解释为签署。为了获得最佳性能,建议的尺寸的定义,变量和属性之前完成变量的读出或写入。
(作者)----------Author(s)----------
Pavel Michna, Milton Woods
参考文献----------References----------
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|