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

Test zonal on geometries with extents that go beyond the raster #817

Merged
merged 5 commits into from
Dec 2, 2024

Conversation

asinghvi17
Copy link
Collaborator

We could probably degrade these tests to rasterize. But IMO it's pretty important to test these edge cases.

If these tests pass, we can enable tiled zonal on pretty much any chunk size, so you could calculate the max elevation on Greenland using a 30-meter cell size DEM like Copernicus, all on your local laptop.

This spawned #816.

@rafaqz
Copy link
Owner

rafaqz commented Nov 13, 2024

Yeah the edge cases are important, but zonal is very abstract and hardly does anything itself.

Its not actually rasterize that matters either, rasterize is a really complicated set of tools for writing a wide range of things into rasters where they intersect geometries in some way or other, using burn_geometry! underneath.

zonal is just mask, which is boolmask, which internally is also burn_geometry!

Probably testing boolmask more is the cleanest thing. But we could aslo just test burn_geometry! directly. But boolmask should return all trues here, so the test is just all.

(although top level intergration tests like zonal are pretty good too really)

@rafaqz rafaqz marked this pull request as ready for review December 1, 2024 23:24
@rafaqz
Copy link
Owner

rafaqz commented Dec 1, 2024

Was an edge search optimization breaking things, guess I slightly misunderstood the space when I wrote it or just made a dumb mistake.

I think this is solved with very little additional overhead, we just need to look for off-grid points early in the scan or we lose the start line and don't know we are inside a polygon. Tracking the minimum possible y position does that.

Hopefully there is nothing this bad left around.

(also moved your test to mask as the problem is easier to see there)

@rafaqz rafaqz merged commit 2ac6caf into main Dec 2, 2024
0 of 3 checks passed
@rafaqz rafaqz deleted the as/zonal_weird_geoms branch December 2, 2024 00:23
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