ewatercycle.observation.grdc

Global Runoff Data Centre module.

Module Contents

ewatercycle.observation.grdc.logger
ewatercycle.observation.grdc.MetaDataType
ewatercycle.observation.grdc.get_grdc_data(station_id: str, start_time: str, end_time: str, data_home: str | None = None, column: str = 'streamflow') xarray.Dataset

Get river discharge data from Global Runoff Data Centre (GRDC).

Requires the GRDC daily data files in a local directory. The GRDC daily data NetCDF file can be downloaded at https://www.bafg.de/GRDC/EN/02_srvcs/21_tmsrs/riverdischarge_node.html . The downloaded zip file contains a file named GRDC-Daily.nc.

This function will first try to read data from the GRDC-Daily.nc file in the data_home directory. If that fails it will look for the GRDC Export (ASCII text) formatted file for example 6435060_Q_Day.Cmd.txt.

Parameters:
  • station_id – The station id to get. The station id can be found in the catalogues at https://www.bafg.de/GRDC/EN/02_srvcs/21_tmsrs/212_prjctlgs/project_catalogue_node.html

  • start_time – Start time of model in UTC and ISO format string e.g. ‘YYYY-MM-DDTHH:MM:SSZ’.

  • end_time – End time of model in UTC and ISO format string e.g. ‘YYYY-MM-DDTHH:MM:SSZ’.

  • data_home – optional. The directory where the daily grdc data is located. If left out will use the grdc_location in the eWaterCycle configuration file.

  • column – optional. Name of column in dataframe. Default: “streamflow”.

Returns:

grdc data in a xarray dataset.

Shaped like a filtered version of the GRDC daily NetCDF file.

Raises:

ValueError – If no data for the requested station id and period could not be found.

Examples

from ewatercycle.observation.grdc import get_grdc_data

ds = get_grdc_data('6435060',
                   '2000-01-01T00:00Z',
                   '2001-01-01T00:00Z')
ds
<xarray.Dataset> Size: 5kB
Dimensions:              (time: 367)
Coordinates:
* time                 (time) datetime64[ns] 3kB 2000-01-01 ... 2001-01-01
    id                   int32 4B 6435060
Data variables:
    streamflow           (time) float32 1kB ...
    area                 float32 4B ...
    country              <U2 8B ...
    geo_x                float32 4B ...
    geo_y                float32 4B ...
    geo_z                float32 4B ...
    owneroforiginaldata  <U38 152B ...
    river_name           <U11 44B 'RHINE RIVER'
    station_name         <U6 24B 'LOBITH'
    timezone             float32 4B ...
Attributes:
    title:          Mean daily discharge (Q)
    Conventions:    CF-1.7
    references:     grdc.bafg.de
    institution:    GRDC
    history:        Download from GRDC Database, 21/06/2024
    missing_value:  -999.000