cf.Field.get_quantize_on_write

Field.get_quantize_on_write(default=ValueError())[source]

Get a quantize-on-write instruction.

Quantization eliminates false precision, usually by rounding the least significant bits of floating-point mantissas to zeros, so that a subsequent compression on disk is more efficient.

The existence of a quantize-on-write instruction does not mean that the data in memory has been quantized, rather it means that if the data is written to a netCDF dataset with cf.write, then quantization will be applied to the data in the netCDF dataset on disk, leaving the data in memory unchanged.

Added in version (cfdm): 1.12.2.0

Parameters:
default: optional

Return the value of the default keyword if there is no quantize-on-write instruction.

If set to an Exception instance then it will be raised instead.

Returns:
Quantization

A copy of the quantize-on-write instruction.

Examples

>>> f.set_quantize_on_write(algorithm='bitgroom', quantization_nsd=6)
>>> f.get_quantize_on_write()
<CF Quantization: algorithm=bitgroom, quantization_nsd=6>
>>> q = f.del_quantize_on_write()
>>> print(f.get_quantize_on_write(None))
None