diff --git a/README.md b/README.md index 01f9b38..eef97f6 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ The goal is to keep the repository size small (~ 100 MB), so it can be easily do At present, the repository contains 44 monthly, and 35 daily timeseries datasets. The specifications can be found in [`datasets.yml`](esmvaltool_sample_data/datasets.yml). +The data are stored using the data reference syntax structure from DKRZ. + ## Usage The functionality of this repository is kept simple. @@ -27,13 +29,14 @@ If you want to use this dataset in your ESMValTool projects, add the following l ```yaml rootpath: - CMIP6: /esmvaltool_sample_data/data/timeseries/ + CMIP6: + - /esmvaltool_sample_data/data/timeseries/CMIP6 drs: - CMIP6: default + CMIP6: DKRZ ``` -If you have installed `esmvaltool_sample_data`, you can find the `rootpath` using `python -c 'from esmvaltool_sample_data import base_dir; print(base_dir.parent)'` +If you have installed `esmvaltool_sample_data`, you can find the `rootpath` settings using `python -c 'import esmvaltool_sample_data, yaml; print(yaml.dump(esmvaltool_sample_data.get_rootpaths()))'` ## License diff --git a/esmvaltool_sample_data/__init__.py b/esmvaltool_sample_data/__init__.py index 9c38c91..0baf3f8 100644 --- a/esmvaltool_sample_data/__init__.py +++ b/esmvaltool_sample_data/__init__.py @@ -7,7 +7,9 @@ VERBOSE = False -# This ignore list is used to help with debugging +# This ignore list is used to help with debugging only +# for a more permanent solution, add +# problematic datasets the `ignore` section in `../datasets.yml`. ignore_list = [ # 'CMIP6/CMIP/AWI/AWI-ESM-1-1-LR/historical/r1i1p1f1/Amon/ta/gn/v20200212', ] @@ -50,6 +52,7 @@ def load_cubes_from_input_dirs(input_dirs: list) -> 'iris.Cube': def filter_ignored_datasets(dirs, root): + """Filter datasets defined in the global `ignore` list.""" for drc in dirs: test_drc = str(drc.relative_to(root)) if test_drc not in ignore_list: @@ -87,6 +90,22 @@ def load_timeseries_cubes(mip_table: str = 'Amon') -> list: return list(cubes) +def get_rootpaths() -> dict: + """Return a dict with rootpaths to update the user config in ESMValTool.""" + rootpath = { + 'rootpath': { + 'CMIP6': [ + str(base_dir / 'data' / 'timeseries' / 'CMIP6'), + ] + }, + 'drs': { + 'CMIP6': 'default', + }, + } + + return rootpath + + if __name__ == '__main__': VERBOSE = True