This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Brent, >Date: Fri, 23 Mar 2001 13:45:59 -0500 (EST) >From: Brent A McDaniel <address@hidden> >Organization: Georgia Institute of Technology >To: Steve Emmerson <address@hidden> >Subject: Re: 20010322: netcdf question: NCEP reanalysis: precision loss >Keywords: 200103222003.f2MK3hL23783 The above message contained the following: > Perhaps I'm confused about something. If I go to the CDC's ftpsite and > download a file from the daily avg pressure level data, the data is shown > as being type short, yet it's showing precision to 5 decimal places, not > integer values. Here's a snip from ncdump -h for one of these files: > > short omega(time, level, lat, lon) ; > omega:long_name = "mean Daily Omega" ; > omega:valid_range = -3.f, 7.f ; > omega:actual_range = -1.120003f, 0.8909988f ; > omega:units = "Pascal/s" ; > omega:add_offset = 29.765f ; > omega:scale_factor = 0.001f ; The above "add_offset" and "scale_factor" attributes indicate that the omega values are "packed" into 16-bit values. The actual omega values are given by the expression "scale_factor*x + add_offset", where "x" is the packed, 16-bit value (in this case). It is the responsibility of the application to notice the attributes and perform the unpacking or packing. > omega:missing_value = 32766s ; > omega:precision = 3s ; > omega:least_significant_digit = 3s ; > omega:GRIB_id = 39s ; > omega:GRIB_name = "VVEL" ; > omega:var_desc = "Omega (dp/dt)\n", > "Z" ; > omega:dataset = "NCEP Reanalysis Daily Averages\n", > "AJ" ; > omega:level_desc = "Multiple levels\n", > "F" ; > omega:statistic = "Mean\n", > "M" ; > omega:parent_stat = "Individual Obs\n", > "I" ; > > So, is the difference that the ncep data is "packed" whereas my data is > not? If I want to keep the same type accuracy (more than integer say) and > use type float (to save space) do I need to pack the data with add_offset > and scale_factor? If the type in the dataset is to be floating-point, then there's no need to pack the data and the data should not have either a "scale_factor" or "add_offset" attribute. Regards, Steve Emmerson <http://www.unidata.ucar.edu>