Herbie: Retrieve NWP Model Data#
Herbie is a python package that downloads recent and archived numerical weather prediction (NWP) model output from different cloud archive sources. Its most popular capability is to download HRRR model data. NWP data in GRIB2 format can be read with xarray+cfgrib. Model data Herbie can retrieve includes the High Resolution Rapid Refresh (HRRR), Rapid Refresh (RAP), Global Forecast System (GFS), National Blend of Models (NBM), Rapid Refresh Forecast System - Prototype (RRFS), and ECMWF open data forecast products (ECMWF).
Installation#
The easiest way to instal Herbie and its dependencies is within a Conda environment. I provided an environment.yml file that you may use or modify.
# Download environment file
wget https://github.com/blaylockbk/Herbie/raw/main/environment.yml
# Create the environment
conda env create -f environment.yml
# Activate the environment
conda activate herbie
Alternatively, Herbie is published on PyPI and can be install with pip, but it requires some dependencies that you will have to install yourself:
Python 3.8, 3.9, or 3.10 (recommended)
cURL
Cartopy, which requires GEOS and Proj.
cfgrib, which requires eccodes.
Optional: wgrib2
Optional: Carpenter Workshop
When those are installed within your environment, then you can install Herbie with pip.
# Latest published version
pip install herbie-data
# ~~ or ~~
# Most recent changes
pip install git+https://github.com/blaylockbk/Herbie.git
Capabilities#
Create a Herbie object#
The most important piece of Herbie is the Herbie class which represents a single model output file. When you create a Herbie object, Herbie looks for model data at different sources until the requested file is found.
Herbie can discover data from the following models (click for example usage):
This example shows how to create a Herbie object for the HRRR model sfc
product and 6 hour forecast. The file was found an Amazon Web Services.
from herbie import Herbie
H = Herbie('2021-07-01 12:00', model='hrrr', product='sfc', fxx=6)
OUT:
✅ Found ┊ model=hrrr ┊ product=sfc ┊ 2021-Jul-01 12:00 UTC F06 ┊ GRIB2 @ aws ┊ IDX @ aws
Data Sources#
Thanks to the NOAA Big Data Program weather data is more easily accessible than ever before. Common data sources include
NOAA NOMADS Server (most recent data, but not archived)
Download Model Data#
Using the Herbie object we created above, this downloads the full GRIB2 file to your local machine.
H.download()
Download a subset#
Subsetting GRIB files by GRIB message is also supported, provided that an index (.idx) file exists. For more information about subsetting, read What is GRIB2?.
Using the Herbie object we created above, we can retrieve all fields at 500 mb.
# Download all fields at 700 mb level
H.download(":700 mb")
Read GRIB2 Data#
Herbie can help you read these files with xarray via cfgrib.
# Open 2-m Temperature field
H.xarray('TMP:2 m')

Fast Herbie#
Often, data from several GRIB2 files is needed (range of datetimes and/or forecast lead time). FastHerbie()
use multithreading to help you efficiently create multiple Herbie objects, download many files, and open data in concatenated xarray DataSets for a range of model runs and forecast lead times.
In this example, we will get the F00-F03 forecasts for each of the runs initialized between 00z-06z on January 1, 2022 (a total of 28 Herbie objects).
from herbie import FastHerbie
import pandas as pd
# Create a range of dates
DATES = pd.date_range('2022-01-01 00:00', '2022-01-01 06:00', freq='1H')
# Create a range of forecast lead times
fxx = range(0,4)
# Make FastHerbie Object.
FH = FastHerbie(DATES, model='hrrr', fxx=fxx)
At it’s core, FastHerbie
uses multithreading to make a list of Herbie objects. The list of Herbie objects is stored in the property
FH.objects
You can download those Herbie objects
# Full GRIB2 files
FH.download()
# Subset of GRIB2 files
FH.download("TMP:2 m")
or read the data into an xarray DataSet
ds = FH.xarray("TMP:2 m")

Xarray Herbie Accessors#
Note
🏗 Some of these features are under construction.
Herbie comes with custom xarray DataSet accessors.
ds.herbie.crs
returns the cartopy coordinate reference system.ds.herbie.polygon
returns the model domain boundary as a polygon.ds.herbie.nearest_points()
extracts the data nearest certain lat/lon points.ds.herbie.plot()
creates a map plot.
These tools use my Carpenter Workshop.
Other Tools#
🛰 GOES ABI and GLM data can be downloaded from AWS with my goes-2-go package. This package was also originally developed during grad school and has been updated.
🌡 Synoptic API (MesoWest) data can be retrieved with my SynopticPy package, also originally developed during grad school and has been updated.