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
210 stars 123 forks source link

Issue with datasets covering the same period using multi_datasets.py #3543

Closed MartinCussacMF closed 4 months ago

MartinCussacMF commented 4 months ago

I encountered a problem while using the multi_dataset.py script to plot various dataset total columns of ozone. It seems that when the dataset attribute is the same (e.g. for two different experiments with the same model), if the start date and end date are the same, only one of the multiple experiments will be plotted. I tried some other plots using the multi_dataset.py script such as the annual cycle and the behaviour is the same. I don't know if this is intentional, and if yes why?

I attached two recipes:

recipe_timeseries_toz_1.yml.txt recipe_timeseries_toz_2.yml.txt

timeseries_toz_1 timeseries_toz_2

schlunma commented 4 months ago

Hi @MartinCussacMF, thanks for opening this issue!

I am quite sure that this is not related to the diagnostic. Could you please check the contents of your preproc directory in the ESMValTool output directory? I am pretty sure that there is only one file for your model in the second case. The reason for this is that files will be named {project}_{dataset}_{mip}_{exp}_{ensemble}_{short_name}_{grid}_{start_year}_{end_year}.nc, so both of your models will have exactly the same name and get overwritten.

There is an easy fix for this! You need to use a custom config-developer file. For this, run

esmvaltool config get_config_developer

and open the corresponding file that has been created. Here, change the CMIP6 entry so that the output file contains {simu}, e.g.,

output_file: '{project}_{dataset}_{mip}_{exp}_{simu}_{ensemble}_{short_name}_{grid}'

Then, make sure to use that custom config-developer file by setting config_developer_file: ~/.esmvaltool/config-developer.yml in your config-user file (the default location of that is ~/.esmvaltool/config-user.yml.

Please note that you won't be able to read regular CMIP6 data with this. Alternatively, you could setup a new project for your model. For this, copy the entire CMIP6 block in the config-developer file, rename the title (e.g. CNRM) and adapt the output file as before. Then you can use project: CNRM in your recipe for your model.

One more thing I noticed in your recipe: it seems you're trying to set a title for the plot. This doesn't quite work. Instead of

            plot_kwargs:
              title: toz (90S-60N)
              RACM_5TgN:
                color: blue 
              RACM_2.5TgN:  
                color: orange
              ESACCI-OZONE:
                color: black
              NIWA-BS:
                color: red

use

            plot_kwargs:
              RACM_5TgN:
                color: blue 
              RACM_2.5TgN:  
                color: orange
              ESACCI-OZONE:
                color: black
              NIWA-BS:
                color: red
            pyplot_kwargs:
              title: toz (90S-60N)
              xlabel: Years  # if you want to adapt the x label
              ylabel: toz [DU] # if you want to adapt the y label
MartinCussacMF commented 4 months ago

Hi @schlunma, Thanks a lot for your help. The problem was indeed the one that you indentified. I created the CNRM project in the config-develloper file, and managed to produce the desired plots. Thanks also for the tip regarding the plot title and labels.