I'm trying to use NCO's ncwa
script to find out ranges for some data variables in netcdf files. However it looks like it cannot decode missing_value
attribute by default and that is used to define the results.
For instance, I am trying to run:
ncwa -y min -v hs ./test.nc /tmp/min.nc
to find out the minimum value for variable hs
in file ./test.nc
. The output is -9
as shown below which is the missing_value attribute of that variable.
I tried with different files with different missing_value
values and this is still the case. However the _FillValue
attribute does seem to be decoded correctly by ncwa
when present, with associated values being ignored in the results.
Any help would be appreciated. Thanks.
% ncdump /tmp/min.nc
netcdf min {
variables:
float hs ;
hs:standard_name = "sea_surface_wave_significant_height" ;
hs:units = "m" ;
hs:long_name = "Significant wave height" ;
hs:missing_value = -9.f ;
hs:cell_methods = "time, lat, lon: minimum" ;
data:
hs = -9 ;
}
% ncwa --version
ncwa 4.6.9
For reasons described here, NCO pays attention to _FillValue
not missing_value
. The recommended solution is to add a _FillValue
attribute with the same value as the missing_value
attribute:
ncatted -O -a _FillValue,,o,f,1.0e36 inout.nc
or to rename the missing_value
to _FillValue
:
ncrename -a .missing_value,_FillValue inout.nc