Not super happy with this, but the tests pass and it does what we need to do.
Found some differences in behavior between sf and stars where stars switches to 0-360 lat/lon when data crosses the date line. So I convert the geometry to the same when the cell geometry has to be created in that projection. Still need to test this out for the area weighted stuff -- but it should be OK as long as the geometry gets handled right.
Not going to merge just yet as further work is required to make sure the area intersection will work under this strategy.
Not super happy with this, but the tests pass and it does what we need to do.
Found some differences in behavior between
sf
andstars
wherestars
switches to 0-360 lat/lon when data crosses the date line. So I convert the geometry to the same when the cell geometry has to be created in that projection. Still need to test this out for the area weighted stuff -- but it should be OK as long as the geometry gets handled right.Not going to merge just yet as further work is required to make sure the area intersection will work under this strategy.