Brian Blaylock
July 20, 2021

GFS Data#

The product names are not as simple as the HRRR dataset, but we can still get GFS data.

[12]:
from herbie.archive import Herbie
from toolbox.cartopy_tools import common_features, pc
from paint.standard2 import cm_tmp

import matplotlib.pyplot as plt
import cartopy.crs as ccrs
[13]:
H = Herbie("2021-07-11", model="gfs", product="pgrb2.0p25")
🏋🏻‍♂️ Found 2021-Jul-11 00:00 UTC F00 [GFS] [product=pgrb2.0p25] GRIB2 file from aws and index file from aws.
[14]:
H.SOURCES
[14]:
{'aws': 'https://noaa-gfs-bdp-pds.s3.amazonaws.com/gfs.20210711/00/atmos/gfs.t00z.pgrb2.0p25.f000',
 'aws-old': 'https://noaa-gfs-bdp-pds.s3.amazonaws.com/gfs.20210711/00/gfs.t00z.pgrb2.0p25.f000',
 'nomads': 'https://nomads.ncep.noaa.gov/pub/data/nccf/com/gfs/prod/gfs.20210711/00/atmos/gfs.t00z.pgrb2.0p25.f000',
 'google': 'https://storage.googleapis.com/global-forecast-system/gfs.20210711/00/atmos/gfs.t00z.pgrb2.0p25.f000',
 'azure': 'https://noaagfs.blob.core.windows.net/gfs/gfs.20210711/00/atmos/gfs.t00z.pgrb2.0p25.f000'}
[15]:
x = H.xarray("^TMP:2 m above")
📇 Download subset: [GFS] model [pgrb2.0p25] product run at 2021-Jul-11 00:00 UTC F00
 cURL from https://noaa-gfs-bdp-pds.s3.amazonaws.com/gfs.20210711/00/atmos/gfs.t00z.pgrb2.0p25.f000
   1: GRIB_message=580 TMP:2 m above ground:anl
[16]:
ax = common_features(crs=x.herbie.crs, figsize=[8, 8]).ax
p = ax.pcolormesh(
    x.longitude, x.latitude, x.t2m, transform=pc, **cm_tmp(units="K").cmap_kwargs
)
plt.colorbar(
    p, ax=ax, orientation="horizontal", pad=0.05, **cm_tmp(units="K").cbar_kwargs
)

ax.set_title(x.t2m.GRIB_name, loc="right")
ax.set_title(f"{x.model.upper()}: {H.product_description}", loc="left")
[16]:
Text(0.0, 1.0, 'GFS: common fields, 0.25 degree resolution')
../../_images/user_guide_notebooks_data_gfs_5_1.png
[17]:
ax = common_features(
    crs=ccrs.Geostationary(central_longitude=-100), figsize=[10, 10]
).ax

p = ax.pcolormesh(
    x.longitude, x.latitude, x.t2m, transform=pc, **cm_tmp(units="K").cmap_kwargs
)
plt.colorbar(
    p,
    ax=ax,
    orientation="horizontal",
    pad=0.05,
    shrink=0.8,
    **cm_tmp(units="K").cbar_kwargs,
)

ax.set_title(x.t2m.GRIB_name, loc="right")
ax.set_title(f"{x.model.upper()}: {H.product_description}", loc="left")
[17]:
Text(0.0, 1.0, 'GFS: common fields, 0.25 degree resolution')
../../_images/user_guide_notebooks_data_gfs_6_1.png

Can also use metpy to parse GFS grid_mapping#

This works because Herbie attempts to parse the grid_mapping from the cfgrib GRIB info.

[18]:
crs = x.metpy.parse_cf().metpy_crs.item().to_cartopy()
ax = common_features(crs=crs, figsize=[8, 8]).ax
p = ax.pcolormesh(
    x.longitude, x.latitude, x.t2m, transform=pc, **cm_tmp(units="K").cmap_kwargs
)
../../_images/user_guide_notebooks_data_gfs_8_0.png
[20]:
ax = common_features(crs=ccrs.Robinson(), figsize=[8, 8]).ax
p = ax.pcolormesh(
    x.longitude, x.latitude, x.t2m, transform=pc, **cm_tmp(units="K").cmap_kwargs
)
../../_images/user_guide_notebooks_data_gfs_9_0.png

Get data from the GFS wave output#

[4]:
H = Herbie("2021-07-11", model="gfs_wave")
/p/home/blaylock/BB_python/Herbie/herbie/archive.py:205: UserWarning: `product` not specified. Will use ["arctic.9km"].
  warnings.warn(f'`product` not specified. Will use ["{self.product}"].')
🏋🏻‍♂️ Found 2021-Jul-11 00:00 UTC F00 [GFS_WAVE] [product=arctic.9km] GRIB2 file from aws and index file from aws.
[5]:
H.read_idx()
[5]:
start_byte end_byte range reference_time valid_time variable level forecast_time
grib_message
1.0 0 430316 0-430316 2021-07-11 2021-07-11 WIND surface anl
2.0 430316 1049180 430316-1049180 2021-07-11 2021-07-11 WDIR surface anl
3.0 1049180 1480559 1049180-1480559 2021-07-11 2021-07-11 UGRD surface anl
4.0 1480559 1908977 1480559-1908977 2021-07-11 2021-07-11 VGRD surface anl
5.0 1908977 2174766 1908977-2174766 2021-07-11 2021-07-11 HTSGW surface anl
6.0 2174766 2497196 2174766-2497196 2021-07-11 2021-07-11 PERPW surface anl
7.0 2497196 3016885 2497196-3016885 2021-07-11 2021-07-11 DIRPW surface anl
8.0 3016885 3260189 3016885-3260189 2021-07-11 2021-07-11 WVHGT surface anl
9.0 3260189 3529930 3260189-3529930 2021-07-11 2021-07-11 SWELL 1 in sequence anl
10.0 3529930 3764423 3529930-3764423 2021-07-11 2021-07-11 SWELL 2 in sequence anl
11.0 3764423 3968459 3764423-3968459 2021-07-11 2021-07-11 SWELL 3 in sequence anl
12.0 3968459 4247106 3968459-4247106 2021-07-11 2021-07-11 WVPER surface anl
13.0 4247106 4558849 4247106-4558849 2021-07-11 2021-07-11 SWPER 1 in sequence anl
14.0 4558849 4873390 4558849-4873390 2021-07-11 2021-07-11 SWPER 2 in sequence anl
15.0 4873390 5158237 4873390-5158237 2021-07-11 2021-07-11 SWPER 3 in sequence anl
16.0 5158237 5558669 5158237-5558669 2021-07-11 2021-07-11 WVDIR surface anl
17.0 5558669 6033915 5558669-6033915 2021-07-11 2021-07-11 SWDIR 1 in sequence anl
18.0 6033915 6470116 6033915-6470116 2021-07-11 2021-07-11 SWDIR 2 in sequence anl
19.0 6470116 6470116- 2021-07-11 2021-07-11 SWDIR 3 in sequence anl
[10]:
x = H.xarray("SWELL:1 in sequence", remove_grib=False)
📇 Download subset: [GFS_WAVE] model [arctic.9km] product run at 2021-Jul-11 00:00 UTC F00
 cURL from https://noaa-gfs-bdp-pds.s3.amazonaws.com/gfs.20210711/00/wave/gridded/gfswave.t00z.arctic.9km.f000.grib2
   1: GRIB_message=9   SWELL:1 in sequence:anl
ecCodes provides no latitudes/longitudes for gridType='polar_stereographic'
/p/home/blaylock/BB_python/Herbie/herbie/archive.py:733: UserWarning: the grib file might not have enough info to parse grid_mapping
  warnings.warn('the grib file might not have enough info to parse grid_mapping')
[11]:
x.swell.plot()
[11]:
<matplotlib.collections.QuadMesh at 0x2acff29132b0>
../../_images/user_guide_notebooks_data_gfs_14_1.png
[12]:
x.herbie.crs
[12]:
2021-09-22T23:50:47.594899 image/svg+xml Matplotlib v3.4.2, https://matplotlib.org/
<cartopy.crs.NorthPolarStereo object at 0x2acff2950f90>
[9]:
x
[9]:
<xarray.Dataset>
Dimensions:              (y: 1006, x: 1006)
Coordinates:
    time                 datetime64[ns] 2021-07-11
    step                 timedelta64[ns] 00:00:00
    orderedSequenceData  float64 1.0
    valid_time           datetime64[ns] 2021-07-11
Dimensions without coordinates: y, x
Data variables:
    swell                (y, x) float32 nan nan nan nan nan ... nan nan nan nan
    gfs_wave_projection  object None
Attributes:
    GRIB_edition:            2
    GRIB_centre:             kwbc
    GRIB_centreDescription:  US National Weather Service - NCEP
    GRIB_subCentre:          0
    Conventions:             CF-1.7
    institution:             US National Weather Service - NCEP
    model:                   gfs_wave
    product:                 arctic.9km
    description:             Global Forecast System - Wave Products
    remote_grib:             https://noaa-gfs-bdp-pds.s3.amazonaws.com/gfs.20...
    local_grib:              /p/cwfs/blaylock/data/gfs_wave/20210711/gfswave....
[ ]:

[ ]: