Skip to content

feat: add S2 image processing and visualization#5

Open
rfievet wants to merge 1 commit intofeature/copernicus-pr1-corefrom
feature/copernicus-pr2-s2
Open

feat: add S2 image processing and visualization#5
rfievet wants to merge 1 commit intofeature/copernicus-pr1-corefrom
feature/copernicus-pr2-s2

Conversation

@rfievet
Copy link
Copy Markdown
Collaborator

@rfievet rfievet commented Jan 17, 2026

Summary

This PR adds image processing, spectral indices, cloud masking, and visualization for Sentinel-2 data. This is the second of 3 PRs to add complete Copernicus support.

Builds on: PR #6 (Core Infrastructure + Basic S2)

What's Included

  • RGB Extraction: Extract RGB composites from S2 ZIP files
  • Spectral Indices: NDVI, NDWI, EVI, SAVI, NBR calculations
  • Cloud Masking: Extract and apply cloud/shadow masks
  • Visualization: Display S2 imagery, coverage maps, comparisons
  • Memory Optimization: Bbox cropping to reduce memory usage by 99%+

New Capabilities

Users can now:

  1. Download S2 data (from PR1)
  2. Extract RGB composites for visualization
  3. Calculate vegetation/water indices
  4. Apply cloud masks for quality control
  5. Create comparison plots and coverage maps
  6. Crop to small areas to save memory

Usage Example

from src.data.copernicus import (
    CopernicusClient,
    extract_rgb_composite,
    calculate_ndvi,
    extract_cloud_mask,
    display_satellite_image
)

# Download S2 data
client = CopernicusClient()
s2_files = client.fetch_s2(
    bbox=[6.15, 49.11, 6.16, 49.12],
    start_date="2024-01-01",
    end_date="2024-01-31",
    max_cloud_cover=20.0
)

# Extract RGB composite with bbox cropping (saves 99%+ memory)
rgb_data = extract_rgb_composite(
    s2_files[0],
    bbox=[6.15, 49.11, 6.16, 49.12]  # Crop to save memory
)

# Calculate NDVI
ndvi = calculate_ndvi(s2_files[0])

# Extract cloud mask (Level-2A products only)
cloud_mask = extract_cloud_mask(s2_files[0])

# Visualize
display_satellite_image(rgb_data)

- Add RGB composite extraction from S2 ZIP files
- Add spectral indices (NDVI, NDWI, EVI, SAVI, NBR)
- Add cloud masking for quality control
- Add visualization functions for S2 imagery
- Add bbox cropping for memory optimization
- Add S2 processing tests

This is PR #2 of 3 for Copernicus support. Builds on PR #1 (core infrastructure).
All tests pass (PR1 + PR2). Ready for review.
@rfievet rfievet marked this pull request as ready for review January 19, 2026 14:59
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