var.get.nc(RNetCDF)
var.get.nc()所属R语言包:RNetCDF
Get a NetCDF Variable
一个NetCDF变量
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Read the contents of a NetCDF variable.
一个NetCDF变量的内容。
用法----------Usage----------
var.get.nc(ncfile, variable, start=NA, count=NA, na.mode=0, collapse=TRUE, unpack=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或名称的变量。
参数:start
A vector of indices indicating where to start reading the 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 not specified (start=NA), reading starts at index 1.
的矢量指数表明从哪里开始读值(从1开始)。此向量的长度必须等于变量具有的尺寸的数量。订单是最左边的的不同速度最快(从print.nc;相反到CDL公约)。如果不指定(start=NA),阅读在索引1开始。
参数:count
A vector of integers indicating the count of values to read 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 not specified (count=NA), the entire variable or all values along the corresponding dimension(s) are read.
一个向量整数,指示要读取的值的数量以及每个维度。订单是最左边的的不同速度最快(从print.nc;相反到CDL公约)。此向量的长度必须等于变量具有的尺寸的数量。如果不指定(count=NA),则整个变量值,以及相应的尺寸(S)被读取。
参数: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, 3=no missing value conversion.
将模式如何丢失的值(NA)的处理方式:0 =接受_FillValue或missing_value属性,1 =只接受_FillValue属性,2 =只接受<X >属性,3 =没有缺失值的转换。
参数:collapse
TRUE if degenerated dimensions (length=1) should be omitted.
TRUE如果堕落的尺寸(长度= 1)应该被忽略。
参数:unpack
Packed variables are unpacked if unpack=TRUE and the attributes add_offset and scale_factor are defined. Default is FALSE.
如果unpack=TRUE属性add_offset和scale_factor的定义,盒装变量的解压缩。默认是FALSE。
Details
详细信息----------Details----------
This function returns the value of a variable. Returned values are always in ordinary R double precision (apart from character variables), no matter what precision they are in the on-disk dataset.
这个函数返回一个变量的值。返回的值总是在普通的的R双精度(除了字符变量),无论他们是在磁盘上的数据集的精度。
Values of NA are supported; values in the data file that match the variable's missing value attribute (as defined in na.mode) are automatically converted to NA before being returned to the user. If na.mode=0 and both attributes are defined, the value of _FillValue is used.
值NA的支持,在数据文件中的值相匹配的变量的缺失值属性(定义见na.mode)自动转换成NA前返回给用户。如果na.mode=0和两个属性定义,_FillValue使用。
To reduce the storage space required by a NetCDF file, numeric variables are sometimes "packed" into types of lower precision. The original data can be recovered (approximately) by multiplication of the stored values by attribute scale_factor followed by addition of attribute add_offset. This unpacking operation is performed automatically for variables with attributes scale_factor and add_offset if argument unpack is set to TRUE. If unpack is FALSE, raw values are read from each variable without alteration.
为了减少所需的存储空间由NetCDF文件,数字变量有时“打包”到类型的精度较低。的原始数据可以被恢复(约)由按属性的存储的值的乘法scale_factor随后通过添加属性add_offset。拆箱作业,会自动执行,这与属性的变量scale_factor和add_offset,如果参数unpack设置为TRUE。如果unpackFALSE,原始值读取每个变量没有改变。
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 reading starts along each dimension, and the count of values along each dimension to read.
在NetCDF文件的数据被设想作为一个多维数组。变量被创建时确定的数量和长度的尺寸。 start和count指数,此例程需要指示读数开始沿每个维度,和沿每个维度的值的计数阅读。
The argument collapse allows to keep degenerated dimensions (if set to FALSE). As default, array dimensions with length=1 are omitted (e.g., an array with dimensions [2,1,3,4] in the NetCDF dataset is returned as [2,3,4]).
参数collapse允许保留退化的尺寸(如果设置FALSE)。由于默认情况下,阵列尺寸与长度= 1时省略(例如,数组与尺寸[2,1,3,4]在NetCDF的数据集的形式返回[2,3,4])。
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阵列中(例如,经度,纬度,时间)。
值----------Value----------
A multidimensional array of type numeric or character if the data type is NC_CHAR. No distinction is made between the different storage types of numeric objects. The dimension order according to the CDL conventions is swapped in the R array, because NetCDF data are written with the last dimension varying fastest, whereas R works opposite. Arrays of type character lose their first dimension, because strings can be indexed with one dimension in R and the first dimension (usually max_string_length) is therefore needless.
多维数组类型numeric或character,如果数据类型是NC_CHAR。数字对象的不同的存储类型之间是没有区别的。在R阵列的维度顺序根据CDL公约的交换,NetCDF数据被写入,因为最后一维变化最快的,而R作品相反。数组类型character失去了他们的第一个层面,因为字符串可以被索引R和一维的第一个维度(通常是max_string_length),因此不用。
注意----------Note----------
NC_BYTE is always interpreted as signed.
NC_BYTE总是被解释为签署。
(作者)----------Author(s)----------
Pavel Michna, Milton Woods
参考文献----------References----------
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|