ewatercycle.observation.grdc ============================ .. py:module:: ewatercycle.observation.grdc .. autoapi-nested-parse:: Global Runoff Data Centre module. Module Contents --------------- .. py:data:: logger .. py:data:: MetaDataType .. py:function:: 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``. :param 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 :param start_time: Start time of model in UTC and ISO format string e.g. 'YYYY-MM-DDTHH:MM:SSZ'. :param end_time: End time of model in UTC and ISO format string e.g. 'YYYY-MM-DDTHH:MM:SSZ'. :param 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. :param 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. .. rubric:: Examples .. code-block:: python from ewatercycle.observation.grdc import get_grdc_data ds = get_grdc_data('6435060', '2000-01-01T00:00Z', '2001-01-01T00:00Z') ds 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 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. :param station_id: str GRDC station identifier. :param start_time: str Start of the period to extract, in ISO format (e.g., "YYYY-MM-DDTHH:MMZ"). :param end_time: str End of the period to extract, in ISO format (e.g., "YYYY-MM-DDTHH:MMZ"). :param data_home: str | None, optional Path to the directory containing the GRDC files. Defaults to None. If None, falls back to `CFG.grdc_location`. :param column1: str, optional Name for the first data column (original streamflow). :param column2: str, optional Name for the second data column (calculated streamflow). :param 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).