Skip to main content

Spatiotemporal Filling and Multistep Smoothing for satellite time series reconstruction

Project description

STMS: Spatiotemporal and Multistep Smoothing for Sentinel-2 Data Reconstruction

STMS is a Python package designed to reconstruct and smooth time-series vegetation index (VI) data, particularly useful in handling cloudy observations in satellite imagery like Sentinel-2.

It performs two main steps:

  1. Spatiotemporal Filling — Uses spatial neighbors and correlation to fill in cloudy or missing data.
  2. Multistep Smoothing — Applies Generalized Additive Models (GAMs) for smoothing over time.

📦 Installation

pip install stms

🔬 Features

  • Handles consecutive cloudy observations
  • Incorporates spatial proximity and temporal correlation
  • Multi-round GAM-based smoothing
  • Easy-to-use API

🧪 Example: Simulated Sentinel-2 Time Series

import numpy as np
from stms import stms

# Simulate vegetation index (VI) using sine function
def sine_func(x, A, B, C, D):
    return A * np.sin(2 * (np.pi / B) * (x - C)) + D

# Time series parameters
A, B, C, D = 0.3, 100, 90, 0.5
x = np.arange(5, 400, 5)
vi = sine_func(x, A, B, C, D) + np.random.uniform(-0.05, 0.05, len(x))
cloud = np.ones_like(vi)

# Add thick cloud contamination
vi[50:60] = np.random.uniform(0.1, 0.2, 10)
cloud[50:60] = 0.01

# Format for STMS
id_sample = np.array(["sample_0"] * len(x))
days_data = x
vi_data = vi.copy()
long_data = np.array([101.5] * len(x))
lati_data = np.array([-2.0] * len(x))
cloud_data = cloud

# Apply STMS
model = stms()
vi_filled = model.spatiotemporal_filling(id_sample, days_data, vi_data, long_data, lati_data, cloud_data)
vi_smoothed = model.multistep_smoothing(id_sample, days_data, vi_filled, cloud_data)

📈 Visual Output (1 Sample)

Original (Cloudy)

Original

After STMS Filling

Filled

Final Smoothed Result

Final


📄 License

MIT License © Bayu Suseno


🤝 Contributing

Feel free to open issues or pull requests! Contributions are welcome.

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

stms-0.2.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

stms-0.2.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file stms-0.2.0.tar.gz.

File metadata

  • Download URL: stms-0.2.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for stms-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e3fc6221979d3eed48c27876986cc7d837e66ab3fec2bc74e28313fe7c02a47c
MD5 6adb0a96aca24f4d608b5bc9f796e57a
BLAKE2b-256 53975f4469e5c191a395a0b78c473c9eef14743ff3def350017544d3343f30c1

See more details on using hashes here.

File details

Details for the file stms-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: stms-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for stms-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d4cc2ec5a8a474be84d077d75c6715efc616876aab202c0f8e6e536bf149eee
MD5 8a254c3659b241cea6964c903d567669
BLAKE2b-256 f635ea0a33dac8c9ae53cd89b60566c36d0be9f3e773390c332aac9a07a07176

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