lair.hrrr.ZarrId#

class lair.hrrr.ZarrId(run_hour, level_type, var_level, var_name, model_type)[source]#

Class to store information about a HRRR zarr file.

Each parameter is also an attribute of the same name.

Parameters:
  • run_hour (dt.datetime) – run hour of the model. A naive time follows the UTC rule; a tz-aware time is converted to UTC when the S3 key is built.

  • level_type ('sfc' | 'prs') – vertical level

  • var_level (str) – variable level

  • var_name (str) – variable name

  • model_type ('anl' | 'fcst') – analysis or forecast

See also

generate_zarr_ids

Makes one for each time and variable.

create_s3_group_url

The S3 address of its group.

create_s3_chunk_url

The S3 address of one chunk.

Examples

The analysis of 12 UTC on 2024-01-15, the 10 m u wind:

>>> import datetime as dt
>>> from lair.hrrr import ZarrId, create_s3_group_url
>>> zarr_id = ZarrId(
...     run_hour=dt.datetime(2024, 1, 15, 12),
...     level_type="sfc",
...     var_level="10m_above_ground",
...     var_name="UGRD",
...     model_type="anl",
... )
>>> create_s3_group_url(zarr_id)
's3://hrrrzarr/sfc/20240115/20240115_12z_anl.zarr/10m_above_ground/UGRD'

Methods

format_chunk_id(chunk_id)

Format chunk_id for zarr url.