Project

General

Profile

changes to netcdf variable definitions

Added by Don Murray over 13 years ago

Hello-

I have just started using cdo. Thanks for a wonderful set of tools. I hope this is the right place to report these issues.

I am trying to do a time average on a 500 mb height field and saving the results in a netCDF file so I can read it into Unidata's Integrated Data Viewer (IDV). The original file (ftp://ftp.cdc.noaa.gov/Datasets/ncep.reanalysis/pressure/hgt.2010.nc) defines the height field as:

short hgt(time, level, lat, lon) ;
hgt:long_name = "mean Daily Geopotential height" ;
hgt:actual_range = -559.25f, 32277.5f ;
hgt:valid_range = -700.f, 35000.f ;
hgt:units = "m" ;
hgt:add_offset = 32066.f ;
hgt:scale_factor = 1.f ;
hgt:missing_value = 32766s ;
hgt:precision = 0s ;
hgt:least_significant_digit = 0s ;
hgt:GRIB_id = 7s ;
hgt:GRIB_name = "HGT" ;
hgt:var_desc = "Geopotential height\n",
"H" ;
hgt:dataset = "NCEP Reanalysis Daily Averages" ;
hgt:level_desc = "Multiple levels\n",
"F" ;
hgt:statistic = "Mean\n",
"M" ;
hgt:parent_stat = "Individual Obs\n",
"I" ;

There is an error in the definition in that the valid_range should be the same data type as the packed data (short) instead of float as it is defined in the file. However, the IDV (which uses Unidata's netCDF-Java library) can read this.

When I issue the following command:

cdo timavg -sellevel,500 -seldate,20100710,20100808 hgt.2010.nc hgt.20100710_0808.nc

The variable is now defined as:

short hgt(time, lev, lat, lon) ;
hgt:long_name = "mean Daily Geopotential height" ;
hgt:units = "m" ;
hgt:add_offset = 32066.f ;
hgt:scale_factor = 1.f ;
hgt:_FillValue = 32766s ;
hgt:actual_range = -559.25, 32277.5 ;
hgt:valid_range = -700., 35000. ;
hgt:precision = 0 ;
hgt:least_significant_digit = 0 ;
hgt:GRIB_id = 7 ;
hgt:GRIB_name = "HGT" ;
hgt:var_desc = "Geopotential height\n",
"H" ;
hgt:dataset = "NCEP Reanalysis Daily Averages" ;
hgt:level_desc = "Multiple levels\n",
"F" ;
hgt:statistic = "Mean\n",
"M" ;
hgt:parent_stat = "Individual Obs\n",
"I" ;

The valid_range attribute values have been changed to doubles (vs. floats in the old file). This causes the scale_factor and add_offset to be applied to the valid_range so the grid ends up with all invalid values. I think cdo should maintain the data
type of the attributes when creating the new file. I saw the note in the documenation about scale/offset, but in this case the range of the data are not changing, the scope of the valid_range is changing. I can use the -b 32 to unpack the data, but that creates larger files.

Another issue is that the units of the level have been changed from millibar to Pa:

original:

float level(level) ;
level:units = "millibar" ;
level:actual_range = 1000.f, 10.f ;
level:long_name = "Level" ;
level:positive = "down" ;
level:GRIB_id = 100s ;
level:GRIB_name = "hPa" ;

cdo generated variable:

double lev(lev) ;
lev:long_name = "pressure" ;
lev:units = "Pa" ;
lev:axis = "z" ;

For a 3-D depiction of the data with the IDV, this is problematic since it plots the data at 5 hPa instead of 500 hPa (millibars).

I'm using cdo 1.4.4, but I did not see any indication that these issues were addressed in subsequent releases.

Thank you for your time.

Don Murray


Replies (2)

RE: changes to netcdf variable definitions - Added by Uwe Schulzweida over 13 years ago

Hi Don,

Thanks for this report! The z-axis meta data (name and units) are lost after a call to sellevel. We will fix this bug in the next release.
CDO supports only int32, float64 and text attributes. Support for int16 and float32 attributes will be also available in the next release.
The new CDO release will be available in 2-3 weeks.

Best regards,
Uwe

RE: changes to netcdf variable definitions - Added by Don Murray over 13 years ago

Thanks, Uwe, for your quick response. I look forward to the new release.

Cheers,

Don

    (1-2/2)