Download this notebook: 01_elbow_precipitation_analysis.ipynb
01 - Precipitation Reanalysis#
Learning goals of this module#
Learn how to do a basic analysis, comparing observed precipitation with reanalysis precipitation from RDPA and HRDPA
Learn how to run a simple example to access and compare observed and reanalysis precipitation.
Learn how to calculate and visualize simple error metrics
Assumptions#
We assume you are familiar with the concept of a reanalysis product.
Reference to reanalysis products#
Run imports and set-up logging#
[38]:
%load_ext autoreload
%autoreload 2
import logging
import sys
import warnings
from pathlib import Path
from dotenv import load_dotenv
from veriflow import run_pipeline
from veriflow.constants import VERSION
# Append project root (parent of notebook folder) to path
sys.path.append(str(Path("..").resolve()))
from tree_plots import (
reanalysis_timeseries_plot,
)
load_dotenv(dotenv_path="tutorial.env", override=True)
base_config = Path("config")
base_config.exists()
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s - %(levelname)s - %(message)s",
handlers=[logging.StreamHandler()],
)
logging.info(f"Running Veriflow version {VERSION}")
2026-11-04 14:59:54,137 - INFO - Running Veriflow version 0.4.1
The autoreload extension is already loaded. To reload it, use:
%reload_ext autoreload
Inspecting the veriflow pipeline configuration#
Open the config file in the βconfigβ directory. The name of the file is identical to the name of the notebook.
Inspect each of the sections to gain an understanding of what this configuration is about.
We are pulling from FEWS webservices (you will see this as downloads from urls)
Station Observations
RDPA Analysis at Stations
HRDPA Analysis at Stations
Running the veriflow pipeline#
[2]:
config_file = base_config / "01_elbow_precipitation_analysis.yaml"
dt = run_pipeline(config=(config_file, "yaml"))
2026-11-04 12:43:44,321 - INFO - Successfully initialized the configuration.
verification_period_start = 2026-05-15 00:00:00
verification_period_end = 2026-06-08 00:00:00
2026-11-04 12:43:45,590 - INFO - Starting dataset fetch (source_id=observed) from FewsWebservice.
2026-11-04 12:43:49,036 - INFO - Download successful from URL: https://veriflow-open.fews.deltares.nl/FewsWebServices/rest/fewspiservice/v1/timeseries?locationIds=3031092&locationIds=3050778&locationIds=MSC-005&locationIds=05BL813&locationIds=05BJ804&locationIds=05BL809&locationIds=FIRES-B4&locationIds=05BJ805&locationIds=05BL812&locationIds=FIRES-B5&locationIds=05BJ806&locationIds=05BH803&locationIds=05BF825&locationIds=05BH802&locationIds=05BL810&locationIds=05BF827¶meterIds=PC.obs&moduleInstanceIds=ImportMeteoStations&startTime=2026-05-15T00%3A00%3A00Z&endTime=2026-06-08T00%3A00%3A00Z&timeSeriesType=EXTERNAL_HISTORICAL&documentFormat=PI_NETCDF&omitEmptyTimeSeries=True
2026-11-04 12:43:49,087 - INFO - Starting dataset fetch (source_id=observed) from FewsNetCDF.
2026-11-04 12:44:23,521 - INFO - Dataset (source_id=observed) successfully loaded and validated.
2026-11-04 12:44:23,574 - INFO - Starting dataset fetch (source_id=simulated_RDPA) from FewsWebservice.
2026-11-04 12:44:24,798 - INFO - Download successful from URL: https://veriflow-open.fews.deltares.nl/FewsWebServices/rest/fewspiservice/v1/timeseries?locationIds=3031092&locationIds=3050778&locationIds=MSC-005&locationIds=05BL813&locationIds=05BJ804&locationIds=05BL809&locationIds=FIRES-B4&locationIds=05BJ805&locationIds=05BL812&locationIds=FIRES-B5&locationIds=05BJ806&locationIds=05BH803&locationIds=05BF825&locationIds=05BH802&locationIds=05BL810&locationIds=05BF827¶meterIds=PC.sim&moduleInstanceIds=PreprocessRDPA&startTime=2026-05-15T00%3A00%3A00Z&endTime=2026-06-08T00%3A00%3A00Z&timeSeriesType=EXTERNAL_HISTORICAL&documentFormat=PI_NETCDF&omitEmptyTimeSeries=True
2026-11-04 12:44:24,837 - INFO - Starting dataset fetch (source_id=simulated_RDPA) from FewsNetCDF.
2026-11-04 12:44:30,889 - INFO - Dataset (source_id=simulated_RDPA) successfully loaded and validated.
2026-11-04 12:44:30,890 - INFO - Starting dataset fetch (source_id=simulated_HRDPA) from FewsWebservice.
2026-11-04 12:44:31,381 - INFO - Download successful from URL: https://veriflow-open.fews.deltares.nl/FewsWebServices/rest/fewspiservice/v1/timeseries?locationIds=3031092&locationIds=3050778&locationIds=MSC-005&locationIds=05BL813&locationIds=05BJ804&locationIds=05BL809&locationIds=FIRES-B4&locationIds=05BJ805&locationIds=05BL812&locationIds=FIRES-B5&locationIds=05BJ806&locationIds=05BH803&locationIds=05BF825&locationIds=05BH802&locationIds=05BL810&locationIds=05BF827¶meterIds=PC.sim&moduleInstanceIds=PreprocessHRDPA&startTime=2026-05-15T00%3A00%3A00Z&endTime=2026-06-08T00%3A00%3A00Z&timeSeriesType=EXTERNAL_HISTORICAL&documentFormat=PI_NETCDF&omitEmptyTimeSeries=True
2026-11-04 12:44:31,385 - INFO - Starting dataset fetch (source_id=simulated_HRDPA) from FewsNetCDF.
2026-11-04 12:44:32,608 - INFO - Dataset (source_id=simulated_HRDPA) successfully loaded and validated.
2026-11-04 12:44:33,027 - INFO - Successfully loaded all data from sources.
2026-11-04 12:44:33,782 - INFO - Successfully computed ContinuousScores for verification pair PC_RDPA.
2026-11-04 12:44:33,814 - INFO - Successfully computed ContinuousScores for verification pair PC_HRDPA.
2026-11-04 12:44:33,815 - INFO - Verification pipeline completed successfully.
[3]:
dt
[3]:
<xarray.DataTree 'veriflow-datatree'>
Group: /
βββ Group: /input_data
β βββ Group: /input_data/observed
β β Dimensions: (station: 16, time: 25)
β β Coordinates:
β β * station (station) <U8 512B '3031092' '3050778' ... '05BL810' '05BF827'
β β station_name (station) |S255 4kB b'Calgary International' ... b'Priddis'
β β lat (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
β β lon (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
β β y (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
β β x (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
β β z (station) float64 128B 1.099e+03 1.321e+03 nan ... nan nan nan
β β * time (time) datetime64[ns] 200B 2026-05-15 ... 2026-06-08
β β Data variables:
β β PC (station, time) float32 2kB 0.0 2.3 0.2 0.2 ... 0.0 0.0 4.4
β β Attributes: (12/14)
β β originalParameterId: PC.obs
β β Conventions: CF-1.6
β β coordinate_system: WGS 1984
β β featureType: timeSeries
β β time_coverage_start: 2026-05-15T00:00:00+0000
β β time_coverage_end: 2026-06-08T00:00:00+0000
β β ... ...
β β geospatial_lat_min: 50.4859
β β geospatial_lat_max: 51.1226
β β data_type: observed_historical
β β source_id: observed
β β spatial_type: point
β β crs: EPSG:4326
β βββ Group: /input_data/simulated_RDPA
β β Dimensions: (station: 16, time: 25)
β β Coordinates:
β β * station (station) <U8 512B '3031092' '3050778' ... '05BL810' '05BF827'
β β station_name (station) |S255 4kB b'Calgary International' ... b'Priddis'
β β lat (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
β β lon (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
β β y (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
β β x (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
β β z (station) float64 128B 1.099e+03 1.321e+03 nan ... nan nan nan
β β * time (time) datetime64[ns] 200B 2026-05-15 ... 2026-06-08
β β Data variables:
β β PC (station, time) float32 2kB 0.0151 0.0036 ... 0.0849 1.065
β β Attributes: (12/14)
β β originalParameterId: PC.sim
β β Conventions: CF-1.6
β β coordinate_system: WGS 1984
β β featureType: timeSeries
β β time_coverage_start: 2026-05-15T00:00:00+0000
β β time_coverage_end: 2026-06-08T00:00:00+0000
β β ... ...
β β geospatial_lat_min: 50.4859
β β geospatial_lat_max: 51.1226
β β data_type: observed_historical
β β source_id: simulated_RDPA
β β spatial_type: point
β β crs: EPSG:4326
β βββ Group: /input_data/simulated_HRDPA
β Dimensions: (station: 16, time: 25)
β Coordinates:
β * station (station) <U8 512B '3031092' '3050778' ... '05BL810' '05BF827'
β station_name (station) |S255 4kB b'Calgary International' ... b'Priddis'
β lat (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
β lon (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
β y (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
β x (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
β z (station) float64 128B 1.099e+03 1.321e+03 nan ... nan nan nan
β * time (time) datetime64[ns] 200B 2026-05-15 ... 2026-06-08
β Data variables:
β PC (station, time) float32 2kB 0.0115 0.0038 ... 0.042 1.924
β Attributes: (12/14)
β originalParameterId: PC.sim
β Conventions: CF-1.6
β coordinate_system: WGS 1984
β featureType: timeSeries
β time_coverage_start: 2026-05-15T00:00:00+0000
β time_coverage_end: 2026-06-08T00:00:00+0000
β ... ...
β geospatial_lat_min: 50.4859
β geospatial_lat_max: 51.1226
β data_type: observed_historical
β source_id: simulated_HRDPA
β spatial_type: point
β crs: EPSG:4326
βββ Group: /PC_RDPA
β βββ Group: /PC_RDPA/aligned_input
β β βββ Group: /PC_RDPA/aligned_input/observations
β β β Dimensions: (station: 16, time: 25)
β β β Coordinates:
β β β * station (station) <U8 512B '3031092' '3050778' ... '05BL810' '05BF827'
β β β station_name (station) |S255 4kB b'Calgary International' ... b'Priddis'
β β β lat (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
β β β lon (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
β β β y (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
β β β x (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
β β β z (station) float64 128B 1.099e+03 1.321e+03 nan ... nan nan nan
β β β * time (time) datetime64[ns] 200B 2026-05-15 ... 2026-06-08
β β β Data variables:
β β β PC (station, time) float32 2kB 0.0 2.3 0.2 0.2 ... 0.0 0.0 4.4
β β βββ Group: /PC_RDPA/aligned_input/simulations
β β Dimensions: (station: 16, time: 25)
β β Coordinates:
β β * station (station) <U8 512B '3031092' '3050778' ... '05BL810' '05BF827'
β β station_name (station) |S255 4kB b'Calgary International' ... b'Priddis'
β β lat (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
β β lon (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
β β y (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
β β x (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
β β z (station) float64 128B 1.099e+03 1.321e+03 nan ... nan nan nan
β β * time (time) datetime64[ns] 200B 2026-05-15 ... 2026-06-08
β β Data variables:
β β PC (station, time) float32 2kB 0.0151 0.0036 ... 0.0849 1.065
β βββ Group: /PC_RDPA/output
β βββ Group: /PC_RDPA/output/continuous_scores
β Dimensions: (station: 16, time: 25)
β Coordinates:
β * station (station) <U8 512B '3031092' '3050778' ... '05BL810' '05BF827'
β station_name (station) |S255 4kB b'Calgary International' ... b'Priddis'
β lat (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
β lon (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
β y (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
β x (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
β z (station) float64 128B 1.099e+03 1.321e+03 nan ... nan nan nan
β * time (time) datetime64[ns] 200B 2026-05-15 ... 2026-06-08
β Data variables:
β mean_error (station, time) float32 2kB 0.0151 -2.296 ... 0.0849 -3.335
β mae (station, time) float32 2kB 0.0151 2.296 ... 0.0849 3.335
β rmse (station, time) float32 2kB 0.0151 2.296 ... 0.0849 3.335
β Attributes:
β units: mm
β data_type: observed_historical
β spatial_type: point
β crs: EPSG:4326
βββ Group: /PC_HRDPA
βββ Group: /PC_HRDPA/aligned_input
β βββ Group: /PC_HRDPA/aligned_input/observations
β β Dimensions: (station: 16, time: 25)
β β Coordinates:
β β * station (station) <U8 512B '3031092' '3050778' ... '05BL810' '05BF827'
β β station_name (station) |S255 4kB b'Calgary International' ... b'Priddis'
β β lat (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
β β lon (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
β β y (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
β β x (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
β β z (station) float64 128B 1.099e+03 1.321e+03 nan ... nan nan nan
β β * time (time) datetime64[ns] 200B 2026-05-15 ... 2026-06-08
β β Data variables:
β β PC (station, time) float32 2kB 0.0 2.3 0.2 0.2 ... 0.0 0.0 4.4
β βββ Group: /PC_HRDPA/aligned_input/simulations
β Dimensions: (station: 16, time: 25)
β Coordinates:
β * station (station) <U8 512B '3031092' '3050778' ... '05BL810' '05BF827'
β station_name (station) |S255 4kB b'Calgary International' ... b'Priddis'
β lat (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
β lon (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
β y (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
β x (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
β z (station) float64 128B 1.099e+03 1.321e+03 nan ... nan nan nan
β * time (time) datetime64[ns] 200B 2026-05-15 ... 2026-06-08
β Data variables:
β PC (station, time) float32 2kB 0.0115 0.0038 ... 0.042 1.924
βββ Group: /PC_HRDPA/output
βββ Group: /PC_HRDPA/output/continuous_scores
Dimensions: (station: 16, time: 25)
Coordinates:
* station (station) <U8 512B '3031092' '3050778' ... '05BL810' '05BF827'
station_name (station) |S255 4kB b'Calgary International' ... b'Priddis'
lat (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
lon (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
y (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
x (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
z (station) float64 128B 1.099e+03 1.321e+03 nan ... nan nan nan
* time (time) datetime64[ns] 200B 2026-05-15 ... 2026-06-08
Data variables:
mean_error (station, time) float32 2kB 0.0115 -2.296 ... 0.042 -2.476
mae (station, time) float32 2kB 0.0115 2.296 8.947 ... 0.042 2.476
rmse (station, time) float32 2kB 0.0115 2.296 8.947 ... 0.042 2.476
Attributes:
units: mm
data_type: observed_historical
spatial_type: point
crs: EPSG:4326Evaluating the results in the veriflow output DataTree#
A good starting point for βeyeballβ verification is simple: just looking at your observations and re-analysis in a visual way. Use the interactive elements in the plots below to zoom, pan and compare the results of our 2 re-analysis products.
1 - Check out the stations in the DataTree#
[36]:
# Get the aligned input for the first verification pair
dt.veriflow.get_aligned_input(dt.veriflow.verification_pairs[0])
[36]:
<xarray.DataTree 'aligned_input'>
Group: /PC_RDPA/aligned_input
βββ Group: /PC_RDPA/aligned_input/observations
β Dimensions: (station: 16, time: 25)
β Coordinates:
β * station (station) <U8 512B '3031092' '3050778' ... '05BL810' '05BF827'
β station_name (station) |S255 4kB b'Calgary International' ... b'Priddis'
β lat (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
β lon (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
β y (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
β x (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
β z (station) float64 128B 1.099e+03 1.321e+03 nan ... nan nan nan
β * time (time) datetime64[ns] 200B 2026-05-15 ... 2026-06-08
β Data variables:
β PC (station, time) float32 2kB 0.0 2.3 0.2 0.2 ... 0.0 0.0 4.4
βββ Group: /PC_RDPA/aligned_input/simulations
Dimensions: (station: 16, time: 25)
Coordinates:
* station (station) <U8 512B '3031092' '3050778' ... '05BL810' '05BF827'
station_name (station) |S255 4kB b'Calgary International' ... b'Priddis'
lat (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
lon (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
y (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
x (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
z (station) float64 128B 1.099e+03 1.321e+03 nan ... nan nan nan
* time (time) datetime64[ns] 200B 2026-05-15 ... 2026-06-08
Data variables:
PC (station, time) float32 2kB 0.0151 0.0036 ... 0.0849 1.065[24]:
# Alternatively, you can access the same data aligned input directly from the datatree
dt["PC_RDPA/aligned_input"]
[24]:
<xarray.DataTree 'aligned_input'>
Group: /PC_RDPA/aligned_input
βββ Group: /PC_RDPA/aligned_input/observations
β Dimensions: (station: 16, time: 25)
β Coordinates:
β * station (station) <U8 512B '3031092' '3050778' ... '05BL810' '05BF827'
β station_name (station) |S255 4kB b'Calgary International' ... b'Priddis'
β lat (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
β lon (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
β y (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
β x (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
β z (station) float64 128B 1.099e+03 1.321e+03 nan ... nan nan nan
β * time (time) datetime64[ns] 200B 2026-05-15 ... 2026-06-08
β Data variables:
β PC (station, time) float32 2kB 0.0 2.3 0.2 0.2 ... 0.0 0.0 4.4
βββ Group: /PC_RDPA/aligned_input/simulations
Dimensions: (station: 16, time: 25)
Coordinates:
* station (station) <U8 512B '3031092' '3050778' ... '05BL810' '05BF827'
station_name (station) |S255 4kB b'Calgary International' ... b'Priddis'
lat (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
lon (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
y (station) float64 128B 51.12 51.08 51.08 ... 51.04 50.65 50.87
x (station) float64 128B -114.0 -115.1 -115.1 ... -114.6 -114.3
z (station) float64 128B 1.099e+03 1.321e+03 nan ... nan nan nan
* time (time) datetime64[ns] 200B 2026-05-15 ... 2026-06-08
Data variables:
PC (station, time) float32 2kB 0.0151 0.0036 ... 0.0849 1.065[33]:
# List the stations
ds = dt.veriflow.get_aligned_input(dt.veriflow.verification_pairs[0])["observations"].to_dataset()
stations = ds.coords["station"].values
print(f"Stations: {stations}")
Stations: ['3031092' '3050778' 'MSC-005' '05BL813' '05BJ804' '05BL809' 'FIRES-B4'
'05BJ805' '05BL812' 'FIRES-B5' '05BJ806' '05BH803' '05BF825' '05BH802'
'05BL810' '05BF827']
2 - Visualize the precipitation (per station)#
[34]:
reanalysis_timeseries_plot(dt, station=stations[5])
3 - Visualize the precipitation (per station) and add the absolute error to the plot as well#
[35]:
reanalysis_timeseries_plot(dt, station=stations[4], error_var="mae", error_score_name="continuous_scores")