warn if calculate_total_face_area() too large; add FESOM areas regression test - #1649
Open
Sevans711 wants to merge 2 commits into
Open
warn if calculate_total_face_area() too large; add FESOM areas regression test#1649Sevans711 wants to merge 2 commits into
Sevans711 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #425
Overview
As discussed in thread in #425, the issue initially reported there has since been fixed by other changes. This PR adds a regression test (ensuring the total area for this FESOM grid is close to ~8.38 sr).
It also adds a warning to
calculate_total_face_areas()if the result is larger than the total area of the sphere, to avoid silently returning wrong answers on malformed grids. It also updates the docstring for that function to clarify the warning might be raised.Finally, a slight addition beyond just solving 425: updates the
calculate_total_face_areas()docstring to clarify the actual behavior: it is not actually always equivalent tocompute_face_areas().sum(). Specifically, for HEALPix grids, when using default values for all arguments, it is equivalent toface_areas.sum()(which respects HEALPix equal areas) instead.Did not add any CI tests for this warning… please let me know if you think a regression test is necessary for it. Tested locally by temporarily locally adding
result = result * 1.5near the end ofcalculate_total_face_areas(), to ensure bad results actually lead to raising warning and failing FESOM area regression test.PR Checklist
General
Testing & Benchmarking
Documentation
docs/api.rst_)