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
Compute volume from cell_area
if available
#2318
Compute volume from cell_area
if available
#2318
Conversation
Codecov ReportAll modified and coverable lines are covered by tests β
Additional details and impacted files@@ Coverage Diff @@
## main #2318 +/- ##
==========================================
+ Coverage 94.10% 94.11% +0.01%
==========================================
Files 246 246
Lines 13477 13494 +17
==========================================
+ Hits 12682 12700 +18
+ Misses 795 794 -1 β View full report in Codecov by Sentry. |
Thanks for the PR! I am not quite sure what's causing the error here. How are you running the tests? For me, a |
Thanks @schlunma Yes, I am doing a
This both options gave me the error from above:
I don't know where the problem can come from. I have another conda environment with pytest for another library and it works fine. So, it could be related to the specific configuration of ESMValCore tests; maybe I did something wrong? I will try to reinstall the environment and go deeper if it doesn't work when I have more time. I was asking in case the error was familiar to you. |
Ah, your first error actually looks familiar: #2314 This has been fixed, but requires setting up a new environemt. Sorry, this is really unlucky timing. |
Thanks, I will then create the new environment and try to add new tests |
Hi @schlunma I am still working on this, here are some updates with the last commit:
I have tested running volume_statistics over regular data with no areacello and with irregular data with areacello and seems to run fine. I still have to include the test and correct the ones that failed that were related to the condition of |
75f2bc4
to
778d0eb
Compare
Fixed tests and added new ones, I made some new error messages for the following cases:
Still missing test when cell_measure is available and when have to guess bounds of z. I will add them the following days. |
e1a9485
to
b25fca6
Compare
Hi @schlunma, This is ready to merge by my side |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for these change @enekomartinmartinez, looks really good already!
I have a couple of comments directly on the code.
In addition, it would be great if you could make sure that areacello
is loaded automatically if no supplementary is specified (this will not raise an error if that is not found). You can do that by adding it to the decorator here. Also, please make sure the documentation is up-to-date (i.e., here and here).
Thanks!!
Thank you @schlunma for so many comments and suggestions, I will be accepting the changes and answering them one by one! |
Co-authored-by: Manuel Schlund <32543114+schlunma@users.noreply.github.com>
ddc4854
to
0c91225
Compare
Co-authored-by: Manuel Schlund <32543114+schlunma@users.noreply.github.com>
835b81e
to
08ccca3
Compare
Co-authored-by: Manuel Schlund <32543114+schlunma@users.noreply.github.com>
08ccca3
to
4dfbf78
Compare
I am working in this other suggestions, I still have few questions. Should I register as well Shouldn't we check in |
Good point. The function has clearly been designed for ocean data, but it would of course be nice to also support atmospheric variables. However, to properly support this we would probably need to consider pressure levels in addition to altitudes. Let's do that in a separate PR.
Also good point! You could also return the multiplied units of the area and z dimension in |
Register areacello for volume_statistics and update docs
β¦z/ESMValCore into volume_from_cell_area
I cannot currently work on further development. I don't know if this is a requirement but there may be people already using the preprocessor with atmospheric data as it may not fail and use the thickness of pressure_levels automatically. Should this be considered risky?
My question is should we allow using things like |
I am not saying you need to do this π If you think adding
Ah, I didn't consider sigma space. If the units can be converted to |
Hi @schlunma I have added a conversion of depth units to meters in About adding |
8cf5ac5
to
a44c193
Compare
a44c193
to
700bdd1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @enekomartinmartinez for these changes! I have one remaining comment about not changing the input cube in-place, then I will approve. Thanks for your patience!!
Co-authored-by: Manuel Schlund <32543114+schlunma@users.noreply.github.com>
a7cb05c
to
d2a8cb9
Compare
Hi @schlunma Thanks for the suggestions. I have accepted them and removed the change of units as when doing the copy is unnecessary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Thanks for your contribution π
cell_area
if available
Description
This PR uses _try_adding_calculated_cell_area in calculate_volume, so the volume can be computed from
cell_area
if available in the cube. This opens the possibility of working withvolume_statistics
in irregular grids withareacello
but notvolcello
.Closes #2310
Link to documentation:
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.
Note
I have tried to run tests locally so I can develop a new test but I am having some issues. After installing the environment.yml with conda (
conda env create -f environment.yml
) and ESMValCore in developer mode with pip (pip install -e .
), I am having the following error message when trying to run the tests:To help with the number pull requests:
@schlunma