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

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

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

All modified and coverable lines are covered by tests ✅

Project coverage is 94.65%. Comparing base (c792a52) to head (41f6562).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2574      +/-   ##
==========================================
- Coverage   94.66%   94.65%   -0.01%     
==========================================
  Files         251      251              
  Lines       14286    14288       +2     
==========================================
+ Hits        13524    13525       +1     
- Misses        762      763       +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 😁

@@ -286,3 +287,80 @@ def fix_metadata(self, cubes):
if z_coord.standard_name is None:
fix_ocean_depth_coord(cube)
return cubes


class Tasmin(Tas):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
class Tasmin(Tas):
class Tasmin(Fix):

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the base class should be Fix here

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.

Suggested change
Fix.get_fixes("CMIP6", "NCAR", "day", "tasmin"),
Fix.get_fixes("CMIP6", "CESM2", "day", "tasmin"),

"""Test fix get."""
self.assertListEqual(
Fix.get_fixes("CMIP6", "NCAR", "day", "tasmin"),
[Tasmin(None)],
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
[Tasmin(None)],
[Tasmin(None), GenericFix(None)],

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.

Suggested change
Fix.get_fixes("CMIP6", "NCAR", "day", "tasmin"),
Fix.get_fixes("CMIP6", "CESM2-WACCM", "day", "tasmin"),

"""Test fix get."""
self.assertListEqual(
Fix.get_fixes("CMIP6", "NCAR", "day", "tasmin"),
[Tasmin(None)],
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
[Tasmin(None)],
[Tasmin(None), GenericFix(None)],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants