Skip to content

Update CMIP6 and obs4mips cmor tables to last release#158

Merged
mattiarighi merged 12 commits into
developmentfrom
dev_update_cmip6_tables
Sep 6, 2019
Merged

Update CMIP6 and obs4mips cmor tables to last release#158
mattiarighi merged 12 commits into
developmentfrom
dev_update_cmip6_tables

Conversation

@jvegreg

@jvegreg jvegreg commented Jul 11, 2019

Copy link
Copy Markdown
Contributor

Updating tables to last release

https://github.com/PCMDI/cmip6-cmor-tables/releases/tag/6.5.29

Applied a fix to Efx tables (generic level missing). It is already on master, but I prefer to use tags for this so it is easier to know the exact version we use

Closes #150 and closes #45

As a bonus, I added a better error message when trying to get a coordinate that is not defined

@jvegreg jvegreg added the cmor Related to the CMOR standard label Jul 11, 2019
@zklaus

zklaus commented Jul 11, 2019

Copy link
Copy Markdown

Thanks, I think this helps a lot!

There is a problem that we are slowly approaching: CMIP6 data will not follow a uniform data_specs_version. This matters because it means that for example data from different models will have different standard_names. For example the two already published datasets

{dataset: GISS-E2-1-G, exp: historical, ensemble: r1i1p1f1, mip: Amon, short_name: psl, grid: gn}
{dataset: GFDL-CM4, exp: historical, ensemble: r1i1p1f1, mip: Amon, short_name: psl, grid: gr1}

use standard_name air_pressure_at_sea_level and air_pressure_at_mean_sea_level, respectively.

Both of them do so following the data_specs_version that they give in the file, namely 01.00.23 and 01.00.27. But how do you compare this?

The oldest data_specs_version I have seen in CMIP6 data is 01.00.23, but there is no guarantee that there isn't and older one and I have not checked what has changed since then.

I am not sure what, if anything, to do about it right now, but at some point we will get this kind of error.
Broadly speaking there seem to be three approaches:

  • Do nothing
  • Support multiple data spec versions
  • Choose one data spec version and provide "fixes" to align other data with that.

What do you think?

Comment thread esmvalcore/cmor/tables/cmip6/README.md
@jvegreg

jvegreg commented Jul 11, 2019

Copy link
Copy Markdown
Contributor Author

Do nothing

I think this is not possible

Support multiple data spec versions

This will be a nightmare, not only for us but for users. They will find different CMIP6 specifications in their diagnostic code and will have to adapt to it.

Choose one data spec version and provide "fixes" to align other data with that.

I prefer this, with one condition: we choose last version released and keep updating. We should assume that changes are done for a reason. Most variables will be the same in all versions anyway, so I think the number of fixes will be manageable. We can add fixes at PROJECT level that are applied after MODEL fixes to convert data to the latest version of the request.

In your example, we can add a PROJECT fix that changes the standard_name for psl to the new one automatically if it finds the old one.

@zklaus

zklaus commented Jul 11, 2019

Copy link
Copy Markdown

Ok, @jvegasbsc I agree with that approach. I opened a new issue for that (#159) so that we can finish this PR.

Thanks!

Comment thread esmvalcore/cmor/table.py

@bouweandela bouweandela left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like frequency is now always defined in the variable and never in the table header. Could you simplify the code so it only reads the frequency from the variable section, i.e. remove the frequency related code from CMIP6Info._load_table and add it in VariableInfo.read_json?

@bouweandela

Copy link
Copy Markdown
Member

@valeriupredoi I believe you worked on this topic while @jvegasbsc was on parental leave. Can you also have a look at this pull request?

@bouweandela

Copy link
Copy Markdown
Member

There is also this code

mip_info = CMOR_TABLES[cmor_table].get_table(mip)
if mip_info:
table_entry.frequency = mip_info.frequency

which will not work anymore for CMIP6 tables. I'm not entirely sure why it is here anyway, but it seems somehow related to derived variables.

@jvegreg

jvegreg commented Jul 12, 2019

Copy link
Copy Markdown
Contributor Author

which will not work anymore for CMIP6 tables.

Out of the box it will not work, but we are assigning a frequency to the mip by ourselves: the most common in the variables.

I'm not entirely sure why it is here anyway, but it seems somehow related to derived variables.

Yes, it is for assigning a frequency for the checks for custom and derived variables

@jvegreg

jvegreg commented Jul 12, 2019

Copy link
Copy Markdown
Contributor Author

It looks like frequency is now always defined in the variable and never in the table header. Could you simplify the code so it only reads the frequency from the variable section, i.e. remove the frequency related code from CMIP6Info._load_table and add it in VariableInfo.read_json?

There are other projects that are be using CMOR3 format for their tables (i.e. PRIMAVERA) I don't know if all of them made this change.

By the way, we are using CMIP5 and CMIP6 as cmor types when we are really refering to CMOR 2 and CMOR 3. I think it is easier for users to match, but the naming is not entirely correct

@bouweandela

Copy link
Copy Markdown
Member

I'm not entirely sure why it is here anyway, but it seems somehow related to derived variables.

Yes, it is for assigning a frequency for the checks for custom and derived variables

Would it be possible to replace

table_entry = CMOR_TABLES[cmor_table].get_variable(mip, short_name)
if derive and table_entry is None:
custom_table = CMOR_TABLES['custom']
table_entry = custom_table.get_variable(mip, short_name)

mip_info = CMOR_TABLES[cmor_table].get_table(mip)
if mip_info:
table_entry.frequency = mip_info.frequency

by something like

    cmor_strict = False if derive else 'default'
    table_entry = CMOR_TABLES[cmor_table].get_variable(mip, short_name, cmor_strict)

and change the table readers so this works (i.e. if 'default' is passed it should use whatever is configured in config-developer.yml)? I think it's confusing to change the content of the cmor variable definitions outside of the cmor table module and also using the custom or default table outside of the table module seems a bit hacky, because it's not a proper table.

@bouweandela

Copy link
Copy Markdown
Member
which will not work anymore for CMIP6 tables.

Out of the box it will not work, but we are assigning a frequency to the mip by ourselves: the most common in the variables.

I don't see any code that does this, can you point me to it?

@jvegreg

jvegreg commented Jul 12, 2019

Copy link
Copy Markdown
Contributor Author

I don't see any code that does this, can you point me to it?

Here: https://github.com/ESMValGroup/ESMValTool/pull/985/files

I thought this was merged, but it seems it got lost in the split

@zklaus

zklaus commented Jul 12, 2019

Copy link
Copy Markdown

Notice how that PR actually contains updated tables.

@valeriupredoi

Copy link
Copy Markdown
Contributor

yes, my old PR! And now @mattiarighi is busting my balls about it 😁

@valeriupredoi

Copy link
Copy Markdown
Contributor

Notice how that PR actually contains updated tables.

well, they were the latest at their time (the time of the PR), now they've become obsolete as well, I believe the latest CMOR version is 01.00.30 (if not 31beta)

@valeriupredoi

Copy link
Copy Markdown
Contributor

@jvegasbsc are you going to port ESMValGroup/ESMValTool#985 in here?

@jvegreg

jvegreg commented Jul 15, 2019

Copy link
Copy Markdown
Contributor Author

Yes, I will start working on it now

Comment thread esmvalcore/cmor/check.py
Comment thread esmvalcore/cmor/table.py
Comment thread esmvalcore/cmor/table.py
@mattiarighi

Copy link
Copy Markdown
Contributor

Please do not merge this until is tested with several recipes.
The last tables update gave us lots of headaches...

@zklaus

zklaus commented Jul 18, 2019

Copy link
Copy Markdown

Re Mattias concern: In principle, the headaches should be reduced this time round simply because of the split. No change to the master branch here impacts recipe development, so I wonder if we should not rather get this merged relatively quickly, but make sure that things work or at least that there is a clear way to adjust existing recipes, only before we produce the next (pre-)release?

Also, there are very few CMIP6 recipes in the public part of ESMValTool at the moment. Which recipes do you think should be checked?

@mattiarighi

Copy link
Copy Markdown
Contributor

make sure that things work or at least that there is a clear way to adjust existing recipes?

That's what I meant, just run a few recipes to make sure nothing gets broken.
We should make sure that the development branch is always stable, independently of the official releases.

Also, there are very few CMIP6 recipes in the public part of ESMValTool at the moment. Which recipes do you think should be checked?

Some of the ones using obs4mips (I can do that with perfmetrics), since last time there were issues with this project, and maybe one or two with CMIP6.

So just give me your OK when this is ready for testing.
It won't take long...

@zklaus

zklaus commented Jul 18, 2019

Copy link
Copy Markdown

make sure that things work or at least that there is a clear way to adjust existing recipes?

That's what I meant, just run a few recipes to make sure nothing gets broken.

Hah, what a sneaky way to quote :) The important bit for me was of course

only before a release.

We should make sure that the development branch is always stable, independently of the official releases.

Sure, but what does stable mean? We will want to introduce changes that break existing recipes. That's ok and should not in and of itself delay a release of the core, nor should the core be considered unstable because of it. Rather the ESMValTool should be judicious in adjusting the dependency on a new version of the core.

Also, there are very few CMIP6 recipes in the public part of ESMValTool at the moment. Which recipes do you think should be checked?
Some of the ones using obs4mips (I can do that with perfmetrics), since last time there were issues with this project, and maybe one or two with CMIP6.

So just give me your OK when this is ready for testing.
It won't take long...

Great, that should definitely work for this PR. 👍

@mattiarighi

Copy link
Copy Markdown
Contributor

We will want to introduce changes that break existing recipes.

Yes, but not at this stage.
A lot of people are working hard on their diagnostics to finalize the papers and we should avoid introducing changes that could break existing recipes and delay the diagnostic development.

But as I said, the usual testing procedure plus a couple of more recipes with CMIP6 models should be enough.

@zklaus

zklaus commented Jul 18, 2019

Copy link
Copy Markdown

The flip side of course is that we surely won't want to release with 01.00.10 tables, so getting this in quickly will allow people to develop there recipes and diagnostics with a version of the tables that is close to the one used in all their data instead of trying to bend the data to a long out-of-date version of the standards.

But yeah, point taken, smooth development experience is important now.

@jvegreg

jvegreg commented Aug 8, 2019

Copy link
Copy Markdown
Contributor Author

Any update on this?

@valeriupredoi valeriupredoi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it works (as it looks like it does), me happy 🍺

Comment thread esmvalcore/cmor/table.py
Comment thread esmvalcore/cmor/table.py Outdated
@zklaus

zklaus commented Aug 9, 2019

Copy link
Copy Markdown

Any update on this?

Would like to see this go in. At the moment though, there are a bunch of open conversations that should be resolved one way or another first.

@jvegreg

jvegreg commented Sep 6, 2019

Copy link
Copy Markdown
Contributor Author

Ready to merge from my side

@bouweandela bouweandela left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, but I did not test.

@mattiarighi mattiarighi requested review from schlunma and removed request for tomaslovato September 6, 2019 09:22
@mattiarighi

Copy link
Copy Markdown
Contributor

@schlunma can you test it with one of your cmip6 recipes?

@valeriupredoi

valeriupredoi commented Sep 6, 2019 via email

Copy link
Copy Markdown
Contributor

@schlunma schlunma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully tested with 3 recipes with ~16 CMIP6 models each (included CMIP5 and OBS data as well). I did not run diagnostic scripts, though.

@mattiarighi mattiarighi merged commit f51525b into development Sep 6, 2019
@mattiarighi mattiarighi deleted the dev_update_cmip6_tables branch September 6, 2019 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cmor Related to the CMOR standard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CMIP6 tables are out of sync Outdated CMOR CMIP6 Tables

6 participants