lair.hrrr.retrieve_object#

lair.hrrr.retrieve_object(s3, s3_url)[source]#

Retrieve object from s3.

Parameters:
  • s3 (boto3.resource) – s3 resource

  • s3_url (str) – s3 url

Returns:

bytes – compressed object data

See also

decompress_chunk

Turns the bytes into an array.

get_value

Does both, and picks the point out of the chunk.

Examples

Needs the internet:

>>> import boto3
>>> from botocore import UNSIGNED
>>> from botocore.config import Config
>>> from lair.hrrr import retrieve_object
>>> s3 = boto3.resource(
...     "s3", region_name="us-west-1", config=Config(signature_version=UNSIGNED)
... )
>>> key = "sfc/20240115/20240115_12z_anl.zarr/10m_above_ground/UGRD/10m_above_ground/UGRD/4.5"
>>> data = retrieve_object(s3, key)