iris
iris copied to clipboard
analysis.cartography._quadrant_area() returns 0 for lat bounds over pole
If latitude bounds sit equidistant either side of a pole (observed example: [-90.27778, -89.72222]), analysis.cartography._quadrant_area()
will erroneously return 0 for the area. This is because the calculation for distance between the latitude bounds includes a sine transformation, and values equally straddling the pole will have identical sine values - a difference of 0.
Latitude values beyond the pole are impossible, and so we should never really have this problem (there should be no duplicate sine values). But it is common for latitude values to be exactly at the pole, and automatically calculated bounds are therefore likely to sit either side and could produce this situation - I was able to produce the same error using guess_bounds()
on polar latitude points.
So we may therefore want to protect against this incorrect output. Two possible fixes:
- Prevent latitude bounds beyond the pole throughout Iris Big change with likely unforeseen consequences
- Fix
_quadrant_area()
to guard against this particular case Could result in inconsistent behavior compared to other functions
Decision: second bullet point
Might actually have been solved by changes to guess_bounds
in Iris v2.0
?
In order to maintain a backlog of relevant issues, we automatically label them as stale after 500 days of inactivity.
If this issue is still important to you, then please comment on this issue and the stale label will be removed.
Otherwise this issue will be automatically closed in 28 days time.
@SciTools/peloton thinks this was probably fixed last year in #3459. If anyone finds this to be incorrect, feel free to reopen this.