lair.hrrr.get_nearest_point#

lair.hrrr.get_nearest_point(longitude, latitude, chunk_index)[source]#

Get the nearest point to a given latitude and longitude.

Parameters:
  • longitude (float) – longitude of point

  • latitude (float) – latitude of point

  • chunk_index (xr.Dataset) – chunk index dataset

Returns:

xr.Dataset – nearest point

Return type:

Dataset

See also

create_s3_chunk_url

Takes the chunk_id of the point it returns.

Winds

Calls it for the point you give.

PROJECTION

The projection it uses.

Examples

The chunk index is a Zarr dataset in the HRRR archive (needs the internet):

>>> import s3fs
>>> import xarray as xr
>>> from lair.hrrr import get_nearest_point
>>> fs = s3fs.S3FileSystem(anon=True)
>>> index = xr.open_zarr(
...     s3fs.S3Map("s3://hrrrzarr/grid/HRRR_chunk_index.zarr", s3=fs)
... )
>>> point = get_nearest_point(-111.848, 40.766, index)
>>> str(point.chunk_id.values)