ewatercycle.forcing package

ewatercycle.forcing.load(directory: str)

Load previously generated or imported forcing data.

Parameters

directory – forcing data directory; must contain ewatercycle_forcing.yaml file

Returns: Forcing object

ewatercycle.forcing.load_foreign(target_model, start_time: str, end_time: str, directory: str = '.', shape: Optional[str] = None, forcing_info: Optional[Dict] = None)

Load existing forcing data generated from an external source.

Parameters
  • target_model – Name of the hydrological model for which the forcing will be used

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

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

  • directory – forcing data directory

  • shape – Path to a shape file. Used for spatial selection.

  • forcing_info – Dictionary with model-specific information about forcing data. See below for the available options for each model.

Returns

Forcing object

Examples

For Marrmot

from ewatercycle.forcing import load_foreign

forcing = load_foreign('marmot',
                       directory='/data/marrmot-forcings-case1',
                       start_time='1989-01-02T00:00:00Z',
                       end_time='1999-01-02T00:00:00Z',
                       forcing_info={
                           'forcing_file': 'marrmot-1989-1999.mat'
                       })

For LisFlood

from ewatercycle.forcing import load_foreign

forcing = load_foreign(target_model='lisflood',
                       directory='/data/lisflood-forcings-case1',
                       start_time='1989-01-02T00:00:00Z',
                       end_time='1999-01-02T00:00:00Z',
                       forcing_info={
                           'PrefixPrecipitation': 'tp.nc',
                           'PrefixTavg': 'ta.nc',
                           'PrefixE0': 'e.nc',
                           'PrefixES0': 'es.nc',
                           'PrefixET0': 'et.nc'
                       })

Model-specific forcing info:

Hype
  • Pobs (str) – Input file for precipitation data.

  • TMAXobs (str) – Input file for maximum temperature data.

  • TMINobs (str) – Input file for minimum temperature data.

  • Tobs (str) – Input file for temperature data.

Lisflood
  • PrefixPrecipitation – Path to a NetCDF or pcraster file with precipitation data

  • PrefixTavg – Path to a NetCDF or pcraster file with average temperature data

  • PrefixE0 – Path to a NetCDF or pcraster file with potential evaporation rate from open water surface data

  • PrefixES0 – Path to a NetCDF or pcraster file with potential evaporation rate from bare soil surface data

  • PrefixET0 – Path to a NetCDF or pcraster file with potential (reference) evapotranspiration rate data

Marrmot

forcing_file – Matlab file that contains forcings for Marrmot models. See format forcing file in model implementation.

Pcrglobwb
  • precipitationNC (str) – Input file for precipitation data.

  • temperatureNC (str) – Input file for temperature data.

Wflow
  • netcdfinput (str) – Path to forcing file.

  • Precipitation (str) – Variable name of precipitation data in input file.

  • EvapoTranspiration (str) – Variable name of evapotranspiration data in input file.

  • Temperature (str) – Variable name of temperature data in input file.

  • Inflow (str) – Variable name of inflow data in input file.

ewatercycle.forcing.generate(target_model: str, dataset: str, start_time: str, end_time: str, shape: str, directory: Optional[str] = None, model_specific_options: Optional[Dict] = None)

Generate forcing data with ESMValTool.

Parameters
  • target_model – Name of the model

  • dataset – Name of the source dataset. See datasets.

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

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

  • shape – Path to a shape file. Used for spatial selection.

  • directory – Directory in which forcing should be written. If not given will create timestamped directory.

  • model_specific_options – Dictionary with model-specific recipe settings. See below for the available options for each model.

Returns

Forcing object

Model-specific options that can be passed to generate:

Hype

None – Hype does not have model-specific generate options.

Lisflood
  • target_grid (dict) – the target_grid should be a dict with the following keys:

    • start_longitude: longitude at the center of the first grid cell.

    • end_longitude: longitude at the center of the last grid cell.

    • step_longitude: constant longitude distance between grid cell centers.

    • start_latitude: latitude at the center of the first grid cell.

    • end_latitude: longitude at the center of the last grid cell.

    • step_latitude: constant latitude distance between grid cell centers.

    Make sure the target grid matches up with the grid in the mask_map and files in parameterset_dir. Also the shape should be within the target grid.

    If not given will guestimate target grid from shape using a 0.1x0.1 grid with 0.05 offset.

  • run_lisvap (dict) – Lisvap specification. Default is None. If lisvap should be run then give a dictionary with following key/value pairs:

    • lisvap_config: Name of Lisvap configuration file.

    • mask_map: A mask for the spatial selection.

      This file should have same extent and resolution as parameter-set.

    • version: LISVAP/LISFLOOD model version supported by ewatercycle.

      Pick from available_versions.

    • parameterset_dir: Directory of the parameter set.

      Directory should contains the Lisvap config file and files the config points to.

Marrmot

None – Marrmot does not have model-specific generate options.

Pcrglobwb
  • start_time_climatology (str) – Start time for the climatology data

  • end_time_climatology (str) – End time for the climatology data

  • extract_region (dict) – Region specification, dictionary must contain start_longitude, end_longitude, start_latitude, end_latitude

Wflow
  • dem_file (str) – Name of the dem_file to use. Also defines the basin param.

  • extract_region (dict) – Region specification, dictionary must contain start_longitude, end_longitude, start_latitude, end_latitude

Submodules