lair.hrrr.create_s3_chunk_url#

lair.hrrr.create_s3_chunk_url(zarr_id, chunk_id, prefix=False)[source]#

Create the s3 chunk url for a zarr id.

  • Contains just the data for the chunk (no metadata)

  • Current APIs (zarr, xarray) don’t support reading zarr data by chunks, so we have to write relatively low-level code to load data on this level

Parameters:
  • zarr_id (ZarrId) – ZarrId instance

  • chunk_id (str) – Name of the chunk’s object in the zarr group, for example "4.5" (forecasts get a leading time index, see ZarrId.format_chunk_id). It is the chunk_id of a point in the HRRR chunk index (see get_nearest_point).

  • prefix (bool) – include prefix

Returns:

str – s3 chunk url

Return type:

str

See also

create_s3_subgroup_url

The level above.

get_value

Reads the chunk this names.

get_nearest_point

Gives the chunk_id of a point.

Examples

>>> import datetime as dt
>>> from lair.hrrr import ZarrId, create_s3_chunk_url
>>> zarr_id = ZarrId(
...     dt.datetime(2024, 1, 15, 12), "sfc", "10m_above_ground", "UGRD", "anl"
... )
>>> create_s3_chunk_url(zarr_id, "4.5")
'sfc/20240115/20240115_12z_anl.zarr/10m_above_ground/UGRD/10m_above_ground/UGRD/4.5'