[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: packing



Hi Piotr,

> I am not sure if the previous mail got to you.

Apparently not, this is the first message I've seen from you recently.

> I am trying to save data from the Navy NOGAPS model
> which uses 5byte integer to write the data

Do you mean 5-byte or 5-digit?  5-byte integer data could store 2^40
different integer values, which would provide a precision of about 12
significant digits.  I'll assume you mean 5-digit data, since you later say

> The ipack is written with
> 
>     format(120*i5)

which implies 5-digit data.

> unpack=ipack*fact+xmin
> 
> where
> 
> fact=(xmax-xmin)/99998.
> 
> 
 ...
> 
> How should I go about it with NeCDF. Is it possible to write 
> ipack array ? I would assume that many people ask the same question.

There are some common attribute conventions for packing floating-point data
into 8-bit or 16-bit integers, using the "scale_factor" and "add_offset"
attributes.  Although these are described in the netCDF User's Guide under
the section on commonly used attributes, there is a better description in
the document available at the URL:

    http://ferret.wrc.noaa.gov/noaa_coop/coop_cdf_profile.html

If more precision is required than 16-bits, the current version of netCDF
doesn't offer much help much.  netCDF version 3.0 will include better
packing capabilities, approaches to which are described in the document
available at URL:

    http://www.unidata.ucar.edu/packages/netcdf/packing.html

--Russ

______________________________________________________________________________

Russ Rew                                           UCAR Unidata Program
address@hidden                              http://www.unidata.ucar.edu