我在MATLAB中使用了一个相当大的netcdf文件,其中包含以下变量:
tg
Size: 272x214x23011
Dimensions: longitude,latitude,time
Datatype: int16
Attributes:
long_name = 'mean temperature'
units = 'Celsius'
standard_name = 'air_temperature'
_FillValue = -1e+004
scale_factor = 0.01我使用ncread函数来读取矩阵的块,例如:
data = ncread(netcdfFile,'tg',[1 1 1],[Inf Inf 10]);对于前10个时间步长。如果有足够的内存并且“块”足够小,MATLAB将以双精度写入“数据”,否则将以int16格式写入。如果'data‘为双精度,则等于'_FillValue’值的值将被转换为NaN,而如果'data‘为int16,则相同的单元格现在将包含值-9999。为什么?-1e+004在int16的范围内,为什么MATLAB写成-9999,而不是-10000?
是不是因为int16(NaN) = 0,然后落入数据范围,然后MATLAB将默认填充值-9999应用到单元格?
有人能解释一下发生了什么事吗?
发布于 2013-07-02 20:27:10
我相信填充值实际上是-9999。这是一个不幸的显示问题。
>> nccreate('/tmp/t.nc','p','FillValue',-9999)
>> ncdisp /tmp/t.nc
Source:
/tmp/t.nc
Format:
netcdf4_classic
Variables:
p
Size: 1x1
Dimensions:
Datatype: double
Attributes:
_FillValue = -1e+04https://stackoverflow.com/questions/17423478
复制相似问题