Skip to content

feat(bestpixel): end-to-end L1C custom-AC composite (v0.2.0) - #3

Merged
MarcYin merged 1 commit into
mainfrom
feat/bestpixel-l1c-composite
Jun 23, 2026
Merged

feat(bestpixel): end-to-end L1C custom-AC composite (v0.2.0)#3
MarcYin merged 1 commit into
mainfrom
feat/bestpixel-l1c-composite

Conversation

@MarcYin

@MarcYin MarcYin commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Add bestpixel.build_l1c_composite — a Sentinel-2 L1C custom atmospheric- correction monthly composite — to the published bestpixel package, with the 6S correction running in Rust and the GEE fetch in Python.

  • Rust: new correct_toa(toa, xap, xbp, xcp) PyO3 function wired to the crate's atcorr 6S core; applies rho_boa = y/(1+xcpy), y = xaprho_toa-xbp per pixel, NaN nodata passthrough, negatives clamp to 0.
  • python/bestpixel/l1c.py: build_l1c_composite — MAIAC clean-day gate, scout-first windowed getPixels of L1C TOA + Cloud Score+, correct_toa (Rust), best-pixel compose (lowest-AOD wins, cs tie-break), optional int16 GeoTIFF.
  • python/bestpixel/_gee.py: lazy GEE fetch helper (getPixels patch, coarse scout, asset resolution from the sidecar's system:index).
  • python/bestpixel/atmosphere.py: 6S sidecar loader (AtmoSidecar/SceneAtmosphere).
  • init exports build_l1c_composite; init.pyi stub + README section.
  • pyproject: 0.1.2 -> 0.2.0, numpy core dep, new [gee] extra (earthengine-api, pyproj, rasterio); Cargo.toml bumped to match.
  • tests/test_l1c.py: correct_toa round-trip + the pipeline with a fake ee.

Sidecar built by scripts/{build_atmo_sidecar,custom_ac_phase2_sixs, atmo_sidecar_merge}.py; scripts/run_l1c_composite.sh runs it then the composite. Validated live against GEE: blue 1338 / red 2243 DN (matches the prototype). cargo test 11/11, bestpixel pytest 4/4, repo ruff clean.

Add `bestpixel.build_l1c_composite` — a Sentinel-2 L1C custom atmospheric-
correction monthly composite — to the published bestpixel package, with the
6S correction running in Rust and the GEE fetch in Python.

- Rust: new `correct_toa(toa, xap, xbp, xcp)` PyO3 function wired to the
  crate's `atcorr` 6S core; applies rho_boa = y/(1+xcp*y), y = xap*rho_toa-xbp
  per pixel, NaN nodata passthrough, negatives clamp to 0.
- python/bestpixel/l1c.py: build_l1c_composite — MAIAC clean-day gate,
  scout-first windowed getPixels of L1C TOA + Cloud Score+, correct_toa (Rust),
  best-pixel compose (lowest-AOD wins, cs tie-break), optional int16 GeoTIFF.
- python/bestpixel/_gee.py: lazy GEE fetch helper (getPixels patch, coarse
  scout, asset resolution from the sidecar's system:index).
- python/bestpixel/atmosphere.py: 6S sidecar loader (AtmoSidecar/SceneAtmosphere).
- __init__ exports build_l1c_composite; __init__.pyi stub + README section.
- pyproject: 0.1.2 -> 0.2.0, numpy core dep, new [gee] extra
  (earthengine-api, pyproj, rasterio); Cargo.toml bumped to match.
- tests/test_l1c.py: correct_toa round-trip + the pipeline with a fake ee.

Sidecar built by scripts/{build_atmo_sidecar,custom_ac_phase2_sixs,
atmo_sidecar_merge}.py; scripts/run_l1c_composite.sh runs it then the composite.
Validated live against GEE: blue 1338 / red 2243 DN (matches the prototype).
cargo test 11/11, bestpixel pytest 4/4, repo ruff clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@MarcYin
MarcYin merged commit 6e4205b into main Jun 23, 2026
6 checks passed
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