Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve variable alias managament #595

Merged
merged 13 commits into from
Oct 2, 2020
Merged

Conversation

jvegreg
Copy link
Contributor

@jvegreg jvegreg commented Mar 30, 2020

Porting the changes from ESMValGroup/ESMValTool#950 and fixing the issue with the data finder described in ESMValGroup/ESMValTool#1593 and ESMValGroup/ESMValTool#1605

Tasks

  • Create an issue to discuss what you are going to do, if you haven't done so already (and add the link at the bottom)
  • This pull request has a descriptive title that can be used in a changelog
  • Add unit tests
  • Public functions should have a numpy-style docstring so they appear properly in the API documentation. For all other functions a one line docstring is sufficient.
  • If writing a new/modified preprocessor function, please update the documentation
  • Circle/CI tests pass. Status can be seen below your pull request. If the tests are failing, click the link to find out why.
  • Codacy code quality checks pass. Status can be seen below your pull request. If there is an error, click the link to find out why. If you suspect Codacy may be wrong, please ask by commenting.
  • Please use yamllint to check that your YAML files do not contain mistakes
  • If you make backward incompatible changes to the recipe format, make a new pull request in the ESMValTool repository and add the link below

If you need help with any of the tasks above, please do not hesitate to ask by commenting in the issue or pull request.


Closes ESMValGroup/ESMValTool#1605

@jvegreg jvegreg added bug Something isn't working cmor Related to the CMOR standard labels Mar 30, 2020
@jvegreg jvegreg self-assigned this Mar 30, 2020
@jvegreg jvegreg changed the title Improve alias managament Improve variable alias managament Mar 31, 2020
@jvegreg jvegreg marked this pull request as ready for review April 1, 2020 08:53
esmvalcore/cmor/table.py Outdated Show resolved Hide resolved
esmvalcore/cmor/table.py Outdated Show resolved Hide resolved
esmvalcore/cmor/table.py Outdated Show resolved Hide resolved
esmvalcore/_recipe.py Show resolved Hide resolved
esmvalcore/_recipe.py Show resolved Hide resolved
Copy link
Contributor

@valeriupredoi valeriupredoi left a comment

Choose a reason for hiding this comment

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

cheers muchly @jvegasbsc 🍺 in principle am OK with this and I trust there is no other viable way going around these types of variables; but as @bouweandela points out - another layer of complexity for the user to figure out and set? BTW I don't see the documentation entry for it?

esmvalcore/_recipe.py Show resolved Hide resolved
@valeriupredoi
Copy link
Contributor

if you resolve los conflictos then it's good from my side, amigo! cool stuff 🍺

Copy link
Member

@bouweandela bouweandela left a comment

Choose a reason for hiding this comment

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

It would be great if you could add documentation for the new feature

@jvegreg
Copy link
Contributor Author

jvegreg commented Oct 1, 2020

Doc added, I also rebased it

doc/recipe/overview.rst Outdated Show resolved Hide resolved
doc/recipe/overview.rst Outdated Show resolved Hide resolved
Javier Vegas-Regidor and others added 2 commits October 1, 2020 11:18
doc/recipe/overview.rst Outdated Show resolved Hide resolved
doc/recipe/overview.rst Outdated Show resolved Hide resolved
doc/recipe/overview.rst Outdated Show resolved Hide resolved
Copy link
Member

@bouweandela bouweandela left a comment

Choose a reason for hiding this comment

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

Looks good to me, but someone would need to test this. @sloosvel or @schlunma would one of you have time to run one or more recipes to test the new and old functionality?

@schlunma
Copy link
Contributor

schlunma commented Oct 2, 2020

I can run a recipe in the background. What changes are to be expected?

@bouweandela
Copy link
Member

Great! The following variables have changed names between cmip5 and cmip6:

- ['sic', 'siconc']
- ['sit', 'sithick']
- ['tro3', 'o3']
- ['usi', 'siu']
- ['vsi', 'siv'] 

The expected outcome from this pull request is that it works if you use one of these variables with

  1. the cmip5 name and cmip5 datasets (as currently already works)
  2. the cmip6 name and cmip6 datasets (as currently already works)
  3. the cmip5 name and a mix of cmip5 and cmip6 datasets (currently broken)
  4. the cmip6 name and a mix of cmip5 and cmip6 datasets (currently broken)

@schlunma schlunma self-requested a review October 2, 2020 16:14
Copy link
Contributor

@schlunma schlunma left a comment

Choose a reason for hiding this comment

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

Tested successfully with this recipe:

documentation:
  description: |
    Recipe that demonstrates various uses of the preprocessor derive functionality.

  authors:
    - andela_bouwe

  maintainer:
    - righi_mattia

  projects:
    - c3s-magic

TEST: &alb_cmip5
  mip: Amon
  exp: historical
  start_year: 2004
  end_year: 2005
  additional_datasets:
    - {dataset: GFDL-CM3,     project: CMIP5, ensemble: r1i1p1}
    - {dataset: IPSL-CM6A-LR, project: CMIP6, ensemble: r1i1p1f1, grid: gr}


diagnostics:

  cmip5:
    description: Test variable derivation for CMIP5 models.
    variables:
      usi:
        <<: *alb_cmip5
        start_year: 1979
        end_year: 1979
        additional_datasets:
          - {dataset: GFDL-CM3,     project: CMIP5, ensemble: r1i1p1, mip: day}
          - {dataset: MPI-ESM1-2-HR,project: CMIP6, ensemble: r1i1p1f1, grid: gn, mip: SImon}
      vsi:
        <<: *alb_cmip5
        start_year: 1979
        end_year: 1979
        additional_datasets:
          - {dataset: GFDL-CM3,     project: CMIP5, ensemble: r1i1p1, mip: day}
          - {dataset: MPI-ESM1-2-HR,project: CMIP6, ensemble: r1i1p1f1, grid: gn, mip: SImon}
      siu:
        <<: *alb_cmip5
        start_year: 1979
        end_year: 1979
        additional_datasets:
          - {dataset: GFDL-CM3,     project: CMIP5, ensemble: r1i1p1, mip: day}
          - {dataset: MPI-ESM1-2-HR,project: CMIP6, ensemble: r1i1p1f1, grid: gn, mip: SImon}
      siv:
        <<: *alb_cmip5
        start_year: 1979
        end_year: 1979
        additional_datasets:
          - {dataset: GFDL-CM3,     project: CMIP5, ensemble: r1i1p1, mip: day}
          - {dataset: MPI-ESM1-2-HR,project: CMIP6, ensemble: r1i1p1f1, grid: gn, mip: SImon}
      sic:
        <<: *alb_cmip5
        start_year: 1979
        end_year: 1979
        additional_datasets:
          - {dataset: GFDL-CM3,     project: CMIP5, ensemble: r1i1p1, mip: day}
          - {dataset: MPI-ESM1-2-HR,project: CMIP6, ensemble: r1i1p1f1, grid: gn, mip: SImon}
      sit:
        <<: *alb_cmip5
        start_year: 1979
        end_year: 1979
        additional_datasets:
          - {dataset: GFDL-CM3,     project: CMIP5, ensemble: r1i1p1, mip: day}
          - {dataset: MPI-ESM1-2-HR,project: CMIP6, ensemble: r1i1p1f1, grid: gn, mip: SImon}
      siconc:
        <<: *alb_cmip5
        start_year: 1979
        end_year: 1979
        additional_datasets:
          - {dataset: GFDL-CM3,     project: CMIP5, ensemble: r1i1p1, mip: day}
          - {dataset: MPI-ESM1-2-HR,project: CMIP6, ensemble: r1i1p1f1, grid: gn, mip: SImon}
      sithick:
        <<: *alb_cmip5
        start_year: 1979
        end_year: 1979
        additional_datasets:
          - {dataset: GFDL-CM3,     project: CMIP5, ensemble: r1i1p1, mip: day}
          - {dataset: MPI-ESM1-2-HR,project: CMIP6, ensemble: r1i1p1f1, grid: gn, mip: SImon}
      tro3:
        <<: *alb_cmip5
      o3:
        <<: *alb_cmip5
    scripts: null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cmor Related to the CMOR standard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SMPI not working on CMIP6 data
4 participants