arlmet.packing.pack#
- arlmet.packing.pack(unpacked)[source]#
Pack a 2D field using the ARL differential byte encoding.
This is the inverse of
unpack()and a translation of the HYSPLITPAKOUTroutine, in single precision asPAKOUTis, so it gives the same bytes, exponent, precision and initial value.- Parameters:
unpacked (
NDArray[Any]) – The 2D numpy array of shape (ny, nx) to be packed; it is packed asfloat32.- Returns:
Tuple of
(packed, precision, exponent, initial_value).packedis the byte payload,precisionandexponentare the ARL packing parameters, andinitial_valueis the value at the first grid cell.- Return type:
- Raises:
ValueError – If the field is not 2D, is empty, or holds NaN or infinite values.