The package packing

It is not a lossless compression algorithm which only deletes redundant data so that the original data can be reconstructed exactly.

The used method is a lossy data compression and there is possibly a loss of accuracy.

The most significant bits of a four byte real value are stored on a two byte integer value. An offset and a scale factor are used for rebuilding the original real values.

If all values have the same order of magnitude, 5 to 7 digits of mantissa can be reconstructed exactly. The more orders of magnitude the data varies the greater the loss of accuracy after unpacking will be.

The source code of the package packing is under the control of the CVS (Concurrent Version System) Utility and can be checked out with the command

cvs co -P packing

Pack/Unpack data

Any NetCDF file can be packed or unpacked by the commands

ncdf_pack
ncdf_unpack

All files listed in the configuration file ncdf_pack.inp/ncdf_unpack.inp are packed/unpacked. Every line in these configuration files consists of two filenames (input file, output file). The original data sets are not overwritten !!!

The program ncdf_pack packs all REAL variables of the given files with the exception of the following variables (these are only copied):

The program ncdf_unpack unpacks all packed variables (with attribute PACKED_STATUS set to "PACKED") in the given files. After unpacking the attribute PACKED_STATUS is set to "UNPACKED".

There are also two example scripts for packing a large number of input files: ncdf_pack.exec1 and ncdf_pack.exec2

Use packed data in CLaMS

The program isentropic can use packed input data.

Besides it is possible to create packed output files with isentropic if in the configuration file isentropic.inp in line 25 "y" is specified. All variables (except the coordinate variables) will be packed. If some variables should not be packed, these variable names can also be specified in line 25 of isentropic.inp.

The packed isentropic files can be used in the other CLaMS packages.

It is possible to use packed UKMO/ECMWF data in:

Packed isentropic data can be used in the following programs:

Variable attributes for packed data

Name

Type

Description

add_offset

REAL

offset for unpacking

scale_factor

REAL

scale factor for unpacking

missing_value

INT*2

missing value for packed data

_FillValue

INT*2

FillValue for packed data

UNPACK_missing_value

REAL

missing value for original data

UNPACK_FillValue

REAL

FillValue for original data

UNPACK_valid_min

REAL

minimum valid value

UNPACK_valid_max

REAL

maximum valid value

PACKED_STATUS

STRING

PACKED|UNPACKED|NONE

DISABLE_PACKING

INT

0|1

Source Code

Source Code in package packing

ncdf_pack.f90

ncdf_unpack.f90

lib_ncpack.f90

Source Code in Library utils

packing.f90

nc_pack_utils.f90