Skip to content

feat: add Sentinel-1 SAR support and integration tests#7

Open
rfievet wants to merge 1 commit intofeature/copernicus-pr2-s2from
feature/copernicus-pr3-s1
Open

feat: add Sentinel-1 SAR support and integration tests#7
rfievet wants to merge 1 commit intofeature/copernicus-pr2-s2from
feature/copernicus-pr3-s1

Conversation

@rfievet
Copy link
Copy Markdown
Collaborator

@rfievet rfievet commented Jan 19, 2026

Summary

This PR adds Sentinel-1 SAR support to complete the Copernicus Data Space Ecosystem integration. Users can now download and process both optical (S2) and radar (S1) satellite imagery.

Builds on: PR #1 (Core + S2 Basic) and PR #2 (S2 Processing)

What's New

S1 SAR Capabilities

  • Download SAR data: All-weather, day/night radar imagery
  • Polarization filtering: VV, VH, HH, HV modes
  • Orbit filtering: ASCENDING/DESCENDING passes
  • Acquisition modes: IW (default), EW, SM, WV with detailed documentation
  • SAR processing: Extract backscatter composites with dB conversion
  • Visualization: Display SAR imagery with interpretation guides

New Files

  • src/data/copernicus/s1.py - S1 search and download logic
  • tests/test_copernicus_integration.py - Integration tests for S1+S2 workflows
  • scripts/download_test_data.py - Example script for downloading test data

Modified Files

  • src/data/copernicus/client.py - Added fetch_s1() method
  • src/data/copernicus/image_processing.py - Added extract_sar_composite()
  • src/data/copernicus/visualization.py - Added display_sar_image() and create_sar_comparison_plot()
  • src/data/copernicus/__init__.py - Updated exports

Usage Example

from src.data.copernicus import CopernicusClient, extract_sar_composite, display_sar_image

# Download S1 SAR data
client = CopernicusClient()
s1_files = client.fetch_s1(
    bbox=[6.15, 49.11, 6.16, 49.12],
    start_date="2024-01-01",
    end_date="2024-01-31",
    polarization="VV,VH",
    orbit_direction="ASCENDING",
    acquisition_mode="IW"  # Default: 250km coverage, 10m resolution
)

# Extract SAR backscatter
sar_data = extract_sar_composite(s1_files[0], to_db=True)
print(sar_data['polarizations'])  # ['VV', 'VH']

# Visualize
display_sar_image(s1_files[0], polarization='VV')

Why SAR Matters

Sentinel-1 SAR complements Sentinel-2 optical imagery:

  • ✅ Works through clouds and rain
  • ✅ Operates day and night
  • ✅ Measures surface roughness and moisture
  • ✅ Essential for all-weather Earth observation

Testing

All tests pass (48/48):

  • PR1 tests: 18/18 ✅
  • PR2 tests: 19/19 ✅
  • PR3 tests: 11/11 ✅
# Run integration tests (requires test data)
uv run python scripts/download_test_data.py
uv run pytest tests/test_copernicus_integration.py -v

Complete Feature Set

The Copernicus client now supports:

  • ✅ OAuth2 authentication with token refresh
  • ✅ S2 optical imagery (RGB, spectral indices, cloud masking)
  • ✅ S1 SAR imagery (all polarizations, modes, orbits)
  • ✅ Robust download with retry and resume
  • ✅ Caching for efficiency
  • ✅ Memory optimization (bbox cropping)
  • ✅ Comprehensive visualization
  • ✅ Integration tests with real data

- Add S1 product search and download
- Add SAR backscatter extraction
- Add SAR visualization functions
- Add polarization and orbit filtering
- Add acquisition mode support (IW, EW, SM, WV)
- Add integration tests for S1+S2 workflows
- Add example script for downloading test data

This PR completes the Copernicus Data Space Ecosystem integration by adding
Sentinel-1 SAR support alongside the existing Sentinel-2 optical support.

Key features:
- fetch_s1() method in CopernicusClient for SAR data
- extract_sar_composite() for SAR backscatter extraction
- display_sar_image() and create_sar_comparison_plot() for visualization
- Comprehensive integration tests using real downloaded data
- Example script (scripts/download_test_data.py) for test data setup

SAR data complements optical imagery by working day/night and through clouds,
making it valuable for all-weather Earth observation.
@rfievet rfievet marked this pull request as ready for review January 19, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant