[Thread Prev][Thread Next][Index]

[ferret_users] missing value not detected in double-precision ferret



Dear ferret list,

there is a problem reading our climate model netcdf files with the new
ferret double precision version. I boiled it down to a set of small
files in the attachment.

'-1E+34' is not recognized as 'missing value' (see 'ex_float'). To save
space, all variables except dimensional variables in our climate model
output are defined as "float" = "single precision".

When a netcdf file is read into double-precision ferret, the entry
'-1E+34' in a float (single precision) variable is not recognized as
'missing value' anymore, but has a numerical value of
-9.999999790214768E+33 (prec=16). The bad values are thus not masked,
which is inconvenient for plotting or analysis.

yes? list press
                VARIABLE : pressure (Pa)
                FILENAME : ex_float.nc
                SUBSET   : 3 points (TIME)
    01-JAN-2000 00:20:00 / 1:  1.000E+04
    01-JAN-2000 00:40:00 / 2: -1.000E+34
    01-JAN-2000 01:00:00 / 3:  1.000E+05

The workaround 'set var/bad=-9.999999790214768E+33
<variable>' is inconvenient as well.

Interestingly, when listing the bad value of the variable, the bad-value
masking seems to work:

yes? list `press,ret=bad`
    !-> list -1.E+34
                VARIABLE : constant
           ....

In 'ex_double' (attachment), I exchanged 'float' to 'double' by hand for
all variables. The value '-1E+34' is then recognized correctly:

yes? list press
                VARIABLE : pressure (Pa)
                FILENAME : ex_traj2.nc
                SUBSET   : 3 points (TIME)
    01-JAN-2000 00:20:00 / 1:   10000.
    01-JAN-2000 00:40:00 / 2:     ....
    01-JAN-2000 01:00:00 / 3:  100020.

The explicit definition of a missing value in the netCDF file does not
solve the issue (attachment: ex_float_missing).

Please help us with backwards compatibility as we cannot go into several
terabyte of climate data output to change "float" to "double" in the
variable definitions.


Thanks a lot in advance,
Hella


netcdf ex_float {
dimensions:
        time = UNLIMITED ; // (3 currently)
variables:
        float lat(time) ;
                lat:units = "degrees_north" ;
        float lon(time) ;
                lon:units = "degrees_east" ;
        float level(time) ;
                level:units = "Pa" ;
        double time(time) ;
                time:units = "seconds since 2000-01-01 00:00:00" ;
        float press(time) ;
                press:long_name = "pressure" ;
                press:units = "Pa" ;
        float rh(time) ;
                rh:long_name = "relative humidity" ;
                rh:valid_range = 0., 1. ;
        float temp(time) ;
                temp:long_name = "temperature" ;
                temp:units = "kelvin" ;

// global attributes:
                :source = "Pulp Fictional Model Output" ;
data:

 lat = 16, 17, 18 ;

 lon = 110, 115, 120 ;

 level = 90, 88, 89 ;

 time = 1200, 2400, 3600 ;

 press = 10000, -1E+34, 100020 ;

 rh = 0.1, 0.2, 0.3 ;

 temp = 290, 291, 292 ;
}

Attachment: ex_float.nc
Description: Cdf file

Attachment: ex_double.nc
Description: Cdf file

netcdf ex_double {
dimensions:
        time = UNLIMITED ; // (3 currently)
variables:
        double lat(time) ;
                lat:units = "degrees_north" ;
        double lon(time) ;
                lon:units = "degrees_east" ;
        double level(time) ;
                level:units = "Pa" ;
        double time(time) ;
                time:units = "seconds since 2000-01-01 00:00:00" ;
        double press(time) ;
                press:long_name = "pressure" ;
                press:units = "Pa" ;
        double rh(time) ;
                rh:long_name = "relative humidity" ;
                rh:valid_range = 0., 1. ;
        double temp(time) ;
                temp:long_name = "temperature" ;
                temp:units = "kelvin" ;

// global attributes:
                :source = "Pulp Fictional Model Output" ;
data:

 lat = 16, 17, 18 ;

 lon = 110, 115, 120 ;

 level = 90, 88, 89 ;

 time = 1200, 2400, 3600 ;

 press = 10000, -1E+34, 100020 ;

 rh = 0.1, 0.2, 0.3 ;

 temp = 290, 291, 292 ;
}

Attachment: ex_float_missing.nc
Description: Cdf file

netcdf ex_traj1 {
dimensions:
        time = UNLIMITED ; // (3 currently)
variables:
        float lat(time) ;
                lat:units = "degrees_north" ;
        float lon(time) ;
                lon:units = "degrees_east" ;
        float level(time) ;
                level:units = "Pa" ;
        double time(time) ;
                time:units = "seconds since 2000-01-01 00:00:00" ;
        float press(time) ;
                press:long_name = "pressure" ;
                press:units = "Pa" ;
                press:missing = -1E+34 ;
        float rh(time) ;
                rh:long_name = "relative humidity" ;
                rh:valid_range = 0., 1. ;
        float temp(time) ;
                temp:long_name = "temperature" ;
                temp:units = "kelvin" ;

// global attributes:
                :source = "Pulp Fictional Model Output" ;
data:

 lat = 16, 17, 18 ;

 lon = 110, 115, 120 ;

 level = 90, 88, 89 ;

 time = 1200, 2400, 3600 ;

 press = 10000, -1E+34, 100020 ;

 rh = 0.1, 0.2, 0.3 ;

 temp = 290, 291, 292 ;
}

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement