Hazard assessment for river flooding using river discharge statistics#

Accessing data#

This notebook illustrates how the river discharges dataset can be downloaded via API from the Copernicus Data Store for subsequent use in the analysis. The dataset is downloaded for the entire Europe, it is not possible to subset it by area prior to downloading.

Note: alternatively it is possible to access this dataset via the dataset mirror on the CLIMAAX data server, this option is made available to speed up data access.

Load libraries#

import os
from glob import glob
import cdsapi
import zipfile
import xarray as xr

Create the directory structure#

In the next cell will create the directory called ‘FLOOD_RIVER_discharges’ in the same directory where this notebook is saved. A folder for storing data will be made as well.

# Define the folder for the flood workflow
workflow_folder = 'FLOOD_RIVER_discharges'
os.makedirs(workflow_folder, exist_ok=True)

data_folder = os.path.join(workflow_folder, 'data')
os.makedirs(data_folder, exist_ok=True)

data_folder_catch = os.path.join(data_folder, 'EHYPEcatch')
os.makedirs(data_folder_catch, exist_ok=True)

Data access parameters#

In the cell below we will select three GCM-RCM model combinations (see dataset documentation for the available combinations). Using several model combinations helps to assess the uncertainty range due to the different climate models in the river discharges data.

gcms = ["ec_earth","hadgem2_es","mpi_esm_lr","ec_earth","mpi_esm_lr","hadgem2_es"]
rcms = ["cclm4_8_17","racmo22e","rca4","racmo22e","csc_remo2009","rca4"]
ens_members = ['r12i1p1','r1i1p1','r1i1p1','r12i1p1','r1i1p1','r1i1p1']

We also need to initialize the API client to be able to make connection to the CDS servers for downloading the data.

client = cdsapi.Client()
2025-08-26 14:01:25,049 INFO [2024-09-26T00:00:00] Watch our [Forum](https://forum.ecmwf.int/) for Announcements, news and other discussed topics.

Downloading river discharge timeseries - historical daily values#

First we will download catchment-level discharge data for the historical period. Data is available based on different E-HYPEcatch model realizations. We will download all model realizations.

The daily timeseries are downloaded for the period of 2000-2005. If a different period is required for comparing to local observations, the selection can be adjusted below as part of the API request under “period”.

for ii, rcm in enumerate(rcms):
    gcm = gcms[ii]
    ens_member = ens_members[ii]
    file = os.path.join(data_folder_catch, 'download.zip')
    dataset = "sis-hydrology-variables-derived-projections"
    request = {
        "product_type": "essential_climate_variables",
        "variable": ["river_discharge"],
        "variable_type": "absolute_values",
        "time_aggregation": "daily",
        "experiment": ["historical"],
        "hydrological_model":   ["e_hypecatch_m00",
                                "e_hypecatch_m01",
                                "e_hypecatch_m02",
                                "e_hypecatch_m03",
                                "e_hypecatch_m04",
                                "e_hypecatch_m05",
                                "e_hypecatch_m06",
                                "e_hypecatch_m07"],
        "rcm": rcm,
        "gcm": gcm,
        "ensemble_member": ens_member,
        "period": ["2001_2005"]
    }
    client.retrieve(dataset, request, file)

    # Unzip the file that was just downloaded, and remove the zip file
    with zipfile.ZipFile(file, 'r') as zObject:
        zObject.extractall(path=data_folder_catch)
    os.remove(file)
2025-08-26 12:09:41,698 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 12:09:41,699 INFO Request ID is 6eb3308a-75c8-47cc-b47e-7875b48e6946
2025-08-26 12:09:41,950 INFO status has been updated to accepted
2025-08-26 12:09:55,516 INFO status has been updated to running
2025-08-26 12:12:34,082 INFO status has been updated to successful
2025-08-26 12:14:39,214 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 12:14:39,215 INFO Request ID is 85e8c15e-0a90-4bec-88b4-a4a7de94f32c
2025-08-26 12:14:39,375 INFO status has been updated to accepted
2025-08-26 12:14:53,192 INFO status has been updated to running
2025-08-26 12:16:33,899 INFO status has been updated to successful
2025-08-26 12:19:01,787 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 12:19:01,788 INFO Request ID is 25eaa34a-0372-44f5-ad3e-f6c05a0eb912
2025-08-26 12:19:01,857 INFO status has been updated to accepted
2025-08-26 12:19:10,257 INFO status has been updated to running
2025-08-26 12:20:56,097 INFO status has been updated to successful
                                                                                          
def preprocess_daily(ds):
    filename = ds.encoding['source'].split("/")[-1].split("\\")[-1]
    ds['gcm_rcm'] = f'{filename.split("_")[3]}_{filename.split("_")[6]}'
    ds = ds.set_coords('gcm_rcm').expand_dims('gcm_rcm')

    ds['catchmodel'] = filename.split("_")[2]
    ds = ds.set_coords('catchmodel').expand_dims('catchmodel')    

    return ds
# CHECK
files = glob(os.path.join(data_folder_catch, 'rdis_day_E-HYPEcatch*-EUR-11_*_catch_v1.nc'))
ds_day = xr.open_mfdataset(files, preprocess=preprocess_daily)
ds_day
<xarray.Dataset> Size: 12GB
Dimensions:     (catchmodel: 8, gcm_rcm: 6, time: 1826, id: 34810)
Coordinates:
  * time        (time) datetime64[ns] 15kB 2001-01-01 2001-01-02 ... 2005-12-31
  * id          (id) int32 139kB 8801654 8000123 8212459 ... 9605711 9601936
  * gcm_rcm     (gcm_rcm) <U33 792B 'ICHEC-EC-EARTH_CLMcom-CCLM4-8-17' ... 'M...
  * catchmodel  (catchmodel) <U20 640B 'E-HYPEcatch00-EUR-11' ... 'E-HYPEcatc...
Data variables:
    rdis        (catchmodel, gcm_rcm, time, id) float32 12GB dask.array<chunksize=(1, 1, 1, 34810), meta=np.ndarray>
Attributes: (12/24)
    CDI:                      Climate Data Interface version 1.9.8 (https://m...
    history:                  Wed Mar 31 15:52:54 2021: cdo selyear,2001,2002...
    source:                   A set of EURO-CORDEX EUR-11 RCMS were bias adju...
    institution:              SMHI, www.smhi.se
    Conventions:              CF-1.6
    NCO:                      4.4.8
    ...                       ...
    invar_experiment_name:    rcp45
    invar_rcm_model_id:       CLMcom-CCLM4-8-17
    time_period:              2001-2010
    contact:                  copernicus-support@ecmwf.int
    data_quality:             C3S_424_SMHI uses state of the art, quality con...
    CDO:                      Climate Data Operators version 1.9.8 (https://m...
ds_day.to_netcdf(os.path.join(data_folder, 'rdis_day_E-HYPEcatch_allmodels.nc'))

Downloading river discharge timeseries - monthly means#

Next we will download the historical monthly means of river discharges for 1971-2000 from the E-HYPEcatch models which are useful for checking longer-term statistics of river discharges in the historical climate.

for ii, rcm in enumerate(rcms):
    gcm = gcms[ii]
    ens_member = ens_members[ii]
    file = os.path.join(data_folder_catch, 'download.zip')
    dataset = "sis-hydrology-variables-derived-projections"
    request = {
        "product_type": "climate_impact_indicators",
        "variable": ["river_discharge"],
        "variable_type": "absolute_values",
        "time_aggregation": "monthly_mean",
        "experiment": ["historical"],
        "hydrological_model":   ["e_hypecatch_m00",
                                "e_hypecatch_m01",
                                "e_hypecatch_m02",
                                "e_hypecatch_m03",
                                "e_hypecatch_m04",
                                "e_hypecatch_m05",
                                "e_hypecatch_m06",
                                "e_hypecatch_m07"],
        "rcm": rcm,
        "gcm": gcm,
        "ensemble_member": ens_member,
        "period": ["1971_2000"]
    }
    client.retrieve(dataset, request, file)

    # Unzip the file that was just downloaded, and remove the zip file
    with zipfile.ZipFile(file, 'r') as zObject:
        zObject.extractall(path=data_folder_catch)
    os.remove(file)
2025-08-26 12:46:57,766 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 12:46:57,767 INFO Request ID is dba97e38-1ed9-4011-9b50-9c11cf1ef5a6
2025-08-26 12:46:57,832 INFO status has been updated to accepted
2025-08-26 12:47:11,613 INFO status has been updated to running
2025-08-26 12:47:30,746 INFO status has been updated to successful
2025-08-26 12:47:31,853 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 12:47:31,854 INFO Request ID is 2ea9fec4-33eb-4d9e-b9b4-3fd23953e48f
2025-08-26 12:47:31,905 INFO status has been updated to accepted
2025-08-26 12:47:45,420 INFO status has been updated to running
2025-08-26 12:48:21,684 INFO status has been updated to successful
2025-08-26 12:48:22,892 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 12:48:22,892 INFO Request ID is 9aeb173f-07ff-4634-b15b-2d791188a5c8
2025-08-26 12:48:22,941 INFO status has been updated to accepted
2025-08-26 12:48:36,690 INFO status has been updated to running
2025-08-26 12:48:55,997 INFO status has been updated to successful
                                                                                          

We will download monthly means of discharges for future periods of 2011-2040, 2041-2070 and 2071-2100:

for ii, rcm in enumerate(rcms):
    gcm = gcms[ii]
    ens_member = ens_members[ii]

    for period in ["2011_2040","2041_2070","2071_2100"]:
        file = os.path.join(data_folder_catch, 'download.zip')
        dataset = "sis-hydrology-variables-derived-projections"
        request = {
            "product_type": "climate_impact_indicators",
            "variable": ["river_discharge"],
            "variable_type": "absolute_values",
            "time_aggregation": "monthly_mean",
            "experiment": ["rcp_4_5","rcp_8_5"],
            "hydrological_model":  ["e_hypecatch_m00",
                                    "e_hypecatch_m01",
                                    "e_hypecatch_m02",
                                    "e_hypecatch_m03",
                                    "e_hypecatch_m04",
                                    "e_hypecatch_m05",
                                    "e_hypecatch_m06",
                                    "e_hypecatch_m07"],
            "rcm": rcm,
            "gcm": gcm,
            "ensemble_member": ens_member,
            "period": period
        }
        client.retrieve(dataset, request, file)

        # Unzip the file that was just downloaded, and remove the zip file
        with zipfile.ZipFile(file, 'r') as zObject:
            zObject.extractall(path=data_folder_catch)
        os.remove(file)
2025-08-26 12:48:57,400 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 12:48:57,401 INFO Request ID is 8c769f25-edb6-452a-89ed-0eefd0beadc5
2025-08-26 12:48:57,474 INFO status has been updated to accepted
2025-08-26 12:49:05,875 INFO status has been updated to running
2025-08-26 12:49:18,658 INFO status has been updated to successful
2025-08-26 12:49:19,889 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 12:49:19,890 INFO Request ID is e8efcbca-a3b5-48de-b39d-23de3d652c97
2025-08-26 12:49:19,957 INFO status has been updated to accepted
2025-08-26 12:49:28,516 INFO status has been updated to running
2025-08-26 12:50:09,900 INFO status has been updated to successful
2025-08-26 12:50:11,221 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 12:50:11,222 INFO Request ID is 519b82c4-ec0a-452e-961c-cfb689761f9e
2025-08-26 12:50:11,272 INFO status has been updated to accepted
2025-08-26 12:50:19,906 INFO status has been updated to running
2025-08-26 12:51:01,313 INFO status has been updated to successful
2025-08-26 12:51:02,881 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 12:51:02,881 INFO Request ID is f84375ff-d3f0-42b7-bb5d-9c741ef81755
2025-08-26 12:51:02,942 INFO status has been updated to accepted
2025-08-26 12:51:16,987 INFO status has been updated to running
2025-08-26 12:51:36,088 INFO status has been updated to successful
2025-08-26 12:51:37,363 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 12:51:37,364 INFO Request ID is c7c2a99c-388e-40ca-9d54-c68209705620
2025-08-26 12:51:37,420 INFO status has been updated to accepted
2025-08-26 12:51:50,903 INFO status has been updated to running
2025-08-26 12:52:09,984 INFO status has been updated to successful
2025-08-26 12:52:11,254 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 12:52:11,255 INFO Request ID is bbc72e6c-7311-4722-b394-961a5703fe14
2025-08-26 12:52:11,320 INFO status has been updated to accepted
2025-08-26 12:52:25,650 INFO status has been updated to running
2025-08-26 12:52:44,751 INFO status has been updated to successful
2025-08-26 12:52:46,659 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 12:52:46,660 INFO Request ID is 1826c298-7a47-402a-b019-b174c9f40a17
2025-08-26 12:52:46,748 INFO status has been updated to accepted
2025-08-26 12:53:08,092 INFO status has been updated to running
2025-08-26 12:53:19,546 INFO status has been updated to successful
2025-08-26 12:53:20,694 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 12:53:20,695 INFO Request ID is c93f33bf-6470-4b7a-846c-96b4bbd7b530
2025-08-26 12:53:20,749 INFO status has been updated to accepted
2025-08-26 12:53:29,269 INFO status has been updated to running
2025-08-26 12:54:10,673 INFO status has been updated to successful
2025-08-26 12:54:12,041 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 12:54:12,042 INFO Request ID is 226a01f0-08ab-4c91-b654-9ca1900eb009
2025-08-26 12:54:12,576 INFO status has been updated to accepted
2025-08-26 12:54:26,153 INFO status has been updated to running
2025-08-26 12:55:03,028 INFO status has been updated to successful
                                                                                          

We will make use of a preprocessing function to write model names and scenarios to the dataset dimensions:

def preprocess_monthly_mean(ds):
    filename = ds.encoding['source'].split("/")[-1].split("\\")[-1]
    ds['gcm_rcm'] = f'{filename.split("_")[4]}_{filename.split("_")[7]}'
    ds = ds.set_coords('gcm_rcm').expand_dims('gcm_rcm')

    ds['catchmodel'] = filename.split("_")[3]
    ds = ds.set_coords('catchmodel').expand_dims('catchmodel')    

    ds['scenarios'] = filename.split("_")[5]
    ds = ds.set_coords('scenarios').expand_dims('scenarios')

    ds['time_period'] = filename.split("_")[9]
    ds = ds.set_coords('time_period').expand_dims('time_period')

    ds['time'] = ds.time.dt.month

    return ds

Now we can read the dataset of monthly means of river discharges into a single dataset variable and save it on disk as one file for ease of future access.

files = glob(os.path.join(data_folder_catch, 'rdis_ymonmean_abs_E-HYPEcatch*-EUR-11_*_na_*_catch_v1.nc'))
ds_monmean = xr.open_mfdataset(files, preprocess=preprocess_monthly_mean)
ds_monmean
<xarray.Dataset> Size: 963MB
Dimensions:        (time_period: 4, scenarios: 3, catchmodel: 8, gcm_rcm: 6,
                    time: 12, id: 34810)
Coordinates:
  * time           (time) int64 96B 1 2 3 4 5 6 7 8 9 10 11 12
  * id             (id) int32 139kB 8801654 8000123 8212459 ... 9605711 9601936
  * gcm_rcm        (gcm_rcm) <U36 864B 'ICHEC-EC-EARTH_CLMcom-CCLM4-8-17-v1' ...
  * catchmodel     (catchmodel) <U20 640B 'E-HYPEcatch00-EUR-11' ... 'E-HYPEc...
  * time_period    (time_period) <U9 144B '1971-2000' ... '2071-2100'
  * scenarios      (scenarios) <U10 120B 'historical' 'rcp45' 'rcp85'
Data variables:
    rdis_ymonmean  (time_period, scenarios, catchmodel, gcm_rcm, time, id) float32 962MB dask.array<chunksize=(2, 1, 1, 1, 1, 34810), meta=np.ndarray>
Attributes: (12/28)
    CDI:                      Climate Data Interface version 1.9.5 (http://mp...
    Conventions:              CF-1.6
    NCO:                      netCDF Operators version 4.7.7 (Homepage = http...
    comment:                  -
    CDO:                      Climate Data Operators version 1.9.5 (http://mp...
    history:                  CDO commands (last cdo command first and separa...
    ...                       ...
    invar_hm_model_id:        Hydrological models in the order of the variabl...
    invar_experiment_name:    rcp45
    time_coverage_start:      19710101
    time_coverage_end:        20001231
    variable_name:            rdis_ymonmean
    contact:                  copernicus-support@ecmwf.int
ds_monmean.to_netcdf(os.path.join(data_folder, 'rdis_ymonmean_abs_E-HYPEcatch_allmodels.nc'))

Downloading data on flood occurence (extreme river discharges)#

We will download river discharge data corresponding to the 10-year and 50-year return periods (extreme river discharges projected to be exceeded once in 10 years and once in 50 years). Similarly to the timeseries data, we will download this data for different climate scenarios, timelines and catchment models.

Downloading 10-year and 50-year return period river discharges for the historical climate:

for ii, rcm in enumerate(rcms):
    gcm = gcms[ii]
    ens_member = ens_members[ii]
    
    file = os.path.join(data_folder_catch, 'download.zip')
    dataset = "sis-hydrology-variables-derived-projections"
    request = {
        "product_type": "climate_impact_indicators",
        "variable": ["flood_recurrence_10_years_return_period",
                        "flood_recurrence_50_years_return_period"],
        "variable_type": "absolute_values",
        "time_aggregation": "annual_mean",
        "experiment": ["historical"],
        "hydrological_model": ["e_hypecatch_m00",
                                "e_hypecatch_m01",
                                "e_hypecatch_m02",
                                "e_hypecatch_m03",
                                "e_hypecatch_m04",
                                "e_hypecatch_m05",
                                "e_hypecatch_m06",
                                "e_hypecatch_m07"],
        "rcm": rcm,
        "gcm": gcm,
        "ensemble_member": ens_member,
        "period": ["1971_2000"]
    }   
    client.retrieve(dataset, request, file)

    # Unzip the file that was just downloaded, and remove the zip file
    with zipfile.ZipFile(file, 'r') as zObject:
        zObject.extractall(path=data_folder_catch)
    os.remove(file)
2025-08-26 12:55:04,376 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 12:55:04,377 INFO Request ID is bb6037ee-4b6e-42ac-9fce-16f138a9ccfb
2025-08-26 12:55:04,427 INFO status has been updated to accepted
2025-08-26 12:55:18,053 INFO status has been updated to running
2025-08-26 12:55:25,721 INFO status has been updated to successful
2025-08-26 12:55:27,006 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 12:55:27,007 INFO Request ID is 7c78b181-858c-4500-b60b-1828f94289f5
2025-08-26 12:55:27,399 INFO status has been updated to accepted
2025-08-26 12:55:41,051 INFO status has been updated to running
2025-08-26 12:56:00,134 INFO status has been updated to successful
2025-08-26 12:56:01,227 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 12:56:01,228 INFO Request ID is 1d5868a7-3928-4f6a-902e-81956292ab17
2025-08-26 12:56:01,458 INFO status has been updated to accepted
2025-08-26 12:56:22,655 INFO status has been updated to running
2025-08-26 12:56:34,133 INFO status has been updated to successful
                                                                                          

Downloading 10-year and 50-year return period river discharges for the future time periods in terms of absolute values:

for ii, rcm in enumerate(rcms):
    gcm = gcms[ii]
    ens_member = ens_members[ii]

    for period in ["2011_2040","2041_2070","2071_2100"]:
        file = os.path.join(data_folder_catch, 'download.zip')
        dataset = "sis-hydrology-variables-derived-projections"
        request = {
            "product_type": "climate_impact_indicators",
            "variable": ["flood_recurrence_10_years_return_period",
                         "flood_recurrence_50_years_return_period"],
            "variable_type": "absolute_values",
            "time_aggregation": "annual_mean",
            "experiment": ["rcp_4_5","rcp_8_5"],
            "hydrological_model":  [
                                    "e_hypecatch_m00",
                                    "e_hypecatch_m01",
                                    "e_hypecatch_m02",
                                    "e_hypecatch_m03",
                                    "e_hypecatch_m04",
                                    "e_hypecatch_m05",
                                    "e_hypecatch_m06",
                                    "e_hypecatch_m07"],
            "rcm": rcm,
            "gcm": gcm,
            "ensemble_member": ens_member,
            "period": period
        }   
        client.retrieve(dataset, request, file)

        # Unzip the file that was just downloaded, and remove the zip file
        with zipfile.ZipFile(file, 'r') as zObject:
            zObject.extractall(path=data_folder_catch)
        os.remove(file)
2025-08-26 12:56:35,320 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 12:56:35,322 INFO Request ID is c5e0ad37-f0cf-48b4-a4a4-7ed007f99479
2025-08-26 12:56:35,410 INFO status has been updated to accepted
2025-08-26 12:56:48,893 INFO status has been updated to running
2025-08-26 12:57:25,169 INFO status has been updated to successful
2025-08-26 12:57:26,539 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 12:57:26,539 INFO Request ID is e170ba06-f860-4a29-ba4f-589e771f1bcf
2025-08-26 12:57:26,602 INFO status has been updated to accepted
2025-08-26 12:57:48,083 INFO status has been updated to running
2025-08-26 12:58:16,862 INFO status has been updated to successful
2025-08-26 12:58:17,975 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 12:58:17,976 INFO Request ID is 088df8b6-6fcc-4f0c-930a-82f012af7229
2025-08-26 12:58:18,338 INFO status has been updated to accepted
2025-08-26 12:58:26,823 INFO status has been updated to running
2025-08-26 12:59:08,469 INFO status has been updated to successful
2025-08-26 12:59:09,931 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 12:59:09,932 INFO Request ID is 2a73a47d-e829-4d7c-ba9b-06163091f458
2025-08-26 12:59:10,420 INFO status has been updated to accepted
2025-08-26 12:59:31,576 INFO status has been updated to running
2025-08-26 13:00:00,155 INFO status has been updated to successful
2025-08-26 13:00:01,799 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 13:00:01,800 INFO Request ID is 5c82de03-3b58-405e-8bc5-5314fbc9b333
2025-08-26 13:00:01,876 INFO status has been updated to accepted
2025-08-26 13:00:15,660 INFO status has been updated to running
2025-08-26 13:00:34,776 INFO status has been updated to successful
2025-08-26 13:00:35,760 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 13:00:35,761 INFO Request ID is a0b3dca5-b6ed-4445-8b3a-e96797bfcb27
2025-08-26 13:00:35,805 INFO status has been updated to accepted
2025-08-26 13:00:51,702 INFO status has been updated to running
2025-08-26 13:01:10,857 INFO status has been updated to successful
2025-08-26 13:01:11,919 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 13:01:11,920 INFO Request ID is df53861a-b943-4d2c-b09c-2489a2b9d537
2025-08-26 13:01:11,964 INFO status has been updated to accepted
2025-08-26 13:01:20,406 INFO status has been updated to running
2025-08-26 13:01:25,521 INFO status has been updated to accepted
2025-08-26 13:01:33,577 INFO status has been updated to running
2025-08-26 13:01:45,028 INFO status has been updated to successful
2025-08-26 13:01:46,330 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 13:01:46,331 INFO Request ID is 645c3a6a-631b-4684-afc6-f4049eebeb02
2025-08-26 13:01:46,403 INFO status has been updated to accepted
2025-08-26 13:01:59,909 INFO status has been updated to running
2025-08-26 13:02:09,236 INFO status has been updated to successful
2025-08-26 13:02:10,192 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 13:02:10,193 INFO Request ID is 34acfcf9-ef16-40c6-b11d-22506d73174e
2025-08-26 13:02:10,249 INFO status has been updated to accepted
2025-08-26 13:02:24,237 INFO status has been updated to running
2025-08-26 13:02:43,561 INFO status has been updated to successful
                                                                                          

Downloading 50-year return period river discharges for the future time periods as relative values:

for ii, rcm in enumerate(rcms):
    gcm = gcms[ii]
    ens_member = ens_members[ii]

    for period in ["2011_2040","2041_2070","2071_2100"]:
        file = os.path.join(data_folder_catch, 'download.zip')
        dataset = "sis-hydrology-variables-derived-projections"
        request = {
            "product_type": "climate_impact_indicators",
            "variable": ["flood_recurrence_10_years_return_period",
                         "flood_recurrence_50_years_return_period"],
            "variable_type": "relative_change_from_reference_period",
            "time_aggregation": "annual_mean",
            "experiment": ["rcp_4_5","rcp_8_5"],
            "hydrological_model":  [
                                    "e_hypecatch_m00",
                                    "e_hypecatch_m01",
                                    "e_hypecatch_m02",
                                    "e_hypecatch_m03",
                                    "e_hypecatch_m04",
                                    "e_hypecatch_m05",
                                    "e_hypecatch_m06",
                                    "e_hypecatch_m07"],
            "rcm": rcm,
            "gcm": gcm,
            "ensemble_member": ens_member,
            "period": period
        }   
        client.retrieve(dataset, request, file)

        # Unzip the file that was just downloaded, and remove the zip file
        with zipfile.ZipFile(file, 'r') as zObject:
            zObject.extractall(path=data_folder_catch)
        os.remove(file)
2025-08-26 14:20:49,099 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 14:20:49,101 INFO Request ID is 7920ce7f-022a-417e-8b29-d13e5ef451b0
2025-08-26 14:20:49,179 INFO status has been updated to accepted
2025-08-26 14:20:57,630 INFO status has been updated to running
2025-08-26 14:21:10,403 INFO status has been updated to successful
2025-08-26 14:21:11,493 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 14:21:11,494 INFO Request ID is 83cf395f-ead5-458f-a6de-b54e397308bb
2025-08-26 14:21:11,594 INFO status has been updated to accepted
2025-08-26 14:21:32,806 INFO status has been updated to running
2025-08-26 14:22:01,453 INFO status has been updated to successful
2025-08-26 14:22:02,516 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 14:22:02,517 INFO Request ID is bc9ac87b-61a4-4877-b842-689e18890df7
2025-08-26 14:22:02,619 INFO status has been updated to accepted
2025-08-26 14:22:16,331 INFO status has been updated to running
2025-08-26 14:22:23,998 INFO status has been updated to accepted
2025-08-26 14:22:35,451 INFO status has been updated to running
2025-08-26 14:22:52,620 INFO status has been updated to successful
2025-08-26 14:22:53,610 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 14:22:53,611 INFO Request ID is 5bfe1f73-a849-40c2-8409-c0b8dba768b7
2025-08-26 14:22:53,679 INFO status has been updated to accepted
2025-08-26 14:23:02,170 INFO status has been updated to running
2025-08-26 14:23:14,948 INFO status has been updated to successful
2025-08-26 14:23:15,921 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 14:23:15,921 INFO Request ID is d9844ddf-f562-498d-84f7-eb79d38ff7a6
2025-08-26 14:23:16,034 INFO status has been updated to accepted
2025-08-26 14:23:29,881 INFO status has been updated to running
2025-08-26 14:23:37,530 INFO status has been updated to successful
2025-08-26 14:23:38,426 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 14:23:38,427 INFO Request ID is fc910c7d-b3d5-402d-a307-d6f595cea9e6
2025-08-26 14:23:38,618 INFO status has been updated to accepted
2025-08-26 14:23:47,068 INFO status has been updated to running
2025-08-26 14:24:11,509 INFO status has been updated to successful
2025-08-26 14:24:13,131 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 14:24:13,132 INFO Request ID is cf28d674-4e76-4df7-835c-f25b24c1aeeb
2025-08-26 14:24:13,232 INFO status has been updated to accepted
2025-08-26 14:24:26,703 INFO status has been updated to running
2025-08-26 14:24:45,869 INFO status has been updated to successful
2025-08-26 14:24:46,721 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 14:24:46,722 INFO Request ID is 5cf84af6-7a80-4c7b-a54f-0b0ab00db844
2025-08-26 14:24:46,806 INFO status has been updated to accepted
2025-08-26 14:24:55,194 INFO status has been updated to running
2025-08-26 14:25:07,993 INFO status has been updated to successful
2025-08-26 14:25:08,899 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 14:25:08,899 INFO Request ID is 7c4cbbf9-51e6-4c87-b5a9-d7a7a6ddacb1
2025-08-26 14:25:08,979 INFO status has been updated to accepted
2025-08-26 14:25:17,469 INFO status has been updated to running
2025-08-26 14:25:30,391 INFO status has been updated to successful
2025-08-26 14:25:31,376 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 14:25:31,377 INFO Request ID is 855604d5-c67a-4341-8d21-65bd257fbdb4
2025-08-26 14:25:31,452 INFO status has been updated to accepted
2025-08-26 14:25:44,984 INFO status has been updated to running
2025-08-26 14:25:52,680 INFO status has been updated to successful
2025-08-26 14:25:53,635 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 14:25:53,635 INFO Request ID is 79b9fbd3-9170-471f-bfb6-53686ebb8c66
2025-08-26 14:25:53,834 INFO status has been updated to accepted
2025-08-26 14:26:03,132 INFO status has been updated to running
2025-08-26 14:26:15,994 INFO status has been updated to successful
2025-08-26 14:26:17,305 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 14:26:17,305 INFO Request ID is 917d99c1-d22b-4c44-9c2b-ef138646bbaa
2025-08-26 14:26:17,429 INFO status has been updated to accepted
2025-08-26 14:26:31,590 INFO status has been updated to running
2025-08-26 14:27:07,977 INFO status has been updated to successful
2025-08-26 14:27:08,871 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 14:27:08,872 INFO Request ID is 69ce9131-9bf7-4085-868b-b385c12ddc00
2025-08-26 14:27:08,941 INFO status has been updated to accepted
2025-08-26 14:27:30,124 INFO status has been updated to running
2025-08-26 14:27:41,567 INFO status has been updated to successful
2025-08-26 14:27:42,566 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 14:27:42,567 INFO Request ID is 609a9b2a-a69d-4419-ab4f-455880d9b88b
2025-08-26 14:27:42,722 INFO status has been updated to accepted
2025-08-26 14:27:56,892 INFO status has been updated to running
2025-08-26 14:28:33,169 INFO status has been updated to successful
2025-08-26 14:28:34,198 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 14:28:34,199 INFO Request ID is 63a37440-8aa5-4619-906e-e65f15472866
2025-08-26 14:28:34,268 INFO status has been updated to accepted
2025-08-26 14:28:48,192 INFO status has been updated to running
2025-08-26 14:28:55,965 INFO status has been updated to successful
2025-08-26 14:28:56,870 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 14:28:56,871 INFO Request ID is a33d57b2-0330-461a-b35c-182584c5ccd5
2025-08-26 14:28:56,948 INFO status has been updated to accepted
2025-08-26 14:29:10,608 INFO status has been updated to running
2025-08-26 14:29:29,774 INFO status has been updated to successful
2025-08-26 14:29:30,713 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 14:29:30,714 INFO Request ID is 6cf7f44d-89da-41a2-ad96-ae94356aa037
2025-08-26 14:29:30,801 INFO status has been updated to accepted
2025-08-26 14:29:39,391 INFO status has been updated to running
2025-08-26 14:30:03,846 INFO status has been updated to successful
2025-08-26 14:30:04,805 INFO [2025-01-29T00:00:00] This dataset is no longer supported by the data providers. Data and documentation are provided as is. Users are encouraged to use our [Forum](https://forum.ecmwf.int/) to raise any item of discussion with respect to this dataset.
2025-08-26 14:30:04,805 INFO Request ID is 106079b5-f7ed-4186-9e76-2e99ee82b7ac
2025-08-26 14:30:04,941 INFO status has been updated to accepted
2025-08-26 14:30:18,613 INFO status has been updated to running
2025-08-26 14:30:26,320 INFO status has been updated to successful
                                                                                         

We will make use of a preprocessing function to write model names and scenarios to the dataset dimensions:

def preprocess_flood_occurence(ds):
    filename = ds.encoding['source'].split("/")[-1].split("\\")[-1]
    ds['gcm_rcm'] = f'{filename.split("_")[4]}_{filename.split("_")[7]}'
    ds = ds.set_coords('gcm_rcm').expand_dims('gcm_rcm')

    ds['scenarios'] = filename.split("_")[5]
    ds = ds.set_coords('scenarios').expand_dims('scenarios')

    time_period = [filename.split("_")[9]]
    ds = ds.assign_coords(time_period=("time",time_period))
    return ds

We will read the dataset of extreme river discharges (absolute values) into a single dataset:

files = glob(os.path.join(data_folder_catch, 'rdisreturnmax*_tmean_abs_E-HYPEcatch*_catch_v1.nc'))
ds_flood = xr.open_mfdataset(files, preprocess=preprocess_flood_occurence)
ds_flood
<xarray.Dataset> Size: 20MB
Dimensions:                (scenarios: 3, gcm_rcm: 6, time: 4, id: 34810)
Coordinates:
  * id                     (id) int32 139kB 8801654 8000123 ... 9605711 9601936
  * time                   (time) datetime64[ns] 32B 1971-01-01 ... 2071-01-01
  * gcm_rcm                (gcm_rcm) <U36 864B 'ICHEC-EC-EARTH_CLMcom-CCLM4-8...
  * scenarios              (scenarios) <U10 120B 'historical' 'rcp45' 'rcp85'
    time_period            (time) object 32B '1971-2000' ... '2071-2100'
Data variables:
    rdisreturnmax10_tmean  (scenarios, gcm_rcm, time, id) float32 10MB dask.array<chunksize=(1, 1, 2, 34810), meta=np.ndarray>
    rdisreturnmax50_tmean  (scenarios, gcm_rcm, time, id) float32 10MB dask.array<chunksize=(1, 1, 2, 34810), meta=np.ndarray>
Attributes: (12/29)
    CDI:                      Climate Data Interface version 1.8.2 (http://mp...
    Conventions:              CF-1.6
    NCO:                      netCDF Operators version 4.7.7 (Homepage = http...
    frequency:                year
    CDO:                      Climate Data Operators version 1.8.2 (http://mp...
    comment:                  -
    ...                       ...
    invar_hm_model_id:        Hydrological models in the order of the variabl...
    invar_experiment_name:    rcp45
    time_coverage_start:      19710101
    time_coverage_end:        20001231
    variable_name:            rdisreturnmax10_tmean
    contact:                  copernicus-support@ecmwf.int

This preprocessed dataset will be saved to disk for future use:

ds_flood.to_netcdf(os.path.join(data_folder, 'rdis_extremes_abs_E-HYPEcatch_allmodels.nc'))

The same procedure will be applied to the dataset of relative changes in extreme river discharges:

files = glob(os.path.join(data_folder_catch, 'rdisreturnmax*_tmean_rel_E-HYPEcatch*_catch_v1.nc'))
ds_flood_rel = xr.open_mfdataset(files, preprocess=preprocess_flood_occurence)
ds_flood_rel
<xarray.Dataset> Size: 10MB
Dimensions:                (scenarios: 2, gcm_rcm: 6, time: 3, id: 34810)
Coordinates:
  * id                     (id) int32 139kB 8801654 8000123 ... 9605711 9601936
  * time                   (time) datetime64[ns] 24B 2011-01-01 ... 2071-01-01
  * gcm_rcm                (gcm_rcm) <U36 864B 'ICHEC-EC-EARTH_CLMcom-CCLM4-8...
  * scenarios              (scenarios) <U5 40B 'rcp45' 'rcp85'
    time_period            (time) <U9 108B '1971-2000' '1971-2000' '1971-2000'
Data variables:
    rdisreturnmax10_tmean  (scenarios, gcm_rcm, time, id) float32 5MB dask.array<chunksize=(1, 1, 1, 34810), meta=np.ndarray>
    rdisreturnmax50_tmean  (scenarios, gcm_rcm, time, id) float32 5MB dask.array<chunksize=(1, 1, 1, 34810), meta=np.ndarray>
Attributes: (12/30)
    CDI:                      Climate Data Interface version 1.8.2 (http://mp...
    Conventions:              CF-1.6
    NCO:                      netCDF Operators version 4.7.7 (Homepage = http...
    frequency:                year
    comment:                  -
    CDO:                      Climate Data Operators version 1.8.2 (http://mp...
    ...                       ...
    invar_experiment_name:    rcp45
    time_coverage_start:      20110101
    time_coverage_end:        20401231
    reference_period:         1971-2000
    variable_name:            rdisreturnmax10_tmean
    contact:                  copernicus-support@ecmwf.int
ds_flood_rel.to_netcdf(os.path.join(data_folder, 'rdis_extremes_rel_E-HYPEcatch_allmodels.nc'))

Now all of the data that we need for the analysis has been retrieved and aggregated. In the next notebooks this data will be used to analyze the impact of climate scenarios on the seasonal and extreme river discharges as a proxy for flood hazard.

Author of the workflow:
Natalia Aleksandrova (Deltares)