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

[netCDF #UPA-771360]: netCDF: Representing floating point with Compressed Integer?



Hi,

> If I want to reduce the data volume by representing floating point values 
> using 'compressed integer'(?), does netCDF have an API for that or would I 
> have to that myself before writing to the array to the netCDF4/HDF5 file?

There is no API for packing floats or doubles in smaller integers 
in the netCDF C or Fortran libraries, but there is a convention

  http://www.unidata.ucar.edu/netcdf/docs/netcdf/Attribute-Conventions.html

for using the "scale_factor" and "add_offset" attributes to 
implement packing. A detailed description of how to handle 
this convention is in the Best Practices document here:

  http://www.unidata.ucar.edu/netcdf/docs/BestPractices.html#Packed Data Values

The netCDF-Java API implements packing and unpacking according to 
the above convention automatically.  Also the NCO (NetCDF Operators)
package implements packing according to that convention:

  http://nco.sourceforge.net/nco.html#Packed-data

> Would it be the same for both classic & enhanced models?

That simple packing convention will work for both classic
and enhanced models, but it's not implemented in the C or
Fortran libraries. The netCDF-4 library implements zlib
compression as well, for both netCDF-4 and netCDF-4 
classic-model formats, and that can sometimes achieve 
better compression than packing.

--Russ

> Thanks,
> 
> 
> ------------------------------------------------------------------------
> Oh-ig Kwoun
> 
> NASA/JPL, California Institute of Technology
> 4800 Oak Grove Drive, MS-T264-867
> Pasadena, CA 91109-8099, USA
> (Cell) (818) 399-6998
> Tel:   (818) 354-3496
> Fax:  (818) TBD
> ------------------------------------------------------------------------
> 
Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: UPA-771360
Department: Support netCDF
Priority: Normal
Status: Closed


NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.