{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"id": "bd37e360-d885-4ea8-9623-c72813a68d27",
"metadata": {},
"source": [
"# RDPS 🅱\n",
"\n",
"\n",
"\n",
"BETA\n",
"Requires MetPy >=1.6\n",
"\n",
"This demonstrates using data from Canada's GEM Regional or Regional Deterministic Prediction System (RDPS).\n",
"\n",
"[RDPS Model Description](https://eccc-msc.github.io/open-data/msc-data/nwp_rdps/readme_rdps-datamart_en/#data-location)\n",
"\n",
"\n",
"**Data Sources**\n",
"\n",
"|`prioriy=`|Data source| Archive Duration|\n",
"|--|--|--|\n",
"|`\"mcs\"` | [Meteorological Service of Canada](https://dd.weather.gc.ca/model_gem_regional/) | Last 24 hours\n",
"\n",
"**Model Initialization**\n",
"\n",
"Model cyles every six hours.\n",
"\n",
"**Forecast Hour**\n",
"\n",
"For the most recent version of RDPS...\n",
"\n",
"|`fxx=`|Forecast lead time|\n",
"|--|--|\n",
"|`0` through `84`, step=1| hourly forecasts available\n",
"\n",
"\n",
"**Products**\n",
"\n",
"|`product=`| Product Description | \n",
"|--|--|\n",
"|`\"10km/grib2\"`| Regional domain\n",
"\n",
"**Variable and Level**\n",
"\n",
"You will need to specify the variable and level for each request. \n",
"\n",
"
\n",
"\n",
"\n",
"> **NOTE:** The organization of these files is different than other NWP products.\n",
">\n",
"> 1. There are no index files provided.\n",
"> 1. Each GRIB2 file only contains one message. The variable name and level is in the file's name.\n",
">\n",
"> Herbie requires you provide a keyword argument for both `variable` and `level`. Pay special attention to model description (linked above) to understand how the model data is organized. If you don't provide input for `variable` or `level`, Herbie will give you some ideas. For example, `variable=TMP` and `level=TGL_2` will give you the filename that contains\n",
">\n",
"> ```\n",
"> TMP_TGL_2\n",
"> ```\n",
"\n",
"> **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](https://github.com/Unidata/MetPy/pull/3123)).\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "c04a6a84-7862-4d19-8460-ba50b5577ac8",
"metadata": {},
"outputs": [],
"source": [
"from herbie import Herbie\n",
"import xarray as xr\n",
"import numpy as np\n",
"\n",
"import matplotlib.pyplot as plt\n",
"from herbie.toolbox import EasyMap, pc\n",
"import cartopy.crs as ccrs\n",
"import cartopy.feature as feature\n",
"import pandas as pd\n",
"\n",
"recent = pd.Timestamp(\"now\").floor(\"12h\") - pd.Timedelta(\"12h\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "2a6c7cc7",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"✅ Found ┊ model=rdps ┊ \u001b[3mproduct=10km/grib2\u001b[0m ┊ \u001b[38;2;41;130;13m2026-Apr-16 12:00 UTC\u001b[92m F03\u001b[0m ┊ \u001b[38;2;255;153;0m\u001b[3mGRIB2 @ local\u001b[0m ┊ \u001b[38;2;255;153;0m\u001b[3mIDX @ None\u001b[0m\n"
]
},
{
"data": {
"text/plain": [
"PosixPath('/home/meteo/kps5442/data/rdps/20260416/20260416T12Z_MSC_RDPS_AirTemp_AGL-2m_RLatLon0.09_PT003H.grib2')"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Some examples\n",
"\n",
"H = Herbie(\n",
" recent, # Datetime\n",
" model=\"rdps\",\n",
" fxx=3,\n",
" variable=\"AirTemp\",\n",
" level=\"AGL-2m\",\n",
")\n",
"H.grib"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "e03b7b67",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"✅ Found ┊ model=rdps ┊ \u001b[3mproduct=10km/grib2\u001b[0m ┊ \u001b[38;2;41;130;13m2026-Apr-16 12:00 UTC\u001b[92m F12\u001b[0m ┊ \u001b[38;2;255;153;0m\u001b[3mGRIB2 @ msc\u001b[0m ┊ \u001b[38;2;255;153;0m\u001b[3mIDX @ None\u001b[0m\n"
]
},
{
"data": {
"text/plain": [
"'https://dd.weather.gc.ca/20260416/WXO-DD/model_rdps/10km/12/012/20260416T12Z_MSC_RDPS_GeopotentialHeight_IsbL-0500_RLatLon0.09_PT012H.grib2'"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"H = Herbie(\n",
" recent, # Datetime\n",
" model=\"rdps\",\n",
" fxx=12,\n",
" variable=\"GeopotentialHeight\",\n",
" level=\"IsbL-0500\",\n",
")\n",
"H.grib"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "440cdb19",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['AbsoluteVorticity',\n",
" 'AirTemp',\n",
" 'Albedo',\n",
" 'CAPE',\n",
" 'CIN',\n",
" 'CloudWater',\n",
" 'DewPoint',\n",
" 'DewPointDepression',\n",
" 'DownwardLongwaveRadiationFlux-Accum',\n",
" 'DownwardShortwaveRadiationFlux-Accum',\n",
" 'GeopotentialHeight',\n",
" 'Humidex',\n",
" 'KIndex',\n",
" 'LandWaterProportion',\n",
" 'LatentHeatNetFlux',\n",
" 'LiftedIndex-MU-VT',\n",
" 'NetLongwaveRadiationFlux-Accum',\n",
" 'NetShortwaveRadiationFlux-Accum',\n",
" 'PlanetaryBoundaryLayerHeight',\n",
" 'PrecipType-Instant',\n",
" 'Pressure',\n",
" 'RadiativeTemp',\n",
" 'RelativeHumidity',\n",
" 'Runoff-Accum',\n",
" 'SWEATIndex',\n",
" 'SeaIceFraction',\n",
" 'SeaWaterTemp',\n",
" 'SensibleHeatNetFlux',\n",
" 'ShowalterIndex',\n",
" 'SkyTransparencyIndex',\n",
" 'SnowDensity',\n",
" 'SnowDepth',\n",
" 'SoilTemp',\n",
" 'SoilVolumetricWaterContent',\n",
" 'SpecificHumidity',\n",
" 'StormRelativeHelicity',\n",
" 'StormSeverityIndex',\n",
" 'Thickness',\n",
" 'TotalCloudCover',\n",
" 'TotalTotalsIndex',\n",
" 'UVIndex',\n",
" 'UVIndex-ClearSky',\n",
" 'UVIndex-ClearSky-Max24h',\n",
" 'UVIndex-Max24h',\n",
" 'UpwardLongwaveRadiationFlux',\n",
" 'UpwardShortwaveRadiationFlux',\n",
" 'VerticalVelocity',\n",
" 'VerticalWindShear',\n",
" 'WindChill',\n",
" 'WindDir',\n",
" 'WindGust',\n",
" 'WindGust-Max',\n",
" 'WindGust-Min',\n",
" 'WindSpeed',\n",
" 'WindU',\n",
" 'WindV']"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# View variable names\n",
"H.AVAILABLE_VARIABLES"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "357064a4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['AGL-10m',\n",
" 'AGL-120m',\n",
" 'AGL-2m',\n",
" 'AGL-40m',\n",
" 'AGL-80m',\n",
" 'DBS-0to10cm',\n",
" 'DBS-0to1cm',\n",
" 'EAtm',\n",
" 'EtaL-10000',\n",
" 'EtaL-6500',\n",
" 'IsbL-0001',\n",
" 'IsbL-0005',\n",
" 'IsbL-0010',\n",
" 'IsbL-0020',\n",
" 'IsbL-0030',\n",
" 'IsbL-0050',\n",
" 'IsbL-0100',\n",
" 'IsbL-0150',\n",
" 'IsbL-0175',\n",
" 'IsbL-0200',\n",
" 'IsbL-0225',\n",
" 'IsbL-0250',\n",
" 'IsbL-0275',\n",
" 'IsbL-0300',\n",
" 'IsbL-0350',\n",
" 'IsbL-0400',\n",
" 'IsbL-0450',\n",
" 'IsbL-0500',\n",
" 'IsbL-0550',\n",
" 'IsbL-0600',\n",
" 'IsbL-0650',\n",
" 'IsbL-0700',\n",
" 'IsbL-0750',\n",
" 'IsbL-0800',\n",
" 'IsbL-0850',\n",
" 'IsbL-0850to0700',\n",
" 'IsbL-0875',\n",
" 'IsbL-0900',\n",
" 'IsbL-0925',\n",
" 'IsbL-0950',\n",
" 'IsbL-0970',\n",
" 'IsbL-0985',\n",
" 'IsbL-1000',\n",
" 'IsbL-1000to0500',\n",
" 'IsbL-1000to0850',\n",
" 'IsbL-1015',\n",
" 'MSL',\n",
" 'NTAtm',\n",
" 'PVU-1',\n",
" 'PVU-1.5',\n",
" 'PVU-2',\n",
" 'Sfc',\n",
" 'TGL-10',\n",
" 'TGL-120',\n",
" 'TGL-2',\n",
" 'TGL-40',\n",
" 'TGL-80']"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# View level names\n",
"H.AVAILABLE_LEVELS"
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "4fab3cd3",
"metadata": {},
"source": [
"## Get the 2-metre temperature\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "ac4fc277-c878-42a0-843f-ffb60b21661f",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"✅ Found ┊ model=rdps ┊ \u001b[3mproduct=10km/grib2\u001b[0m ┊ \u001b[38;2;41;130;13m2026-Apr-16 12:00 UTC\u001b[92m F03\u001b[0m ┊ \u001b[38;2;255;153;0m\u001b[3mGRIB2 @ local\u001b[0m ┊ \u001b[38;2;255;153;0m\u001b[3mIDX @ None\u001b[0m\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/kps5442/mapwall_dev/herbie-dev/src/herbie/core.py:1301: UserWarning: Will not remove GRIB file because it previously existed.\n",
" warnings.warn(\"Will not remove GRIB file because it previously existed.\")\n"
]
},
{
"data": {
"text/html": [
"
<xarray.Dataset> Size: 24MB\n",
"Dimensions: (y: 1045, x: 1140)\n",
"Coordinates:\n",
" latitude (y, x) float64 10MB ...\n",
" longitude (y, x) float64 10MB ...\n",
" time datetime64[ns] 8B 2026-04-16T12:00:00\n",
" step timedelta64[ns] 8B 03:00:00\n",
" heightAboveGround float64 8B 2.0\n",
" valid_time datetime64[ns] 8B ...\n",
" gribfile_projection object 8B None\n",
"Dimensions without coordinates: y, x\n",
"Data variables:\n",
" t2m (y, x) float32 5MB ...\n",
"Attributes:\n",
" GRIB_edition: 2\n",
" GRIB_centre: cwao\n",
" GRIB_centreDescription: Canadian Meteorological Service - Montreal\n",
" GRIB_subCentre: 0\n",
" Conventions: CF-1.7\n",
" institution: Canadian Meteorological Service - Montreal\n",
" model: rdps\n",
" product: 10km/grib2\n",
" description: Canada's Regional Deterministic Prediction Syste...\n",
" remote_grib: /home/meteo/kps5442/data/rdps/20260416/20260416T...\n",
" local_grib: /home/meteo/kps5442/data/rdps/20260416/20260416T...\n",
" search: None<xarray.Dataset> Size: 29MB\n",
"Dimensions: (y: 1045, x: 1140)\n",
"Coordinates:\n",
" latitude (y, x) float64 10MB -3.772 -3.731 -3.69 ... 50.1 50.04\n",
" longitude (y, x) float64 10MB -124.6 -124.6 ... 32.11 32.11\n",
" time datetime64[ns] 8B 2026-04-16T12:00:00\n",
" step timedelta64[ns] 8B 03:00:00\n",
" heightAboveGround float64 8B 10.0\n",
" valid_time datetime64[ns] 8B 2026-04-16T15:00:00\n",
" gribfile_projection object 8B None\n",
"Dimensions without coordinates: y, x\n",
"Data variables:\n",
" u10 (y, x) float32 5MB ...\n",
" v10 (y, x) float32 5MB ...\n",
"Attributes:\n",
" GRIB_edition: 2\n",
" GRIB_centre: cwao\n",
" GRIB_centreDescription: Canadian Meteorological Service - Montreal\n",
" GRIB_subCentre: 0\n",
" Conventions: CF-1.7\n",
" institution: Canadian Meteorological Service - Montreal\n",
" model: rdps\n",
" product: 10km/grib2\n",
" description: Canada's Regional Deterministic Prediction Syste...\n",
" remote_grib: /home/meteo/kps5442/data/rdps/20260416/20260416T...\n",
" local_grib: /home/meteo/kps5442/data/rdps/20260416/20260416T...\n",
" search: None<cartopy.crs.RotatedPole object at 0x73a5b4b84f50>" ], "text/plain": [ "
<xarray.Dataset> Size: 29MB\n",
"Dimensions: (y: 1045, x: 1140)\n",
"Coordinates:\n",
" latitude (y, x) float64 10MB -3.772 -3.731 -3.69 ... 50.1 50.04\n",
" longitude (y, x) float64 10MB -124.6 -124.6 ... 32.11 32.11\n",
" time datetime64[ns] 8B 2026-04-16T12:00:00\n",
" step timedelta64[ns] 8B 03:00:00\n",
" isobaricInhPa float64 8B 500.0\n",
" valid_time datetime64[ns] 8B 2026-04-16T15:00:00\n",
" gribfile_projection object 8B None\n",
"Dimensions without coordinates: y, x\n",
"Data variables:\n",
" gh (y, x) float32 5MB ...\n",
" r (y, x) float32 5MB ...\n",
"Attributes:\n",
" GRIB_edition: 2\n",
" GRIB_centre: cwao\n",
" GRIB_centreDescription: Canadian Meteorological Service - Montreal\n",
" GRIB_subCentre: 0\n",
" Conventions: CF-1.7\n",
" institution: Canadian Meteorological Service - Montreal\n",
" model: rdps\n",
" product: 10km/grib2\n",
" description: Canada's Regional Deterministic Prediction Syste...\n",
" remote_grib: /home/meteo/kps5442/data/rdps/20260416/20260416T...\n",
" local_grib: /home/meteo/kps5442/data/rdps/20260416/20260416T...\n",
" search: None