Skip to main content

fundayao

A Python library for processing remote sensing imagery, developed for educational use in courses on the basic principles of remote sensing and its applications.

Data from different sensors is imported into a common, self-describing format (GeoTIFF + XML metadata), so that all processing steps work the same way regardless of the data source. The format supports both geocoded products (map geometry) and sensor-geometry products (image coordinates + RPC model) and is specified in docs/file-format.md. Guidance for AI coding agents working on this repository lives in AGENTS.md.

Features

  • Import: Sentinel-2 L1C (SAFE), SuperView Neo-1 L1B (PAN + MUX, with RPCs) and WH-1 / LJ-3 L1A (PAN + MSS, with RPCs) → fundayao products (one GeoTIFF per resolution group + XML metadata with geometry, calibration, angles, provenance)
  • Radiometry: DN → TOA reflectance/radiance, sun-elevation correction, DOS atmospheric correction (TOA → BOA) — each formula is an explicit, inspectable processing step recorded in the product provenance
  • Spectral indices: NDVI, NDWI, MNDWI, NDBI, NDMI, SAVI, EVI — bands are selected from the metadata by central wavelength, not hardcoded band names, so the same code works across sensors
  • Band math: custom index formulas over wavelength-addressed bands (e.g. "(nir - red) / (nir + red)")
  • AOI subsetting: windowed crops for geocoded products; sensor-geometry products get freshly re-estimated RPCs (via rpcfit) so the geometry model stays exact after cropping
  • Statistics: per-band statistics (min/max/mean/std/percentiles), raw or calibrated
  • Visualization: true-color and false-color (CIR) composites with percentile stretch, band/index maps with map coordinates, histograms, spectral profiles (reflectance vs wavelength at chosen points), band scatterplots (e.g. red–NIR)
  • Segmentation: SAM-based automatic segmentation via samgeo (segment-geospatial), producing an L3 index mask product with optional unique segment IDs or a binary foreground mask, and optional vector output
  • Provenance & metadata: every processing step is recorded in the product XML; the radiometric state (DN / TOA / BOA / index) is explicit and checked by every consumer

Installation

python3 -m venv .venv
.venv/bin/pip install -e ".[dev]"

Requires Python ≥ 3.10. Main dependencies: rasterio, numpy, matplotlib, rpcfit. The SAM segmentation feature is optional: install it with pip install -e ".[sam]" (requires segment-geospatial, which pulls in PyTorch and downloads a ~2 GB model checkpoint on first use).

Usage

Command line

# import sensor data
fundayao import-s2 S2C_MSIL1C_....SAFE products/
fundayao import-svn1 SVN1-01_..._01/ products/
fundayao import-wh1 /path/to/WH-1/ products/

# radiometric correction chain
fundayao toa products/S2C_T36RUU_20260815_L2 products/ --quantity reflectance
fundayao dos products/S2C_T36RUU_20260815_L2_TOA products/ --percentile 1

# indices and custom formulas
fundayao index ndvi products/S2C_T36RUU_20260815_L2 products/
fundayao band-math --name ndwi \
    --formula "(green - nir) / (green + nir)" \
    --band green=560 --band nir=842 \
    products/S2C_T36RUU_20260815_L2 products/

# subset an area of interest (map coords, or pixel coords for RPC products)
fundayao subset products/S2C_T36RUU_20260815_L2 products/ \
    --bbox 300000 3350000 320000 3370000
fundayao subset products/SVN101_20241203_MUX1_L1 products/ \
    --bbox 0 0 2000 2000 --coords pixel

# statistics and quicklooks
fundayao stats products/S2C_T36RUU_20260815_L2 --calibrated
fundayao quicklook products/S2C_T36RUU_20260815_L2 rgb.png
fundayao quicklook products/S2C_T36RUU_20260815_L2 cir.png --cir
fundayao quicklook products/S2C_T36RUU_20260815_L2_NDVI ndvi.png --band NDVI

# SAM segmentation (requires fundayao[sam])
fundayao segment-sam products/S2C_T36RUU_20260815_L2 products/
fundayao segment-sam products/S2C_T36RUU_20260815_L2 products/ --binary --scale 2
fundayao segment-sam products/S2C_T36RUU_20260815_L2 products/ \
    --model vit_l --device cuda --vector segments.geojson

Python API

from fundayao.io import (
    import_sentinel2_l1c, import_superview_neo1, import_wh1)
from fundayao.radiometry import toa_reflectance, dos
from fundayao.indices import ndvi, mndwi, band_math
from fundayao.segment import sam_segment
from fundayao.subset import subset
from fundayao.stats import band_statistics
from fundayao.visualize import (
    rgb_composite, plot_band, spectral_profile, band_scatter)

product = import_sentinel2_l1c("S2C_MSIL1C_....SAFE", "products")
boa = dos(toa_reflectance(product, "products"), "products")
ndvi_product = ndvi(boa, "products")

table = band_statistics(product, apply_calibration=True)
sam_mask = sam_segment(product, "products", unique=False, scale=2)
fig = rgb_composite(product, out_path="rgb.png")
fig = plot_band(ndvi_product, "NDVI", cmap="RdYlGn", out_path="ndvi.png")
fig = spectral_profile(product, [(305100.0, 3356200.0)], out_path="profile.png")
fig = band_scatter(product, 665, 842, out_path="red_nir.png")

# sensor-geometry data (SuperView Neo-1 / WH-1): pixel-coordinate subset, RPCs refit
svn_products = import_superview_neo1("SVN1-01_..._01/", "products")
sub = subset(svn_products[0], "products", (0, 0, 2000, 2000), coords="pixel")
wh1_products = import_wh1("/path/to/WH-1/", "products")
sub = subset(wh1_products[0], "products", (0, 0, 2000, 2000), coords="pixel")

Project layout

├── docs/file-format.md      # fundayao product format specification
├── src/fundayao/
│   ├── cli.py               # command line interface (thin wrapper)
│   ├── io/
│   │   ├── sentinel2.py     # Sentinel-2 L1C importer
│   │   ├── superview.py     # SuperView Neo-1 L1B importer
│   │   └── wh1.py           # WH-1 / LJ-3 L1A importer
│   ├── radiometry.py        # TOA / sun-elevation / DOS corrections
│   ├── indices.py           # spectral indices + band math
│   ├── subset.py            # AOI subsetting (+ RPC re-estimation)
│   ├── segment.py           # SAM segmentation via segment-geospatial
│   ├── stats.py             # per-band statistics
│   ├── visualize.py         # composites, maps, profiles, scatterplots
│   └── _rgb.py              # internal RGB GeoTIFF builder
└── tests/                   # pytest suite (synthetic fixtures + integration)

Testing

.venv/bin/python -m pytest

The unit tests run on small synthetic products. Additional integration tests run against real data when pointed at it via environment variables:

FUNDAO_S2_TEST_DATA=/path/to/S2 \
FUNDAO_SVN1_TEST_DATA=/path/to/SVN1 \
FUNDAO_WH1_TEST_DATA=/path/to/WH-1 \
FUNDAO_SEGMENT_SAM_TEST_DATA=/path/to/fundayao/product \
.venv/bin/python -m pytest

AI-generated code disclaimer

This repository was created by AI vibe-coding tools. The code, documentation, and other materials are provided without any warranty and may contain errors. No guarantee is made that the contents are free of third-party intellectual-property rights, including copyright. Use this software entirely at your own risk; verify its correctness and legal status for your jurisdiction before relying on it.

License

Unlicense (public domain dedication) — see LICENSE.

Download files

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

Source Distribution

fundayao-0.1.0.tar.gz (76.0 kB view details)

Uploaded Source

Built Distribution

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

fundayao-0.1.0-py3-none-any.whl (59.1 kB view details)

Uploaded Python 3

File details

Details for the file fundayao-0.1.0.tar.gz.

File metadata

  • Download URL: fundayao-0.1.0.tar.gz
  • Upload date:
  • Size: 76.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for fundayao-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b111de2048301ba49c66eedfc5b4e04db396580cdbbabbbed2c218782b6e49a0
MD5 baeb8135163a9298222ffe184e93b4c4
BLAKE2b-256 f2ab898bf1a56431f4eb94950b06e48c5ee4a1428a01950adab1910e3cae76dd

See more details on using hashes here.

File details

Details for the file fundayao-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fundayao-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 59.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for fundayao-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 841567d8ff7f065ec7e0b564e60c3ef9991c10c06369f6d00b8491ee6dd09b7e
MD5 e883cfd4071ade667104971d31b04f1e
BLAKE2b-256 da74509e29dcccfa200f6690e799b9b352d7f7c31a21723c21f84e1dd43293b6

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.0

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page