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

Missing 2m height coordinate and monotonicity for tasmin in CESM2 and CESM2-WACCM #2574

Merged
merged 21 commits into from
Nov 29, 2024

Conversation

Karen-A-Garcia
Copy link
Contributor

@Karen-A-Garcia Karen-A-Garcia commented Nov 8, 2024

This is a follow up to issue #2573 for the height coordinates. Still looking into the time issue. There was already a fix for the 2m height previously done for tas and I simply applied the fix to tasmin in both CESM2 and CESM2-WACCM files. There were already tests written for the fixes so I didn't add anything to those files.

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.

Copy link

codecov bot commented Nov 8, 2024

Codecov Report

Attention: Patch coverage is 97.18310% with 2 lines in your changes missing coverage. Please review.

Project coverage is 94.68%. Comparing base (1cf3862) to head (c0e5236).
Report is 52 commits behind head on main.

Files with missing lines Patch % Lines
esmvalcore/cmor/_fixes/cmip6/cesm2.py 96.72% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2574      +/-   ##
==========================================
+ Coverage   94.66%   94.68%   +0.01%     
==========================================
  Files         251      251              
  Lines       14302    14372      +70     
==========================================
+ Hits        13539    13608      +69     
- Misses        763      764       +1     

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

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.

looks good, many thanks! Would you mind running pre-commit before hand please? Also, will approve and merge if you don't want to plug in the monotonicity fix here as well 🍺

@Karen-A-Garcia Karen-A-Garcia changed the title Missing 2m height coordinate for tasmin in CESM2 and CESM2-WACCM Missing 2m height coordinate and monotonicity for tasmin in CESM2 and CESM2-WACCM Nov 12, 2024
@Karen-A-Garcia
Copy link
Contributor Author

Thanks @valeriupredoi and thanks for showing me a similar fix for the monotonicity too. I've added a fix for the monotonicity as well as adding tests for them and I ran pre-commit before sending pushing the changes. Let me know if there's anything else I need to change.

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.

many thanks @Karen-A-Garcia 🍺 A few wiggles to fix (am not 100% sure of the baseclass for Tasmin for CESM2, I think it should be a generic Fix class there, doesn't really matter that much). One general comment related to testing: it's great that you added tests, this is always a good thing to see from users, but wrt the testing framework, I'd suggest using the Pytest test classes/functions, and not use Unittest test classes anymore - these are old school and a tad harder to adapt inside a Pytest testing framework, plus, they need a lot more indentation 😁

esmvalcore/cmor/_fixes/cmip6/cesm2.py Outdated Show resolved Hide resolved
tests/integration/cmor/_fixes/cmip6/test_cesm2.py Outdated Show resolved Hide resolved
tests/integration/cmor/_fixes/cmip6/test_cesm2.py Outdated Show resolved Hide resolved
tests/integration/cmor/_fixes/cmip6/test_cesm2_waccm.py Outdated Show resolved Hide resolved
tests/integration/cmor/_fixes/cmip6/test_cesm2_waccm.py Outdated Show resolved Hide resolved
@Karen-A-Garcia
Copy link
Contributor Author

Karen-A-Garcia commented Nov 26, 2024

Thank you @valeriupredoi for looking over my code.🍺 I've changed all the old test formats and changed them so that they run with pytest. I had no issues on my end with the tests when I ran them in my terminal but let me know if there's anything else I need to change. Also looks like CESM2-FV2 and CESM2-WACCM-FV2 had some monotonicity issue so I've import changes to Tas and Pr made in CESM2 into those files. There was also one test that failed from some code that was already in the file and I couldn't really figure out how to fix it so I left it as it was.

def test_get(self):
"""Test fix get."""
self.assertListEqual(
Fix.get_fixes("CMIP6", "NCAR", "day", "tasmin"),
Copy link
Contributor

Choose a reason for hiding this comment

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

hi @Karen-A-Garcia - these tests have not been corrected: they are still in UnitTest format, but a bit more critical, are not testing for the correct model, and also have issues with the actual tested outcome vs expected, could you please have another look at them? My code suggestion change appears to have been resolved, but the model is still wrong: you should test for CESM2-WACCM, not NCAR. Perhaps you forgot to push the changes? 🍺

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh that is so strange because it was changed on my files when I pushed them and they seemed to not have change for some reason. I'll try to fix that.

Copy link
Contributor

Choose a reason for hiding this comment

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

No worries at all! I was suspecting it's a push issue. If it's too much trouble to convert the tests to simple pytest funcs, don't worry about it, it's great you plopped tests in anyways. Let me know if I can help in any way 👍🍺

@valeriupredoi
Copy link
Contributor

many thanks @Karen-A-Garcia ! There are still some issues, unfortunately, please see the failed tests, and my comment above, perhaps you forgot to push to remote? Cheers! PS: I turned on Github Actions tests, since it's a lot easier to see test fails there than on CircleCI, see eg test run output

@Karen-A-Garcia
Copy link
Contributor Author

@valeriupredoi Okay I think I've changed all the UnitTest formats into pytest now and the failed tests are coming from that code that I was previously talking about that was failing when I ran it in my terminal as well.

@valeriupredoi
Copy link
Contributor

excellent work @Karen-A-Garcia - many thanks! All spiffy now: the issue was that the Tas() fix was returning both the original cubes and the newly fixed cubes in the new_cubes iris CubeList(), and that the test was comparing a Python list with an iris CubeList() construct. Fixed that and it's ready to be merged when all tests pass 🍺

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.

very many thanks @Karen-A-Garcia 🍻

@valeriupredoi valeriupredoi merged commit 8b4a63a into main Nov 29, 2024
5 of 7 checks passed
@valeriupredoi valeriupredoi deleted the fixes_ssp245 branch November 29, 2024 16:07
@Karen-A-Garcia Karen-A-Garcia mentioned this pull request Dec 2, 2024
9 tasks
@sloosvel sloosvel added the fix for dataset Related to dataset-specific fix files label Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix for dataset Related to dataset-specific fix files
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

4 participants