From cb959e7ffbe867d57a4ef91e49f3436cb27f7f2c Mon Sep 17 00:00:00 2001 From: Joshua Cortez Date: Mon, 2 Sep 2024 12:55:14 +0800 Subject: [PATCH] improve documentation on using off-boundary pixels for fast gridding error correction --- notebooks/00_grids.ipynb | 8 ++++++-- notebooks/15_polygon_fill.ipynb | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/notebooks/00_grids.ipynb b/notebooks/00_grids.ipynb index 134e326..38964a5 100644 --- a/notebooks/00_grids.ipynb +++ b/notebooks/00_grids.ipynb @@ -311,7 +311,9 @@ "This uses these optimizations to speed up grid generation:\n", "\n", "1. Vectorized Translation Functions: Functions that translate between lat,lon and x,y are written in polars.\n", - "2. Voxel Traversal and Scanline Fill Algorithms: Faster alternative to finding all pixels within a polygon without using polygon intersection operations. These are implemented in `polygon_fill.fast_polygon_fill()`" + "2. Voxel Traversal and Scanline Fill Algorithms: Faster alternative to finding all pixels within a polygon without using polygon intersection operations. These are implemented in `polygon_fill.fast_polygon_fill()`\n", + "\n", + "This also does error correction on the polygon boundary using off-boundary pixels. Read more in the [polygon fill module reference](https://geowrangler.thinkingmachin.es/polygon_fill.html)" ] }, { @@ -867,7 +869,9 @@ "This uses these optimizations to speed up grid generation:\n", "\n", "1. Vectorized Translation Functions: Functions that translate between lat,lon and x,y are written in polars.\n", - "2. Voxel Traversal and Scanline Fill Algorithms: Faster alternative to finding all pixels within a polygon without using polygon intersection operations. These are implemented in `polygon_fill.fast_polygon_fill()`" + "2. Voxel Traversal and Scanline Fill Algorithms: Faster alternative to finding all pixels within a polygon without using polygon intersection operations. These are implemented in `polygon_fill.fast_polygon_fill()`\n", + "\n", + "This also does error correction on the polygon boundary using off-boundary pixels. Read more in the [polygon fill module reference](https://geowrangler.thinkingmachin.es/polygon_fill.html)" ] }, { diff --git a/notebooks/15_polygon_fill.ipynb b/notebooks/15_polygon_fill.ipynb index a48206f..c5c02e0 100644 --- a/notebooks/15_polygon_fill.ipynb +++ b/notebooks/15_polygon_fill.ipynb @@ -643,7 +643,8 @@ "source": [ "Notice below that they are the same as the off-diagonal pixels, but filtered to only include pixels on the polygon exterior. We call these off-boundary pixels. These are useful for gridding error correction.\n", "\n", - "We can determine which pixels to add for error correction by intersecting the polygon boundary linestring with the with the off-boundary tiles. The pixels that intersect should be added back. You can find the implementation in the `generate_grid` method under [FastSquareGridGenerator](https://geowrangler.thinkingmachin.es/grids.html#fastsquaregridgenerator) and [FastBingTileGridGenerator](https://geowrangler.thinkingmachin.es/grids.html#fastbingtilegridgenerator)" + "We can't just add all the off-boundary pixels because not all of them actually intersect the polygon in geographic coordinates. We determine which pixels to add for error correction by intersecting the polygon boundary linestring with the off-boundary pixel polygon. Both the linestring and the off-boundary pixel polygon should be in geographic coordinates, not pixel coordinates. The pixels that intersect should be added to the main set of filled pixels. You can find this implementation in the `generate_grid` method under [FastSquareGridGenerator](https://geowrangler.thinkingmachin.es/grids.html#fastsquaregridgenerator) and [FastBingTileGridGenerator](https://geowrangler.thinkingmachin.es/grids.html#fastbingtilegridgenerator)\n", + " - Despite this step relying on geometry intersection, the performance hit should be relatively small since we're doing a linestring to polygon intersection (not a polygon to polygon intersection), and the off-boundary pixels should be a small fraction of the total pixels." ] }, {