arlmet.RecordSet.create_datarecord#

RecordSet.create_datarecord(variable, level, *, forecast, data=None, diff=None)[source]#

Create a writable DataRecord attached to this time step.

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

  • level (int) – ARL level index for the record.

  • forecast (int) – Forecast hour to write into the record header. A field that is NaN everywhere is written as missing data, as HYSPLIT’s writer leaves a field it never fills (pakini.f): forecast hour -1 and no values, whatever forecast says. Readers skip it, and DataRecord.read() returns NaN for it.

  • data (ArrayLike | None) – Initial (ny, nx) field values to assign. When omitted, assign the whole field later with record[:] = values.

  • diff (str | Sequence[str] | None) – Name of a trailing DIF record to derive from the parent field: the field minus the packed parent, what packing lost. Give several names to write several DIF records after the parent, in order; each holds what packing left after the parent and the DIF records before it, so a reader that adds them all (as HYSPLIT does) gets back to the field. One is the usual case. Each name must be one that HYSPLIT’s name table pairs with variable at level: DIFW with WWND or DZDT, DIFT with TKEN or TKEU, and at the surface (level 0) any DIF* name with TPP* or PRT*.

Returns:

Writable data record for the requested variable and level.

Return type:

DataRecord

Raises:

ValueError – If variable is a DIF* name, or a diff name is not one the name table pairs with variable at level.