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.
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