arlmet.DataRecord#

class arlmet.DataRecord(recordset, position, level, variable, forecast=None, checksum=None, reserved=None)[source]#

One ARL data record representing a single 2D variable slice.

Parameters:
  • recordset (RecordSet) – Parent record set for the record.

  • position (int) – Byte offset of the record on disk, or -1 for a writable in-memory record.

  • level (int) – ARL vertical level index.

  • variable (str) – Four-character ARL variable name.

  • forecast (int, optional) – Forecast hour required when constructing a writable record.

  • checksum (int, optional) – Stored ARL checksum from the index record.

  • reserved (str, optional) – Reserved one-character metadata from the index record.

ndim#

NumPy-style dimensionality, always 2.

Type:

int

recordset#

Parent record set.

Type:

RecordSet

position#

Byte position of the record in the file.

Type:

int

level#

ARL level index.

Type:

int

variable#

Variable name for the record.

Type:

str

shape#

Grid shape as (ny, nx).

Type:

tuple[int, int]

data#

Cached unpacked data, loaded lazily on first access.

Type:

array-like

read(window=None)[source]#

Unpack the record from disk, optionally for a subset window.

verify_checksum()[source]#

Validate the packed bytes against the stored checksum.

Methods

DataRecord.__init__(recordset, position, ...)

Initializes the array representation.

DataRecord.read([window])

Read and unpack this record eagerly.

DataRecord.to_xarray([squeeze])

Convert this DataRecord to an xarray.DataArray.

DataRecord.verify_checksum()

Verify the packed payload against the checksum stored in metadata.

Attributes

DataRecord.bytes

Get the packed bytes for this data record.

DataRecord.checksum

Get the stored checksum for this data record.

DataRecord.data

Get the data for this record.

DataRecord.diff

Return the attached DIF record when present.

DataRecord.dtype

DataRecord.forecast

Get the forecast hour for this data record.

DataRecord.grid

Get the grid associated with this data record.

DataRecord.header

DataRecord.mode

DataRecord.n_bytes

Get the number of bytes in the packed data record (including the header).

DataRecord.ndim

DataRecord.shape

Return the shape of the data grid.

DataRecord.source

Get the source associated with this data record.

DataRecord.time

Get the time associated with this data record.

DataRecord.vertical_axis

Get the vertical axis associated with this data record.