Skip to main content

A Python library to convert, resample, and harmonize satellite imagery across different sources.

Project description

📦 MultiSat: A Python Library for Multi-Satellite Image Processing

multisat is a lightweight and easy-to-use Python library designed to streamline satellite image preprocessing, harmonization, and analysis from various sources like Landsat and Sentinel. This library is useful for research and projects involving climate modeling, disaster prediction, remote sensing, or any geospatial analysis.

Download Documentation


🚀 Features

  • 📂 Format Detection: Automatically detects input formats: JP2, HDF, GeoTIFF, SAFE.
  • 🔁 Conversion Tools: Convert Sentinel .jp2, .SAFE, and HDF/NetCDF to GeoTIFF.
  • 🧱 Band Stacking: Stack multiple single-band images into a multi-band image.
  • 🧽 Normalization: Normalize image pixel values to [0,1] or [0,255].
  • 🎨 Histogram Matching: Harmonize intensity profiles across satellites.
  • 📐 Resolution Resampling: Resample to common spatial resolution.
  • 🌥️ Cloud Masking: Apply basic brightness-based cloud masks.
  • 📊 Image Utilities: Visualize, extract metadata, NDVI, and band stats.

📦 Installation

Before using multisat, make sure you have the following dependencies installed:

pip install rasterio numpy scikit-image matplotlib

You also need GDAL installed correctly:

pip install path/to/GDAL‑3.7.3‑cp39‑cp39‑win_amd64.whl

Then install this library:

pip install multisat

If installing locally:

pip install -e .

🧠 Modules & Functions

1. converter.py

  • get_format(file_path)

    Returns the file type: JP2, HDF, GeoTIFF, or SAFE.

  • convert_jp2_to_geotiff(input, output)

    Converts .jp2 images to .tif.

  • convert_hdf_to_geotiff(input, output_dir)

    Converts HDF/NetCDF subdatasets to individual .tif bands.

  • extract_safe_bands(safe_path, out_dir, band_ids=["B02", "B03", "B04"])

    Extracts desired bands (e.g., RGB, NIR) from Sentinel .SAFE.

  • convert_any_to_geotiff(input, output_dir)

    Automatically detects format and converts to .tif.

  • stack_bands([b1, b2, b3], output)

    Stacks single-band TIFFs into one multi-band TIFF.

2. harmonizer.py

  • normalize_image(img, out, mode="0-1")

    Normalize pixel values to [0,1] or [0,255].

  • match_histogram(src, ref, out)

    Adjust pixel distribution of src to match ref.

  • harmonize_bands(img, type, out)

    Reorders bands for Sentinel/Landsat to standard RGB.

  • apply_basic_cloud_mask(img, out, threshold=200)

    Masks bright regions (clouds) using thresholding.

3. resampler.py

  • match_resolution(input, output, target_resolution, method="bilinear")

    Resamples image to a fixed spatial resolution.

  • resample_to_match(source, ref, output)

    Resamples source image to match resolution of ref image.

4. utils.py

  • get_image_metadata(img)

    Returns dictionary of CRS, bounds, resolution, size, etc.

  • detect_satellite_type(img)

    Guesses if image is Sentinel/Landsat based on bands/res.

  • plot_bands(img, bands=[1,2,3], title="", stretch=True)

    Displays an image using selected bands (RGB default).

  • calculate_ndvi(img, red=3, nir=4, out=None)

    Returns or saves NDVI image using red/NIR bands.

  • print_band_stats(img)

    Prints min, max, mean, std for each band.


📚 Example Usage

from multisat.converter import convert_any_to_geotiff, stack_bands
from multisat.harmonizer import normalize_image, apply_basic_cloud_mask
from multisat.resampler import match_resolution
from multisat.utils import plot_bands, calculate_ndvi

# Convert input
converted = convert_any_to_geotiff("data/S2.SAFE", "output")
stacked_path = "output/stacked.tif"
stack_bands(converted, stacked_path)

# Normalize
normalize_image(stacked_path, "output/norm.tif")

# Apply cloud mask
apply_basic_cloud_mask("output/norm.tif", "output/cloudmasked.tif")

# Visualize
plot_bands("output/cloudmasked.tif", title="Cloud Masked RGB")

# Compute NDVI
ndvi = calculate_ndvi("output/stacked.tif", red_band=3, nir_band=4, output_path="output/ndvi.tif")

📁 Folder Structure

multisat/
  converter.py
  harmonizer.py
  resampler.py
  utils.py
setup.py
README.md
LICENSE

🧱 Dependencies

  • rasterio
  • numpy
  • matplotlib
  • GDAL
  • scikit-image
  • glob
  • os

📜 License

This project is licensed under the MIT License. You are free to use, modify, and distribute this software.


🤝 Contributions

Pull requests, feature suggestions, and improvements are welcome. Make sure to follow best practices and test your code!


👤 Author

Developed by Sujal Bandodkar as part of a satellite image fusion and harmonization project for AI-based climate and disaster modeling.


🔗 Related Projects / Future Scope

  • Integration with Google Earth Engine
  • Automatic download using USGS/Copernicus APIs
  • Real-time preprocessing pipelines
  • Deep learning ready patch exporters

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

multisat-1.0.1.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

multisat-1.0.1-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file multisat-1.0.1.tar.gz.

File metadata

  • Download URL: multisat-1.0.1.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for multisat-1.0.1.tar.gz
Algorithm Hash digest
SHA256 6fd49fc1c2e29deac5a718b3e58a5b7942c4d671c1e06851cc00befb078c74f6
MD5 2b46619d767a0985ace59286ddcfe4d4
BLAKE2b-256 7dbe6e50ec1f56c499a15d049b8d6824e1b063b6aca89b50be8365aeede71b0f

See more details on using hashes here.

File details

Details for the file multisat-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: multisat-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for multisat-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 18a6d04a914cab072c59189c704ab806f1e38c03498ad3707cad63503eb72db9
MD5 f9c88f6c3acd2fa30bc560feb3bb4dd1
BLAKE2b-256 248b45d6e32d340a3fea5e7c98858d0231139963d1669a076cab729d68af32ca

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