arlmet.pack#

arlmet.pack(unpacked)[source]#

Pack a 2D field using the ARL differential byte encoding.

This is the inverse of unpack() and mirrors the HYSPLIT PAKOUT routine.

Parameters:

unpacked (np.ndarray) – The 2D numpy array of shape (ny, nx) to be packed.

Returns:

Tuple of (packed, precision, exponent, initial_value). packed is the byte payload, precision and exponent are the ARL packing parameters, and initial_value is the reference value at the first grid cell.

Return type:

tuple[np.ndarray, float, int, float]