Add noise handling: SAR speckle filters, cloud masking, gap filling

Open
#1,146 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python
Domain
data

Research direction

Start by reading the existing focal operations such as mean() and the map_overlap infrastructure, then narrow the proposal to the SAR speckle filters, which the issue identifies as the most self-contained piece. Done should mean a scoped preprocessing component is implemented consistently with those existing focal-operation patterns; the broader cloud-masking and spatial or temporal gap-filling work should be treated as separate follow-ups.

Written by the indexing model from the issue text.

Description

after-1.0.0-release enhancement

Problem

Working with real satellite imagery means dealing with noise, clouds, and data gaps before you can do any actual analysis. These preprocessing steps are currently left entirely to the user, even though the underlying operations (focal statistics, mask interpretation, interpolation) are things xarray-spatial already knows how to do.

Proposed scope

SAR speckle filters
Lee, Frost, and Gamma MAP filters for radar imagery. These are focal operations that use adaptive weighting based on local statistics (local mean, variance, number of looks). They fit naturally into the existing map_overlap infrastructure since they operate on moving windows, just like the current focal functions.

Cloud masking utilities
Interpret QA/SCL bands from Sentinel-2 and Landsat to produce clean binary masks. The band encoding differs between sensors and even between collection versions (Landsat 8 vs 9, Sentinel-2 L1C vs L2A), so having a single function that handles the lookup table for each sensor saves users from repeatedly consulting documentation.

Spatial gap filling
Fill masked pixels using focal interpolation from surrounding valid pixels. Inverse-distance weighting within a configurable search radius is the standard approach. This is useful after cloud masking or for filling no-data areas along swath edges.

Temporal gap filling
For time-stacked rasters, interpolate through time at each pixel location to fill cloud-masked dates. Linear interpolation is the baseline; optional smoothing (Savitzky-Golay or similar) handles cases where multiple consecutive dates are missing.

Implementation notes

  • SAR filters are the most self-contained piece and could be a good starting point. They're structurally similar to existing focal operations like mean() but with adaptive weighting, so the implementation pattern is already established.
  • Cloud masking is mostly lookup table work and doesn't involve heavy computation, but it has ongoing maintenance cost as sensor formats evolve.
  • Gap filling (both spatial and temporal) depends on having a mask, so it pairs naturally with the cloud masking work.
Dominant language
Python
Stars
972
Forks
92
Avg merge
2d 12h
Merged PRs (30d)
7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from xarray-contrib/xarray-spatial

All issues in xarray-contrib/xarray-spatial

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.