[Thread Prev][Thread Next][Index]

[ferret_users] problems with short data type



Hi,

processing ASCAT netcdf data I stumbled into a problem related to data accuracy and data formats.

Some ASCAT data come in netcdf format, daily data with a time stamp. I want to combine them into a single file. I use a script, reading the files with ferret and writing the data with "append". This worked well for older ferret versions
like 6.72 or earlier but does not with recent versions (6.842).

The problem seems to be the following:

In the original files data are stored with type "short" and a scale factor:

short wind_speed(time, depth, latitude, longitude) ;
                wind_speed:long_name = "wind speed" ;
                wind_speed:units = "m/s" ;
                wind_speed:scale_factor = 0.01 ;
                wind_speed:add_offset = 0. ;
                wind_speed:valid_min = 0. ;
                wind_speed:valid_max = 6000. ;
                wind_speed:_FillValue = -32768s ;
                wind_speed:standard_name = "wind_speed" ;

A typical wind speed value is 1010 corresponding to 10.1 m/s. ncdump shows integers like 1010 in the original files.

Old ferret reads these data correctly and writes reals (floats):

float WIND_SPEED(TIME, DEPTH, LATITUDE81_400, LONGITUDE481_840) ;
                WIND_SPEED:_FillValue = -327.68f ;
                WIND_SPEED:long_name = "wind speed" ;
                WIND_SPEED:units = "m/s" ;
                WIND_SPEED:history = "From dummy_2011" ;

Checking with ncdump I see values like 10.1 in the output file - everything seems to be correct.

But recent ferret writes shorts but now without a scale factor:

short WIND_SPEED(TIME, DEPTH, LATITUDE81_400, LONGITUDE481_840) ;
         WIND_SPEED:_FillValue = -327s ;
         WIND_SPEED:long_name = "wind speed" ;
         WIND_SPEED:units = "m/s" ;
         WIND_SPEED:history = "From dummy_2011" ;

Checking with ncdump I find integers like 10 in the output file, which means reduced accuracy. Also the
fill value is not correct any more.

My questions:
- this happens without any warning and it took me several hours to find this out. Is this a desired feature? I could understand, if the input format would be used for output, but what about the reduced accuracy. At least a warning would be fine.

- how to find such dangerous traps and how to avoid them? ferret is great in just opening files and delivering data in their context of dimensions and coordinates. It was one of the great advantages that no detailed file analysis is needed.

So this leaves me a little bit helpless.

Best,
Martin



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

Privacy Policy | Disclaimer | Accessibility Statement