Closed aaime closed 2 days ago
The same issue happens with other cells, e.g., "R88888"
I'll chase this, it seems to work at higher resolutions and then bails when the fifth level is reached. This may be related to something that Matt mentioned that his team fixed in the GA's version, so I'll check what they did in their repo.
Yes. This is the same issue identified in AusPIX. It appears to be due to a projection issue at the boundary between the equatorial and polar cells (where the equal area projection switches). I've tested this at multiple resolutions (down to level 15) and the error occurs only in the northern most vertices (for the south polar cell) and the southern most vertices (for the north polar cell).
The work around for this bug that was implemented by GA is as follows:
NB: This is not a proper fix for the issue - merely a work around.
A proper fix will require an examination of the polar projection algorithm used by rHealPIX and determine why it is getting an "out of bounds" error when converting from planar (cube face) coordinates to global (lon/lat) coordinates. It could be a boundary computation issue, which might be solved by extending the projection boundary slightly. But the work hasn't been done yet.
Cheers, Matt.
I can confirm those two cells compute properly now. But only after the source code is updated as described in https://github.com/manaakiwhenua/rhealpixdggs-py/issues/10
Sample given currently results in:
>>> from rhealpixdggs import dggs, ellipsoids
>>> from rhealpixdggs.ellipsoids import Ellipsoid
>>> from rhealpixdggs.dggs import RHEALPixDGGS, Cell
>>> WGS84_TB16 = Ellipsoid(a=6378137.0, b=6356752.314140356, e=0.0578063088401, f=0.003352810681182, lon_0=-131.25)
>>> dggs = RHEALPixDGGS(ellipsoid=WGS84_TB16, north_square=0, south_square=0, N_side=3)
>>> cell = dggs.cell(('Q', 6, 6, 6, 6, 6))
>>> print(*cell.vertices(False))
(np.float64(-131.25), np.float64(-41.51722626942552)) (np.float64(-130.87962962962962), np.float64(-41.51722626942552)) (np.float64(-130.87962962962965), np.float64(-41.937853910786615)) (np.float64(-131.25), np.float64(-41.937853910786615))
The following simple test script fails with an error:
resulting in:
Hope I have the right version of rHEALPix, installed it using:
sudo pip3 install --upgrade rhealpixdggs
and then run the test script using python3.