Skip to main content

Sensor emulation and harmonization for Earth Observation (Sentinel-2 → Landsat MSS).

Project description

🛰️ SatHarmony

Sensor emulation and harmonization for Earth Observation.

PyPI Python License

SatHarmony provides physically-based sensor emulation to create synthetic historical satellite imagery from modern sensors. Currently supports Sentinel-2 → Landsat MSS emulation with realistic degradation modeling.

Installation

pip install satharmony

# With GeoTIFF I/O support
pip install satharmony[io]

Quick Start

import numpy as np
import satharmony

# Load your Sentinel-2 image (C, H, W) and CloudSEN12 labels (H, W)
s2_image = ...      # shape: (13, 512, 512), float32, [0, 1]
s2_labels = ...     # shape: (512, 512), uint8, classes 0-3

# Emulate both together (recommended - guarantees matching dimensions)
mss, mss_labels, scale_factor = satharmony.emulate_s2_with_labels(
    s2_image, s2_labels, seed=42
)
# mss.shape:        (4, 73, 73)
# mss_labels.shape: (73, 73)

# Or emulate separately (must pass scale_factor to labels)
mss, sf = satharmony.emulate_s2(s2_image, seed=42)
mss_labels = satharmony.emulate_labels(s2_labels, scale_factor=sf)

Features

The MSS emulator applies physically-motivated degradations:

Degradation Description
Spectral Band selection (B3, B4, B7, B8 → MSS 4 bands)
Spatial PSF convolution + downsampling (10m → 60-80m)
Radiometric 6-bit quantization, sqrt compression, saturation
Striping 6-detector gain/offset mismatch artifacts
Memory Effect Bright target recovery trailing
Noise Coherent (periodic) + random (gaussian/poisson)
Scan Artifacts Line dropouts and transmission errors

API Reference

# Combined emulation (recommended)
mss, labels, sf = satharmony.emulate_s2_with_labels(image, labels, seed=42)

# Independent emulation
mss, sf = satharmony.emulate_s2(image, seed=42)
mss, sf = satharmony.emulate_s2(image, scale_factor=8)  # fixed scale
labels = satharmony.emulate_labels(labels, scale_factor=sf)

# Low-level access
from satharmony import MSSEmulator, PipelineConfig

config = PipelineConfig()
config.spatial.target_gsd.min = 60.0
config.spatial.target_gsd.max = 60.0  # fixed 60m

emulator = MSSEmulator(config)
mss = emulator(image)

Label Aggregation

CloudSEN12 labels (10m) are aggregated using conservative criteria from Roy et al.:

  • Precedence: cloud > shadow > thin_cloud > clear
  • Classes: 0=clear, 1=thin_cloud, 2=cloud, 3=shadow

Citation

@software{satharmony2025,
  author  = {Contreras, Julio},
  title   = {SatHarmony: Sensor Emulation for Earth Observation},
  year    = {2025},
  url     = {https://github.com/IPL-UV/satharmony}
}

License

MIT License - see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

satharmony-0.1.2.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

satharmony-0.1.2-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file satharmony-0.1.2.tar.gz.

File metadata

  • Download URL: satharmony-0.1.2.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.14.0-24-generic

File hashes

Hashes for satharmony-0.1.2.tar.gz
Algorithm Hash digest
SHA256 839097b6d0b6deb5cb6137cef414aca032c4e4711f4c367054d681aaf94ef290
MD5 cb40b9de1530ef947633d3d3c31becae
BLAKE2b-256 b3649091b6d44da1fa9b3f31794903ac891412a44d9733e656dfffb8ed01ace2

See more details on using hashes here.

File details

Details for the file satharmony-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: satharmony-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.14.0-24-generic

File hashes

Hashes for satharmony-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7c0c3c049669d24449e223335d31e21dbe49a58b0aac3b781ea7998b0357c01c
MD5 941c8b187ef1173cd0e5c32c08e652ff
BLAKE2b-256 2008be1e820609c5ea35157d222661f54bcb736f54614558c42e6aa96000845b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page