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 preprocessor to extract surface values from 3D atmospheric variables #2641

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

jlenh
Copy link

@jlenh jlenh commented Jan 21, 2025

Description

This pull request introduces a new preprocessor function to extract the surface values from 3D atmospheric variables and corresponding surface pressure ps. The preprocessor function is largely based on the implementation done for the derivation of surface CO2 co2s at https://github.com/ESMValGroup/ESMValCore/blob/main/esmvalcore/preprocessor/_derive/co2s.py. It thus avoids having to create either at standalone _derive preprocessor or a new entry in the relevant CMOR tables. The attributes of the 3D atmospheric variables are transferred to the newly created cube and the variable name is changed to f'{var_name}s'.

Closes #2611


Before you get started

Checklist

It is the responsibility of the author to make sure the pull request is ready to review. The icons indicate whether the item will be subject to the 🛠 Technical or 🧪 Scientific review.


To help with the number pull requests:

@jlenh jlenh self-assigned this Jan 21, 2025
@jlenh jlenh added enhancement New feature or request preprocessor Related to the preprocessor variable derivation Related to variable derivation functions labels Jan 21, 2025
@jlenh
Copy link
Author

jlenh commented Jan 21, 2025

@bouweandela if you could point me to where in the documentation I should add relevant information ? Thanks 🙂

@bouweandela
Copy link
Member

@bouweandela if you could point me to where in the documentation I should add relevant information

In this file, please: https://github.com/ESMValGroup/ESMValCore/blob/main/doc/recipe/preprocessor.rst

You can find this, and much more useful information on contributing, under the links in the checklist above and in our contribution guidelines: https://docs.esmvaltool.org/projects/ESMValCore/en/latest/contributing.html

@bouweandela
Copy link
Member

Here is an interesting example of doing something similar for ocean data: https://cosima-recipes.readthedocs.io/en/latest/Recipes/Extract_Variables_at_Ocean_Bottom.html

I guess the ocean equivalent of ps would be pbo.

Copy link

codecov bot commented Feb 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.94%. Comparing base (65c7b28) to head (535fd07).
Report is 43 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2641      +/-   ##
==========================================
+ Coverage   94.92%   94.94%   +0.02%     
==========================================
  Files         252      252              
  Lines       14593    14652      +59     
==========================================
+ Hits        13853    13912      +59     
  Misses        740      740              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jlenh
Copy link
Author

jlenh commented Feb 11, 2025

@bouweandela I think I managed to update the code accordingly with the call to extract_levels alongside adding tests for the new functions and error handling.
I am not sure how to go for solving the conflicts for the merging though (relatively large changes for add_ancillary_variable in _supplementary_vars.py, only some import statements for _volume.py)

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 variable derivation Related to variable derivation functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add derivation of surface concentrations for additional trace gases (CH4 and N2O)
2 participants