NetCDF allows simple and effective packing of floating point numbers in smaller integer types based on the formula
value_unpacked = scale_factor * value_packed + add_offset
where the scale factor and offset are floating point values. Such packing reduces the precision of the data, but for many applications this is acceptable given the significantly smaller files. See also:
Enter the required value range or set values of scale and offset and click "calculate" to fill the table below:
for value range to or
for scale and offset .
Type | int8 | int16 | int32 |
---|---|---|---|
Values | 28 = 256 | 216 = 65536 | 232 = 4294967296 |
Scale | |||
Offset | |||
Min | |||
· | |||
· | ... | ... | ... |
· | |||
Mid | |||
· | |||
· | ... | ... | ... |
· | |||
Max |
The corresponding encoding settings for xarray's to_netcdf:
dict()
dict()
dict()
Compression can additionally applied to further reduce the size of the output file.