arlmet.packing.unpack#
- arlmet.packing.unpack(packed, nx, ny, precision, exponent, initial_value, *, window=None)[source]#
Unpack an ARL differential byte stream into a 2D field.
This is a translation of the HYSPLIT
PAKINProutine and gives the samefloat32values, bit for bit: the arithmetic is in single precision, inPAKINP’s order, and likePAKINPit sets a value smaller thanprecisionto zero in every column but the first.- Parameters:
packed (
bytes|bytearray|memoryview) – The packed byte array to be unpacked.nx (
int) – The number of columns in the full data grid.ny (
int) – The number of rows in the full data grid.precision (
float) – Precision of the packed data. Values with an absolute value smaller than this are set to zero, except in the first column (x = 0), whichPAKINPleaves as it is.exponent (
int) – The packing scaling exponent.initial_value (
float) – The initial real value at the grid position (0,0).window (
GridWindow|None) – Rectangular grid window to unpack. When provided, only the requested subset is reconstructed.
- Returns:
Unpacked
float322D array with shape(ny, nx)or the requested windowed shape whenwindowis provided.- Return type: