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

Add plev/altitude conversion to extract_levels #892

Merged
merged 10 commits into from
Dec 10, 2020

Conversation

axel-lauer
Copy link
Contributor

@axel-lauer axel-lauer commented Dec 2, 2020

This pull requests extends the existing preprocessor function extract_levels. The possibility to convert pressure levels (air_pressure) into height (altitude) and vice versa is added. For the conversion, existing code in cmor/_fixes/shared.py is used that uses the US standard atmosphere to convert from height to pressure. A similar function has been implemented to also allow conversion from pressure to height.

Tasks

  • This pull request has a descriptive title that can be used in a changelog
  • 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.

@axel-lauer axel-lauer requested a review from schlunma December 2, 2020 12:59
@axel-lauer axel-lauer requested a review from jvegreg as a code owner December 2, 2020 12:59
@schlunma
Copy link
Contributor

schlunma commented Dec 2, 2020

Is there a specific reason why you don't calculate the altitude bounds?

@axel-lauer
Copy link
Contributor Author

Calculating altitude bounds did not work for the MPI-ESM1-2-LR model (variable clw)...

@schlunma
Copy link
Contributor

schlunma commented Dec 2, 2020

I guess that model also needs a fix similar to MPI-ESM1-2-HR to get correct bounds. Can you maybe add that to #635? I will add an if statement and only add the bounds if possible.

@axel-lauer
Copy link
Contributor Author

@schlunma Sounds good!

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.

Scientific review: Successfully tested the new function on real data (about 20 CMIP6 models) and on synthetic data (see tests) 👍

Technical review: Fine from my side, but since I wrote parts of the code myself maybe @valeriupredoi can have a brief look on the changes?

@axel-lauer I think it would be nice to have one sentence about this functionality in the documentation? And maybe also the docstring of extract_levels?

@axel-lauer
Copy link
Contributor Author

@schlunma good point! I just added some documentation.

@axel-lauer axel-lauer added enhancement New feature or request preprocessor Related to the preprocessor labels Dec 3, 2020
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, apart from the minor technical improvement mentioned in the comment that could be made.

@bouweandela
Copy link
Member

It would also be nice to mention the functionality here: https://docs.esmvaltool.org/projects/esmvalcore/en/latest/recipe/preprocessor.html#vertical-interpolation

@axel-lauer
Copy link
Contributor Author

I thought the information in https://docs.esmvaltool.org/projects/esmvalcore/en/latest/recipe/preprocessor.html#vertical-interpolation is taken from the docstrings. These have been updated accordingly...

@bouweandela
Copy link
Member

@axel-lauer
Copy link
Contributor Author

@bouweandela Thanks for pointing me to the documentation page. I added a brief description of the new functionality.

@axel-lauer axel-lauer merged commit c28786f into master Dec 10, 2020
@axel-lauer axel-lauer deleted the extract_levels_extension branch December 10, 2020 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request preprocessor Related to the preprocessor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants