Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.

[netcdfgroup] NCO is treating zero and NaN the same?

I have a netCDF variable that has _FillValue attribute set to NaN (undefined 
value from, for example, dividing a number by 0).  When I tried to set it to a 
numeric value using ncatted, it changes all zeroes in data to the fill value as 
well in the process.  Is this a bug is there a way to retain the zero values 
while resetting the NaN fillvalue?

The following is the dump of a sample file I used. Both 0 and NaN in data 
become fill value (-999.) while I was expecting the zeros to remain.  The 
command I used to set fillvalue is:  ncatted -a "_FillValue,A,o,d,-999." nan.nc

******** Start of nan.nc dump ********
netcdf nan {
dimensions:
        latitude = 3 ;
        longitude = 3 ;
variables:
        double A(latitude, longitude) ;
                A:_FillValue = NaN ;
                A:long_name = "A Variable" ;
                A:units = "mm" ;
        double longitude(longitude) ;
                longitude:long_name = "longitude" ;
                longitude:standard_name = "longitude" ;
                longitude:units = "degrees_east" ;
        double latitude(latitude) ;
                latitude:long_name = "latitude" ;
                latitude:standard_name = "latitude" ;
                latitude:units = "degrees_north" ;

// global attributes:
                :Conventions = "CF-1.4" ;
data:

A =
  0.02, 0, NaN,
  0.3, 0.4, 0.5,
  0, 0.6, 0.8 ;

longitude = -80, -79, -78 ;

latitude = 10, 11, 12 ;
}
******** End of nan.nc dump ********

Thanks.

Jianfu Pan
  • 2013 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: