Project

General

Profile

change the fillvalue type from string to integer

Added by Hiba Omrani 3 days ago

Dear all,

I have a netcdf file with the fill and miss value set to
rsds:missing_value = "1.e+20f" ;
rsds:_FillValue = "1.e+20f" ;

which generate an error when using cdo (see below)
cdi cdf_put_att_text : ncid=131072 varid=4 att=_FillValue text=1.e+20f
cdi error (cdf_put_att_text): NetCDF: Invalid argument

I tried to change it using setmissvalue but a got the same error.

Any idea to correct this ?


Replies (1)

RE: change the fillvalue type from string to integer - Added by Karin Meier-Fleischer 3 days ago

The error message tells you that the _FillValue is stored as a text string. It should be 'rsds:_FillValue = 1.e+20f ;' without the quotes.

Try NCO's ncatted to change it:

ncatted -O -a missing_value,rsds,o,f,1.e+20 -a _FillValue,rsds,o,f,1.e+20 infile
    (1-1/1)