我似乎有一个用“填充”创建的 netcdf 文件。我如何用“填写”来阅读它?
也就是说,我真正想要的是自动找出变量何时丢失的库,就像“填充”一样。有没有办法做到这一点?
来自 ipython 的输出:
In [1]: import netCDF4 as netcdf
In [2]: nc = netcdf.Dataset("/tmp/somefile.nc")
In [3]: nc.variables["time"]
Out[3]:
<type 'netCDF4._netCDF4.Variable'>
int32 time(event, altitude)
long_name: Msec Since Midnight
units: msec
unlimited dimensions:
current shape = (43627, 372)
filling off
In [4]: nc.variables["time"][:]
Out[4]:
array([[ 86441314, 86441359, 86441404, ..., 86457871,
86457915, -2147483647],
[ 86502423, 86502378, 86502332, ..., 86485825,
86485737, -2147483647],
[ 86557293, 86557337, 86557383, ..., 86573857,
86573906, -2147483647],
...,
[ 86355650, 86355607, 86355560, ..., 86338941,
86338895, 86338848]], dtype=int32)
In [5]: netcdf.default_fillvals["i4"]
Out[5]: -2147483647
-2147483647
inOut[4]
应该是缺失值 ( ) --
。
ncdump 似乎明白了,因为我希望它(_
):
ncdump /tmp/somefile.nc
ncdump 的输出:
....
time =
....
86457636, 86457685, 86457733, 86457779, 86457824, 86457871, 86457915, _,
....