isce-framework / isce-framework/isce3
Potential issues with resampling the water mask raster
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 239
- Forks
- 90
- Avg merge
- 13d 1h
- Merged PRs (30d)
- 5
Description
The function _project_water_to_geogrid() in nisar/workflows/geocode_insar.py is used to re-project the input water distance map raster onto the output geo grid and convert it into a binary water mask.
There are couple of potential issues with the implementation that @gshiroma, @nemo794, and I noticed while reviewing a similar implementation in the Static Layers PR:
-
The water distance map is resampled onto the output grid using the "mode" resampling method before converting the distance map to a binary mask. This might be an issue because "mode" resampling is not really appropriate for non-categorical data.
Imagine the case where a small region of the water distance map is 25% water pixels and 75% non-water pixels, but the non-water pixels all have different values. In this case, the "mode" method would consider this region to be water, even though it is actually predominantly non-water.
In order to address this, we should either change the resampling method (e.g. to "near" for nearest-neighbor resampling) or else convert the water distance to a binary mask before re-projected it onto the output grid. The latter option may be undesirable in the case where the input water distance map covers a much larger area than the output geo grid -- in that case, we are doing a lot of unnecessary processing on parts of the water distance map that don't overlap the region of interest.
-
When converting the water distance map to a binary mask, the code doesn't respect the fill value of 255. Invalid pixels (with a value of 255) in the input raster will be treated the same as non-water pixels in the output binary mask.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in nisar/workflows/geocode_insar.py at _project_water_to_geogrid(), then compare the similar implementation discussed in the Static Layers PR. Determine how resampling should handle non-categorical water-distance values and preserve the input fill value of 255; done means the binary output distinguishes invalid pixels correctly and the chosen resampling behavior is covered by validation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100