-
Notifications
You must be signed in to change notification settings - Fork 13
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
Decoupling the bounding box from the AOIs #33
Comments
@joshuacortez @jtmiclat |
@joshuacortez Can you clarify and give more instances a custom bounding box would be useful?
For this instance, I think having an optional parameter that skips the intersects would make sense more than a custom bounding box. It would skip this line geowrangler/geowrangler/grids.py Line 77 in 86561e6
So the workflow would be
You can then store grids and reuse them if a new aoi comes along. Rather than regenerating per aoi |
Hmmm, my concern with the proposed workflow though is it forces us to generate grid tiles across the country, which is very memory and time intensive for fine grids. (also discussed in #35 ). The Example use case: |
I still don't fully understand how a custom bounding box would help with the performance improvements but it might help if we have some code for this and #35 |
Ahh having a custom bounding box is more for coordinate system consistency rather than performance per se. I have some sample code but it's from a project in a private repo. How could we best go about this? |
@joshuacortez Feel free to just copy-paste the code sample here! |
Here's sample usage from how I used it before. Functions are defined in this gist Step 1: Get all index pairs (x_idx, y_idx) of cells that intersect the AOIs
Step 2: Convert the index pairs into actual geometries
You could collapse the two steps together (creating the geometries right away instead of an intermediate step of saving the index pairs). But I split them together here to assess the memory usage |
In the
GridGenerator
class here, the overall bounding box (minx, miny, maxx, maxy) are automatically derived from the projected gdf. Perhaps it would be good to make the overall bounding box be an optional parameter. If None, it could automatically compute the bounding box from the gdf, otherwise it uses the user defined bounding box.Having a user defined bounding box is useful in making consistently defined grids. This is useful in cases where our AOIs are not necessarily encompass the entire country. We can define our overall bounding box based on the country admin boundaries, and regardless of what AOI we supply as a gdf input, the x and y coordinates of the grid tiles remain consistent.
The text was updated successfully, but these errors were encountered: