blaylockbk / Herbie

Download numerical weather prediction datasets (HRRR, RAP, GFS, IFS, etc.) from NOMADS, NODD partners (Amazon, Google, Microsoft), ECMWF open data, and the University of Utah Pando Archive System.
https://herbie.readthedocs.io/
MIT License
424 stars 70 forks source link

Add xarray accessor `with_wind()` to compute wind speed/direction #314

Closed blaylockbk closed 3 days ago

blaylockbk commented 1 month ago

Adds a new herbie xarray accessor to compute wind speed and direction from the U and V wind components of a Dataset if they are available.

from herbie import Herbie

H = Herbie("2024-01-01")
ds = H.xarray("GRD:10 m above")
ds = ds.herbie.with_wind()

If you only want wind speed

ds.herbie.with_wind('speed')

If you only want wind direction

ds.herbie.with_wind('direction')