ewatercycle.esmvaltool.run

Run ESMValTool recipes.

Module Contents

ewatercycle.esmvaltool.run.logger
ewatercycle.esmvaltool.run.run_recipe(recipe: ewatercycle.esmvaltool.schema.Recipe, output_dir: pathlib.Path | None = None) dict[str, str]

Run an ESMValTool recipe.

Parameters:
  • recipe – ESMValTool recipe

  • output_dir – Directory where output should be written to. If None then output is written to generated timestamped directory.

Returns:

Dictionary with forcing data variables as keys and file names as values and a key called directory with value the parent directory of the file names.

Example

To run a recipe that generates a distributed forcing dataset:

>>> from ewatercycle.testing.fixtures import rhine_shape
>>> from ewatercycle.esmvaltool.builder import (
...    build_generic_distributed_forcing_recipe
... )
>>> from ewatercycle.esmvaltool.run import run_recipe
>>> shape = rhine_shape()
>>> recipe = build_generic_distributed_forcing_recipe(
...     start_year=2000,
...     end_year=2001,
...     shape=shape,
...     dataset='ERA5',
... )
>>> output = run_recipe(recipe)
>>> output
diagnostic/script:
  DataFile('OBS6_ERA5_reanaly_*_day_pr_2000-2001.nc')
  DataFile('OBS6_ERA5_reanaly_*_day_tas_2000-2001.nc')
  DataFile('OBS6_ERA5_reanaly_*_day_tasmax_2000-2001.nc')
  DataFile('OBS6_ERA5_reanaly_*_day_tasmin_2000-2001.nc')

diagnostic/pr:
  DataFile('OBS6_ERA5_reanaly_*_day_pr_2000-2001.nc')

diagnostic/tas:
  DataFile('OBS6_ERA5_reanaly_*_day_tas_2000-2001.nc')

diagnostic/tasmin:
  DataFile('OBS6_ERA5_reanaly_*_day_tasmin_2000-2001.nc')

diagnostic/tasmax:
  DataFile('OBS6_ERA5_reanaly_*_day_tasmax_2000-2001.nc')