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_homedirectory. If that fails it will look for the GRDC Export (ASCII text) formatted file for example6435060_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 ...
- ewatercycle.observation.grdc.title
Mean daily discharge (Q)
- ewatercycle.observation.grdc.Conventions
CF-1.7
- ewatercycle.observation.grdc.references
grdc.bafg.de
- ewatercycle.observation.grdc.institution
GRDC
- ewatercycle.observation.grdc.history
Download from GRDC Database, 21/06/2024
- ewatercycle.observation.grdc.missing_value
-999.000
- ewatercycle.observation.grdc.get_grdc_data_monthly(station_id: str, start_time: str, end_time: str, data_home: str | None = None, column1: str = 'original streamflow', column2: str = 'calculated streamflow', column3: str = 'flag') xarray.Dataset
Load monthly GRDC discharge data for a specific station.
This function is similar to get_grdc_data but specifically for monthly data. It returns a Dataset with three time series columns:
column1: original streamflow (default: “original streamflow”)
column2: calculated streamflow (default: “calculated streamflow”)
column3: flag (default: “flag”)
- Currently, this function only reads GRDC .txt files.
NetCDF support (.nc) is not implemented.
- Parameters:
station_id – str GRDC station identifier.
start_time – str Start of the period to extract, in ISO format (e.g., “YYYY-MM-DDTHH:MMZ”).
end_time – str End of the period to extract, in ISO format (e.g., “YYYY-MM-DDTHH:MMZ”).
data_home – str | None, optional Path to the directory containing the GRDC files. Defaults to None. If None, falls back to CFG.grdc_location.
column1 – str, optional Name for the first data column (original streamflow).
column2 – str, optional Name for the second data column (calculated streamflow).
column3 – str, optional Name for the third data column (flag).
- Returns:
- grdc data in a xarray dataset.
Shaped like a filtered version of the GRDC daily NetCDF file.
- Data description:
Original - original (provided) data Calculated - GRDC calculated from daily data Flag - percentage of valid values used for calculation from daily data
- Raises:
ValueError – If no data for the requested station id and period could not be found.
- NotImplementedError
If a NetCDF (.nc) file is found (support not implemented).