Edge Trimming¶
Resampling can leave invalid border artifacts around nodata regions. Edge trimming is an optional cleanup step that detects invalid pixels and expands those invalid regions by a configurable number of pixels.
Use edge trimming when the aligned output contains narrow border artifacts near nodata areas. It is not a replacement for registration; it only modifies output pixels after alignment.
Trim During Alignment¶
Add --trim-edge-invalid to run cleanup after the coregistered output is written:
1 2 3 4 5 6 7 8 | |
Python:
1 2 3 4 5 6 7 8 9 10 11 | |
Trim An Existing Raster¶
The standalone trim command can be used after alignment:
1 2 3 4 5 | |
Python:
1 2 3 4 5 6 7 8 9 10 | |
Invalid Pixel Criteria¶
The trim pass identifies invalid pixels from:
- the raster nodata value
invalid_belowinvalid_above
Thresholds are useful when interpolation artifacts are not exactly equal to the raster's nodata value. For example, --invalid-below -3000 treats all values at or below -3000 as invalid while building the trim mask.
Detection Band¶
By default, edge artifacts are detected from band index 0. Select another band when invalid artifacts are more visible elsewhere:
1 2 3 4 5 | |
The resulting trim mask is applied to all bands.
In-place Updates¶
The standalone tool can modify an input raster in place:
1 2 3 4 | |
Use in-place updates only when the input raster can be overwritten.