Skip to content

feat: Phase 3 — S1Tiling conditions ingestion and discovery#153

Merged
emmanuelmathot merged 3 commits intos1-rtcfrom
s1-rtc-phase3
Apr 2, 2026
Merged

feat: Phase 3 — S1Tiling conditions ingestion and discovery#153
emmanuelmathot merged 3 commits intos1-rtcfrom
s1-rtc-phase3

Conversation

@emmanuelmathot
Copy link
Copy Markdown
Contributor

Phase 3 — S1Tiling Conditions Ingestion and Discovery

Adds support for ingesting time-invariant per-orbit condition arrays (gamma_area, LIA, incidence_angle) into a conditions group under each orbit direction.

Closes part of #139 (Phase 3).

Changes

src/eopf_geozarr/conversion/s1_ingest.py

  • S1TILING_GAMMA_AREA_PATTERN / S1TILING_LIA_PATTERN — regex constants for condition file discovery
  • ingest_s1tiling_conditions() — creates conditions group with proj:/spatial: attrs, writes per-orbit (Y, X) arrays
  • discover_s1tiling_conditions() — groups condition GeoTIFFs by tile + orbit

src/eopf_geozarr/cli.py

  • ingest-s1 — ingest a single acquisition (VV + VH + mask)
  • ingest-s1-conditions — ingest condition arrays for an orbit
  • consolidate-s1 — post-batch consolidation

src/eopf_geozarr/conversion/__init__.py

  • Added discover_s1tiling_conditions and ingest_s1tiling_conditions to exports

tests/test_s1_rtc_ingest.py

  • 20 new tests across TestIngestConditions (14 tests) and TestDiscoverConditions (5 tests)
  • Total: 47/47 passing

Test summary

Class Tests Covers
TestIngestConditions 14 Group creation, attributes, shape/dtype, data roundtrip, multiple conditions, multiple orbits, overwrite, error cases (no conditions, store not exists, orbit not exists, file not found, CRS mismatch), consolidation, schema validation
TestDiscoverConditions 5 Gamma area discovery, LIA discovery, grouping, skips non-matching, empty directory

Add conditions ingestion support for time-invariant per-orbit arrays
(gamma_area, LIA, incidence_angle) written into a 'conditions' group
under each orbit direction. Includes:

- ingest_s1tiling_conditions() and discover_s1tiling_conditions()
- CLI commands: ingest-s1, ingest-s1-conditions, consolidate-s1
- Updated package exports
- 20 new tests covering ingestion, discovery, validation, and errors
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Phase 3 support for ingesting and discovering Sentinel-1 S1Tiling “conditions” (time-invariant, per-relative-orbit rasters) into the S1 GRD RTC GeoZarr V3 hierarchy, and exposes the workflows via CLI commands with accompanying tests.

Changes:

  • Implemented ingest_s1tiling_conditions() to write per-orbit 2D condition arrays under an orbit-direction conditions/ group.
  • Implemented discover_s1tiling_conditions() to find and group condition GeoTIFFs by (tile, orbit).
  • Added CLI subcommands (ingest-s1, ingest-s1-conditions, consolidate-s1) and expanded tests for ingestion/discovery.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
src/eopf_geozarr/conversion/s1_ingest.py Adds condition filename patterns, discovery, and ingestion into conditions/ group.
src/eopf_geozarr/cli.py Adds S1 ingestion-related CLI commands and wiring.
src/eopf_geozarr/conversion/__init__.py Exports new S1 conditions discovery/ingestion functions.
tests/test_s1_rtc_ingest.py Adds unit tests for conditions ingestion and discovery behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/eopf_geozarr/conversion/s1_ingest.py
Comment thread src/eopf_geozarr/conversion/s1_ingest.py
Comment thread src/eopf_geozarr/conversion/s1_ingest.py Outdated
Comment thread src/eopf_geozarr/conversion/s1_ingest.py Outdated
Comment thread src/eopf_geozarr/conversion/s1_ingest.py
Comment thread src/eopf_geozarr/cli.py Outdated
Comment thread tests/test_s1_rtc_ingest.py
- Validate CRS, transform, and shape for every condition file against
  the reference (not just the first)
- Validate existing conditions group metadata when re-opening
- Check array shape before overwrite and raise on mismatch
- Add incidence_angle discovery pattern (S1TILING_INCIDENCE_ANGLE_PATTERN)
- Fix CLI help text to mention incidence_angle
- Fix docstring to describe actual return schema (keys present only when
  files discovered)
- Add tests: LIA-only schema validation, cross-file CRS mismatch,
  cross-file shape/transform mismatch, overwrite shape mismatch,
  incidence_angle discovery, all-three-types grouping

53/53 tests passing.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/eopf_geozarr/conversion/s1_ingest.py
Comment thread src/eopf_geozarr/conversion/s1_ingest.py
Comment thread src/eopf_geozarr/conversion/s1_ingest.py Outdated
Comment thread src/eopf_geozarr/conversion/s1_ingest.py Outdated
Comment thread tests/test_s1_rtc_ingest.py
- Simplify GAMMA_AREA regex to match actual S1Tiling output
  (GAMMA_AREA_<tile>_<orbit>.tif only, no platform/direction segments)
- Validate condition transform/shape against orbit group's native grid
- Normalize tile identifiers to uppercase in discovery
- Warn on duplicate gamma_area files for same tile/orbit
- Guard nanmin/nanmax in logging against all-NaN condition data
- Add tests: tile casing normalization, all-three-types grouping

54/54 tests passing.
Copy link
Copy Markdown
Contributor Author

@emmanuelmathot emmanuelmathot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally and then view on titiler!

@emmanuelmathot emmanuelmathot merged commit 5e02b66 into s1-rtc Apr 2, 2026
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.

2 participants