ESMValGroup / ESMValTool

ESMValTool: A community diagnostic and performance metrics tool for routine evaluation of Earth system models in CMIP
https://www.esmvaltool.org
Apache License 2.0
217 stars 127 forks source link

Able to use output from multiple MIPs from the same dataset in recipe? #1668

Closed mnichol3 closed 4 years ago

mnichol3 commented 4 years ago

Hi all,

@ssmithClimate and I are attempting to use AERmon and Amon model output from the same model/dataset in a recipe, e.g.,

datasets:
        - {dataset: GISS-base, project: CMIP6, activity: AerChemMIP, institute: NASA-GISS, mip: Amon, exp: season-so2, ensemble: r1i1p5f101, grid: gn}
        - {dataset: GISS-base, project: CMIP6, activity: AerChemMIP, institute: NASA-GISS, mip: AERmon, exp: season-so2, ensemble: r1i1p5f101, grid: gn}

But I keep getting the following error:

esmvalcore._recipe_checks.RecipeError: Unable to load CMOR table (project) 'CMIP6' for variable 'rlut' with mip 'AERmon'

even though the rlut variable defines its mip as Amon further down in the variable section of the recipe:

rlut:
        preprocessor: preproc
        mip: Amon
        start_year: 2000
        end_year: 2014

The recipe and diagnostic work fine when only Amon or AERmon variables are used. Is there a way to use both of these datasets in the same recipe?

Attached are the main_log_debug and recipe in question (converted from .yml to .txt to upload to GitHub).

Thank you!

valeriupredoi commented 4 years ago

that is because the mip in the variable section gets overwritten by the mip defined in the dataset section (or, better said, it is ignored, once it finds a mip entry in the dataset dictionary). What you need to do is to specify multiple mip entries in the dataset section eg:

- {dataset: GISS-base, project: CMIP6, activity: AerChemMIP, institute: NASA-GISS, mip: [Amon, AERmon], exp: season-so2, ensemble: r1i1p5f101, grid: gn}
valeriupredoi commented 4 years ago

or alternatively, don't specify the mip at all in the dataset dictionary and specify it individually per requested variable in each variable's section :beer:

mnichol3 commented 4 years ago

@valeriupredoi thank you for the quick response!

Omitting the mip key & value from the dataset dictionary solved it!

I just wanted to note, specifying multiple mips in the dataset dictionary

- {dataset: GISS-base, ... , mip: [Amon, AERmon], ...}

resulted in the following error:

ValueError:
Error validating data /home/nich980/esmvaltool/jgcri-fork/ESMValTool/esmvaltool/recipes/emissions_mip/recipe-initial_analysis-giss-test.yml with schema /home/nich980/anaconda3/envs/esm-dev/lib/python3.8/site-packages/esmvalcore/recipe_schema.yml
    datasets.0.mip: '['Amon', 'AERmon']' is not a str.                                                                   
    datasets.1.mip: '['Amon', 'AERmon']' is not a str.                                                                   
    datasets.2.mip: '['Amon', 'AERmon']' is not a str.                                                                   
    datasets.3.mip: '['Amon', 'AERmon']' is not a str.

Thanks again for your help 🍺

bouweandela commented 4 years ago

Great that you managed to get it to work! You can read more about this topic here: https://esmvaltool.readthedocs.io/projects/esmvalcore/en/latest/recipe/overview.html#variable-and-dataset-definitions

If your question is completely answered, could you please close the issue?

bouweandela commented 4 years ago

Accidentally clicked the button myself :blush: