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.
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 gety = (lat+90)/cellsize = (lat+90)*2 > 180
and similarlyx = (lon+180)/cellsize = (lon+180)*2 > 360
, and due to clipping they all will be assignedy = 180
andx = 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.