arlmet.IndexRecord#
- class arlmet.IndexRecord(header, source, forecast, minutes, pole_lat, pole_lon, tangent_lat, tangent_lon, grid_size, orientation, cone_angle, sync_x, sync_y, sync_lat, sync_lon, reserved, nx, ny, nz, vertical_flag, levels)[source]#
Index record describing one ARL time step and its contained variables.
Index records are immutable value objects; use
dataclasses.replace()to derive a modified copy.- Parameters:
header (Header) – The header information for the index record.
source (str) – Source identifier (4 characters).
forecast (int) – Forecast hour.
minutes (int) – Minutes after the hour.
pole_lat (float) – Pole latitude position of the grid projection. For lat-lon grids: max latitude of the grid.
pole_lon (float) – Pole longitude position of the grid projection. For lat-lon grids: max longitude of the grid.
tangent_lat (float) – Reference latitude at which the grid spacing is defined. For conical and mercator projections, this is the latitude at which the grid touches the surface. For lat-lon grids: grid spacing in degrees latitude.
tangent_lon (float) – Reference longitude at which the grid spacing is defined. For conical and mercator projections, this is the longitude at which the grid touches the surface. For lat-lon grids: grid spacing in degrees longitude.
grid_size (float) – Grid spacing in km at the reference position. For lat-lon grids: value of zero signals that the grid is a lat-lon grid.
orientation (float) – Angle at the reference point made by the y-axis and the local direction of north. For lat-lon grids: 0
cone_angle (float) – Angle between the axis and the surface of the cone. For regular projections it equals the latitude at which the grid is tangent to the earth’s surface. Stereographic: ±90, Mercator: 0, Lambert Conformal: 0 ~ 90 For lat-lon grids: 0
sync_x (float) – Grid x-coordinate used to equate a position on the grid with a position on earth. This is a unitless grid index (FORTRAN 1-based).
sync_y (float) – Grid y-coordinate used to equate a position on the grid with a position on earth. This is a unitless grid index (FORTRAN 1-based).
sync_lat (float) – Earth latitude corresponding to the grid position (sync_x, sync_y). For lat-lon grids: latitude of the (0,0) grid point position.
sync_lon (float) – Earth longitude corresponding to the grid position (sync_x, sync_y). For lat-lon grids: longitude of the (0,0) grid point position.
reserved (float) – Twelfth projection field; holds the vertical-axis pressure offset.
nx (int) – Number of grid points in the x-direction (columns). This is the full size: the index record stores only
nx % 1000and the header’s grid letters carry the thousands (seeHeader.grid).ny (int) – Number of grid points in the y-direction (rows), full size as
nx.nz (int) – Number of vertical levels.
vertical_flag (int) – Vertical coordinate system type (1=sigma, 2=pressure, 3=terrain, 4=hybrid).
levels (sequence of LvlInfo) – Variable manifests for each stored vertical level.
- index_length#
Serialized length in bytes of the fixed plus variable portions (excluding the 50-byte header), computed from the current fields.
- Type:
- time#
The valid time of the record, calculated from the header time and minutes.
- Type:
pd.Timestamp
- vertical_axis#
Vertical axis built from
vertical_flag, level heights, andreserved.- Type:
- Raises:
ValueError – If
header.griddoes not carry the thousands ofnx/ny.
Examples
>>> from arlmet.header import Header >>> from arlmet.index import IndexRecord >>> header = Header( ... year=2024, ... month=7, ... day=18, ... hour=0, ... forecast=0, ... level=0, ... grid=(0, 0), ... variable="INDX", ... exponent=0, ... precision=0.0, ... initial_value=0.0, ... ) >>> isinstance(header.time, pd.Timestamp) True
Methods
|
|
|
Create an IndexRecord by reading from a file at a specific position. |
|
Serialize the index record padded to one full ARL record. |
Serialize the exact used bytes of the index record, including its header. |
Attributes
Construct a Grid from the index record's projection parameters. |
|
Serialized length of the fixed plus variable portions, in bytes. |
|
Valid time calculated from header time plus minutes offset. |
|
Construct the vertical axis definition from the index record. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|