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

Remove clipping from lonlat2cell #77

Merged
merged 1 commit into from
Nov 11, 2022
Merged

Conversation

s-scherrer
Copy link
Collaborator

When using the current implementation of lonlat2cell with cellsize < 1, the clipping messes up cells, because everything in the upper right corner of the map is mapped to the same cell.

For example, with cellsize=0.5 all points with lat>0 and lon>0, we will get y = (lat+90)/cellsize = (lat+90)*2 > 180 and similarly x = (lon+180)/cellsize = (lon+180)*2 > 360, and due to clipping they all will be assigned y = 180 and x = 360.

When using cellsize >= 1, clipping is only necessary if latitude and longitude are not in (-90, 90) and (-180, 180), respectively, but this is already enforced in the BasicGrid init, so it shouldn't be necessary here.

Therefore I think it's safe to remove the clipping here.

When using the current implementation of `lonlat2cell` with cellsize < 1, the clipping leads to very large cells. For example, with `cellsize=0.5` all points with lat>0 and lon>0 will be mapped to the same cell, because in this case `(lat+90)/cellsize = (lat+90)*2 > 180` and similarly `(lon+180)/cellsize = (lon+180)*2 > 360`.
When using cellsize >= 1, clipping is only necessary if latitude and longitude are not in (-90, 90) and (-180, 180), respectively, but this is already enforced in the BasicGrid init, so it shouldn't be necessary here.
@wpreimes wpreimes merged commit 9e4ccfb into TUW-GEO:master Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants