lair.hrrr.winds_frame#

lair.hrrr.winds_frame(u_grid, v_grid, lon, times)[source]#

Earth-relative 10 m winds at a point from HRRR grid-relative components.

Parameters:
  • u_grid (array-like) – Grid-relative u and v components (m/s), one per time.

  • v_grid (array-like) – Grid-relative u and v components (m/s), one per time.

  • lon (float) – Longitude of the point.

  • times (list[dt.datetime]) – Valid times, used as the index.

Returns:

pd.DataFrame – Columns u, v (earth-relative, m/s), ws (speed from u and v, m/s) and wd (direction, degrees).

Return type:

DataFrame

See also

Winds

Downloads the components and calls this.

lair.air.rotate_winds

Turns grid-relative components to earth-relative.

lair.air.wind_direction

The direction of a u and v.

Examples

At 97.5 W, the middle of the HRRR domain, the grid points north, so the components do not change. A wind blowing toward the south (v = -4) comes from the north (0 degrees); one blowing toward the east (u = 3), from the west (270):

>>> import datetime as dt
>>> from lair.hrrr import winds_frame
>>> times = [dt.datetime(2024, 1, 15, 12), dt.datetime(2024, 1, 15, 13)]
>>> winds_frame([0.0, 3.0], [-4.0, 0.0], lon=-97.5, times=times).round(2)
                       u    v   ws     wd
2024-01-15 12:00:00  0.0 -4.0  4.0    0.0
2024-01-15 13:00:00  3.0  0.0  3.0  270.0