iris icon indicating copy to clipboard operation
iris copied to clipboard

analysis.cartography._quadrant_area() returns 0 for lat bounds over pole

Open trexfeathers opened this issue 4 years ago • 2 comments

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

trexfeathers avatar Nov 27 '19 14:11 trexfeathers

Decision: second bullet point

trexfeathers avatar Jul 06 '22 09:07 trexfeathers

Might actually have been solved by changes to guess_bounds in Iris v2.0?

trexfeathers avatar Jul 06 '22 09:07 trexfeathers

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.

github-actions[bot] avatar Nov 19 '23 00:11 github-actions[bot]

@SciTools/peloton thinks this was probably fixed last year in #3459. If anyone finds this to be incorrect, feel free to reopen this.

ESadek-MO avatar Nov 22 '23 10:11 ESadek-MO