GDPS π ±#
BETA Requires MetPy >=1.6
This demonstrates using data from Canadaβs GEM Global or Global Deterministic Prediction System (GDPS).
Data Sources
|
Data source |
Archive Duration |
|---|---|---|
|
Last 24 hours |
Model Initialization
Model cyles every twelve hours.
Forecast Hour
For the most recent version of GDPSβ¦
|
Forecast lead time |
|---|---|
|
3-hourly forecasts available |
Products
|
Product Description |
|---|---|
|
Global domain |
Variable and Level
You will need to specify the variable and level for each request.
NOTE: The organization of these files is different than other NWP products.
There are no index files provided.
Each GRIB2 file only contains one message. The variable name and level is in the fileβs name.
Herbie requires you provide a keyword argument for both
variableandlevel. Pay special attention to model description (linked above) to understand how the model data is organized. If you donβt provide input forvariableorlevel, Herbie will give you some ideas. For example,variable=TMPandlevel=TGL_2will give you the filename that containsTMP_TGL_2
Note: This requires MetPy version 1.6 or greater which has the capability to parse the rotated latitude longitude map projection type (see MetPy/#3123).
[1]:
from herbie import Herbie
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
from herbie.toolbox import EasyMap, pc
import cartopy.crs as ccrs
import cartopy.feature as feature
import pandas as pd
recent = pd.Timestamp("now").floor("12h") - pd.Timedelta("12h")
[2]:
recent
[2]:
Timestamp('2026-04-16 12:00:00')
[3]:
# Some examples
H = Herbie(
recent, # Datetime
model="gdps",
fxx=30,
variable="TMP",
level="TGL_2",
)
H.grib
β
Found β model=gdps β product=15km/grib2/lat_lon β 2026-Apr-16 12:00 UTC F30 β GRIB2 @ msc β IDX @ None
[3]:
'https://dd.weather.gc.ca/20260416/WXO-DD/model_gem_global/15km/grib2/lat_lon/12/030/CMC_glb_TMP_TGL_2_latlon.15x.15_2026041612_P030.grib2'
[4]:
H = Herbie(
recent, # Datetime
model="gdps",
fxx=12,
variable="HGT",
level="ISBL_500",
)
H.grib
β
Found β model=gdps β product=15km/grib2/lat_lon β 2026-Apr-16 12:00 UTC F12 β GRIB2 @ msc β IDX @ None
[4]:
'https://dd.weather.gc.ca/20260416/WXO-DD/model_gem_global/15km/grib2/lat_lon/12/012/CMC_glb_HGT_ISBL_500_latlon.15x.15_2026041612_P012.grib2'
Get the 2-metre temperature#
[5]:
H = Herbie(
recent,
model="gdps",
fxx=0,
variable="TMP",
level="TGL_2",
)
ds = H.xarray()
ds
β
Found β model=gdps β product=15km/grib2/lat_lon β 2026-Apr-16 12:00 UTC F00 β GRIB2 @ msc β IDX @ None
π¨π»βπ Created directory: [/home/meteo/kps5442/data/gdps/20260416]
/home/kps5442/mapwall_dev/herbie-dev/src/herbie/core.py:1306: UserWarning: Will not remove GRIB file because Herbie will only remove subsetted files (not full files).
warnings.warn(
[5]:
<xarray.Dataset> Size: 12MB
Dimensions: (latitude: 1201, longitude: 2400)
Coordinates:
* latitude (latitude) float64 10kB -90.0 -89.85 ... 89.85 90.0
* longitude (longitude) float64 19kB -180.0 -179.8 ... 179.7 179.8
time datetime64[ns] 8B 2026-04-16T12:00:00
step timedelta64[ns] 8B 00:00:00
heightAboveGround float64 8B 2.0
valid_time datetime64[ns] 8B ...
gribfile_projection object 8B None
Data variables:
t2m (latitude, longitude) float32 12MB ...
Attributes:
GRIB_edition: 2
GRIB_centre: cwao
GRIB_centreDescription: Canadian Meteorological Service - Montreal
GRIB_subCentre: 0
Conventions: CF-1.7
institution: Canadian Meteorological Service - Montreal
model: gdps
product: 15km/grib2/lat_lon
description: Canada's Global Deterministic Prediction System ...
remote_grib: /home/meteo/kps5442/data/gdps/20260416/CMC_glb_T...
local_grib: /home/meteo/kps5442/data/gdps/20260416/CMC_glb_T...
search: NonePlot data on Plate Carree projection#
[6]:
ax = EasyMap("50m").BORDERS().STATES(alpha=0.5).ax
p = ax.pcolormesh(ds.longitude, ds.latitude, ds.t2m, transform=pc, cmap="Spectral_r")
plt.colorbar(p, ax=ax, orientation="horizontal", pad=0.01, shrink=0.8)
ax.set_title(
f"2-m Temperature\nValid {ds.valid_time.dt.strftime('%Y-%m-%d %H:%M').item()} UTC",
loc="right",
fontsize=10,
)
ax.set_title(f"{ds.model.upper()}: {H.product_description}", loc="left")
ax.gridlines()
[6]:
<cartopy.mpl.gridliner.Gridliner at 0x764b2a5874d0>
Get 10-m U and 10-m V wind#
[7]:
# loading more than one variable requires a loop, because the
# data is stored in multiple files (and a Herbie object only
# represents a single file).
store = []
for var, lev in zip(["UGRD", "VGRD"], ["TGL_10", "TGL_10"]):
_ds = Herbie(
recent,
model="gdps",
fxx=0,
product="15km/grib2/lat_lon",
variable=var,
level=lev,
).xarray()
store.append(_ds)
ds = xr.merge(store)
ds
β
Found β model=gdps β product=15km/grib2/lat_lon β 2026-Apr-16 12:00 UTC F00 β GRIB2 @ msc β IDX @ None
/home/kps5442/mapwall_dev/herbie-dev/src/herbie/core.py:1306: UserWarning: Will not remove GRIB file because Herbie will only remove subsetted files (not full files).
warnings.warn(
β
Found β model=gdps β product=15km/grib2/lat_lon β 2026-Apr-16 12:00 UTC F00 β GRIB2 @ msc β IDX @ None
/home/kps5442/mapwall_dev/herbie-dev/src/herbie/core.py:1306: UserWarning: Will not remove GRIB file because Herbie will only remove subsetted files (not full files).
warnings.warn(
/tmp/ipykernel_2515008/1831517428.py:17: FutureWarning: In a future version of xarray the default value for compat will change from compat='no_conflicts' to compat='override'. This is likely to lead to different results when combining overlapping variables with the same name. To opt in to new defaults and get rid of these warnings now use `set_options(use_new_combine_kwarg_defaults=True) or set compat explicitly.
ds = xr.merge(store)
/tmp/ipykernel_2515008/1831517428.py:17: FutureWarning: In a future version of xarray the default value for compat will change from compat='no_conflicts' to compat='override'. This is likely to lead to different results when combining overlapping variables with the same name. To opt in to new defaults and get rid of these warnings now use `set_options(use_new_combine_kwarg_defaults=True) or set compat explicitly.
ds = xr.merge(store)
/tmp/ipykernel_2515008/1831517428.py:17: FutureWarning: In a future version of xarray the default value for compat will change from compat='no_conflicts' to compat='override'. This is likely to lead to different results when combining overlapping variables with the same name. To opt in to new defaults and get rid of these warnings now use `set_options(use_new_combine_kwarg_defaults=True) or set compat explicitly.
ds = xr.merge(store)
/tmp/ipykernel_2515008/1831517428.py:17: FutureWarning: In a future version of xarray the default value for compat will change from compat='no_conflicts' to compat='override'. This is likely to lead to different results when combining overlapping variables with the same name. To opt in to new defaults and get rid of these warnings now use `set_options(use_new_combine_kwarg_defaults=True) or set compat explicitly.
ds = xr.merge(store)
/tmp/ipykernel_2515008/1831517428.py:17: FutureWarning: In a future version of xarray the default value for compat will change from compat='no_conflicts' to compat='override'. This is likely to lead to different results when combining overlapping variables with the same name. To opt in to new defaults and get rid of these warnings now use `set_options(use_new_combine_kwarg_defaults=True) or set compat explicitly.
ds = xr.merge(store)
[7]:
<xarray.Dataset> Size: 23MB
Dimensions: (latitude: 1201, longitude: 2400)
Coordinates:
* latitude (latitude) float64 10kB -90.0 -89.85 ... 89.85 90.0
* longitude (longitude) float64 19kB -180.0 -179.8 ... 179.7 179.8
time datetime64[ns] 8B 2026-04-16T12:00:00
step timedelta64[ns] 8B 00:00:00
heightAboveGround float64 8B 10.0
valid_time datetime64[ns] 8B 2026-04-16T12:00:00
gribfile_projection object 8B None
Data variables:
u10 (latitude, longitude) float32 12MB ...
v10 (latitude, longitude) float32 12MB ...
Attributes:
GRIB_edition: 2
GRIB_centre: cwao
GRIB_centreDescription: Canadian Meteorological Service - Montreal
GRIB_subCentre: 0
Conventions: CF-1.7
institution: Canadian Meteorological Service - Montreal
model: gdps
product: 15km/grib2/lat_lon
description: Canada's Global Deterministic Prediction System ...
remote_grib: /home/meteo/kps5442/data/gdps/20260416/CMC_glb_U...
local_grib: /home/meteo/kps5442/data/gdps/20260416/CMC_glb_U...
search: None[8]:
# MetPy version >= 1.6 is required to parse the map projection
ds.herbie.crs
[8]:
<cartopy.crs.PlateCarree object at 0x764b30972150>
[9]:
ax = (
EasyMap("50m", crs=ds.herbie.crs, figsize=8, linewidth=1)
.BORDERS()
.STATES(alpha=0.5)
.ax
)
p = ax.pcolormesh(
ds.longitude,
ds.latitude,
np.hypot(ds.u10, ds.v10), # Wind Speed
transform=pc,
)
plt.colorbar(
p, ax=ax, orientation="horizontal", pad=0.01, shrink=0.8, label="Wind speed (m/s)"
)
ax.set_title(
f"10-m Wind Speed\nValid {ds.valid_time.dt.strftime('%Y-%m-%d %H:%M').item()} UTC",
loc="center",
fontsize=10,
)
ax.set_title(f"{ds.model.upper()}", loc="left")
[9]:
Text(0.0, 1.0, 'GDPS')
500 hPa Humidity and Geopotential Height#
[10]:
# loading more than one variable requires a loop, because the
# data is stored in multiple files (and a Herbie object only
# represents a single file).
store = []
for var, lev in zip(["HGT", "RH"], ["ISBL_500", "ISBL_500"]):
_ds = Herbie(
recent,
model="gdps",
fxx=0,
product="15km/grib2/lat_lon",
variable=var,
level=lev,
).xarray()
store.append(_ds)
ds = xr.merge(store)
ds
β
Found β model=gdps β product=15km/grib2/lat_lon β 2026-Apr-16 12:00 UTC F00 β GRIB2 @ msc β IDX @ None
/home/kps5442/mapwall_dev/herbie-dev/src/herbie/core.py:1306: UserWarning: Will not remove GRIB file because Herbie will only remove subsetted files (not full files).
warnings.warn(
β
Found β model=gdps β product=15km/grib2/lat_lon β 2026-Apr-16 12:00 UTC F00 β GRIB2 @ msc β IDX @ None
/home/kps5442/mapwall_dev/herbie-dev/src/herbie/core.py:1306: UserWarning: Will not remove GRIB file because Herbie will only remove subsetted files (not full files).
warnings.warn(
/tmp/ipykernel_2515008/1199894210.py:17: FutureWarning: In a future version of xarray the default value for compat will change from compat='no_conflicts' to compat='override'. This is likely to lead to different results when combining overlapping variables with the same name. To opt in to new defaults and get rid of these warnings now use `set_options(use_new_combine_kwarg_defaults=True) or set compat explicitly.
ds = xr.merge(store)
/tmp/ipykernel_2515008/1199894210.py:17: FutureWarning: In a future version of xarray the default value for compat will change from compat='no_conflicts' to compat='override'. This is likely to lead to different results when combining overlapping variables with the same name. To opt in to new defaults and get rid of these warnings now use `set_options(use_new_combine_kwarg_defaults=True) or set compat explicitly.
ds = xr.merge(store)
/tmp/ipykernel_2515008/1199894210.py:17: FutureWarning: In a future version of xarray the default value for compat will change from compat='no_conflicts' to compat='override'. This is likely to lead to different results when combining overlapping variables with the same name. To opt in to new defaults and get rid of these warnings now use `set_options(use_new_combine_kwarg_defaults=True) or set compat explicitly.
ds = xr.merge(store)
/tmp/ipykernel_2515008/1199894210.py:17: FutureWarning: In a future version of xarray the default value for compat will change from compat='no_conflicts' to compat='override'. This is likely to lead to different results when combining overlapping variables with the same name. To opt in to new defaults and get rid of these warnings now use `set_options(use_new_combine_kwarg_defaults=True) or set compat explicitly.
ds = xr.merge(store)
/tmp/ipykernel_2515008/1199894210.py:17: FutureWarning: In a future version of xarray the default value for compat will change from compat='no_conflicts' to compat='override'. This is likely to lead to different results when combining overlapping variables with the same name. To opt in to new defaults and get rid of these warnings now use `set_options(use_new_combine_kwarg_defaults=True) or set compat explicitly.
ds = xr.merge(store)
[10]:
<xarray.Dataset> Size: 23MB
Dimensions: (latitude: 1201, longitude: 2400)
Coordinates:
* latitude (latitude) float64 10kB -90.0 -89.85 ... 89.85 90.0
* longitude (longitude) float64 19kB -180.0 -179.8 ... 179.7 179.8
time datetime64[ns] 8B 2026-04-16T12:00:00
step timedelta64[ns] 8B 00:00:00
isobaricInhPa float64 8B 500.0
valid_time datetime64[ns] 8B 2026-04-16T12:00:00
gribfile_projection object 8B None
Data variables:
gh (latitude, longitude) float32 12MB ...
r (latitude, longitude) float32 12MB ...
Attributes:
GRIB_edition: 2
GRIB_centre: cwao
GRIB_centreDescription: Canadian Meteorological Service - Montreal
GRIB_subCentre: 0
Conventions: CF-1.7
institution: Canadian Meteorological Service - Montreal
model: gdps
product: 15km/grib2/lat_lon
description: Canada's Global Deterministic Prediction System ...
remote_grib: /home/meteo/kps5442/data/gdps/20260416/CMC_glb_H...
local_grib: /home/meteo/kps5442/data/gdps/20260416/CMC_glb_H...
search: None[14]:
ax = (
EasyMap("50m", crs=ds.herbie.crs, figsize=8, linewidth=1)
.BORDERS()
.STATES(alpha=0.5)
.ax
)
# Draw Relative Humidity
p = ax.pcolormesh(
ds.longitude, ds.latitude, ds.r, transform=pc, cmap="BrBG", vmin=0, vmax=100
)
plt.colorbar(
p,
ax=ax,
orientation="horizontal",
pad=0.01,
shrink=0.8,
label="Relative Humidity (%)",
)
# Draw Geopential Height Contours
ax.contour(
ds.longitude,
ds.latitude,
ds.gh,
colors="k",
transform=pc,
levels=range(0, 6000, 80),
)
ax.set_title(
f"500 hPa RH and Geopotential height\nValid {ds.valid_time.dt.strftime('%Y-%m-%d %H:%M').item()} UTC",
loc="center",
fontsize=10,
)
ax.set_title(f"{ds.model.upper()}", loc="left")
[14]:
Text(0.0, 1.0, 'GDPS')
[ ]: