lair.hrrr.generate_zarr_ids#

lair.hrrr.generate_zarr_ids(times, level_type, variables, model_type)[source]#

Generate ZarrId instance for multiple times and variables

Parameters:
  • times ([dt.datetime]) – list of datetime objects with hour specified. Naive times follow the UTC rule; tz-aware times are converted to UTC when the S3 keys are built.

  • level_type (str) – veritical level

  • variables ([(str, str)]) – list of tuples: (var_name, var_level)

  • model_type (str) – ‘anl’ | ‘fcst’

Returns:

ids ([ZarrId]) – dictionary of zarr ids with var as key

See also

ZarrId

What it makes.

Winds

Calls it for the 10 m u and v.

Examples

Two hours of the 10 m u wind: one key per variable, with a list of one ZarrId per time:

>>> import datetime as dt
>>> from lair.hrrr import generate_zarr_ids
>>> times = [dt.datetime(2024, 1, 15, 12), dt.datetime(2024, 1, 15, 13)]
>>> ids = generate_zarr_ids(
...     times, "sfc", [("UGRD", "10m_above_ground")], model_type="anl"
... )
>>> list(ids)
[('UGRD', '10m_above_ground')]
>>> [z.run_hour.hour for z in ids[("UGRD", "10m_above_ground")]]
[12, 13]