Skip to content

Add LocalSafeSearch source for pre-downloaded SAFE dirs / zips#136

Merged
scottstanie merged 3 commits intoisce-framework:mainfrom
scottstanie:feat-local-safe-search
Apr 16, 2026
Merged

Add LocalSafeSearch source for pre-downloaded SAFE dirs / zips#136
scottstanie merged 3 commits intoisce-framework:mainfrom
scottstanie:feat-local-safe-search

Conversation

@scottstanie
Copy link
Copy Markdown
Member

Summary

  • Re-adds a path for users who already have full-frame Sentinel-1 SAFE products on disk (e.g. fetched from ASF Vertex as .zip archives) and want sweets to feed them straight into COMPASS. The v0.2 rewrite replaced the old ASFQuery + _unzip.py path with burst2safe-only downloads, leaving no way to consume pre-existing zips.
  • New LocalSafeSearch(kind=\"local\") source: accepts .SAFE dirs or .zip archives in a user-supplied out_dir, auto-detects the COMPASS using_zipped flag (.SAFE preferred when both are present; explicit override available), no start/end/track required.
  • Workflow + CLI wiring: added to the Source discriminated union; _download() validates non-empty and returns what's on disk; _geocode_slcs threads using_zipped through to COMPASS; _dem_bbox applies the 1-deg buffer so full IW frames fit. CLI --source local skips date flags.

Closes #135.

Test plan

  • New unit tests (9) in test_core.py / test_cli.py cover model validation, zip-vs-SAFE auto-detect, using_zipped override, YAML round-trip, DEM buffer, --source local CLI assembly, and that non-local sources still require --start / --end.
  • Full local test suite passes (pixi run pytest tests/ --ignore=tests/test_download_search.py — 62 passed).
  • pre-commit run -a clean (black, ruff, mypy).
  • End-to-end smoke run with a real directory of ASF .zip SAFEs through sweets run still needed — I don't have a zip stack handy locally.

Example usage

# sweets_config.yaml
bbox: [-104.0, 32.0, -103.0, 33.0]
search:
  kind: local
  out_dir: /path/to/my/asf/zips

Or via CLI:

sweets config --source local --out-dir /path/to/my/zips --bbox -104 32 -103 33

🤖 Generated with Claude Code

scottstanie and others added 3 commits April 16, 2026 07:07
… zips

Re-add a path for users who already have full-frame Sentinel-1 SAFE
products on disk (e.g. fetched from ASF Vertex as `.zip` archives) and
want sweets to feed them straight into COMPASS. The v0.2 rewrite
replaced the old ASFQuery + `_unzip.py` path with burst2safe-only
downloads, which had no way to consume pre-existing zips (isce-framework#135).

- `LocalSafeSearch(kind="local")`: points at a user-supplied `out_dir`,
  accepts `.SAFE` directories or `.zip` archives, picks `using_zipped`
  automatically (`.SAFE` preferred when both present; explicit override
  available).
- Workflow wiring: added to the `Source` discriminated union; `_download()`
  validates the dir is non-empty and returns what's on disk; `_geocode_slcs`
  threads `using_zipped` through to COMPASS; `_dem_bbox` applies the wide
  1-deg buffer on the LocalSafeSearch path so full-frame IW extents fit.
- CLI: `--source local` builds a LocalSafeSearch from `--bbox` + `--out-dir`;
  `--start` / `--end` are now optional and required only for non-local
  sources.
- Tests: 9 new unit tests covering model validation, zip-vs-SAFE
  auto-detect, `using_zipped` override, YAML round-trip, DEM buffer, and
  the CLI flag.

Closes isce-framework#135.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…m disk

The flag was a footgun — users could set it to disagree with what was
actually in `out_dir` and get confusing COMPASS failures. With no
override, sweets now inspects the dir (`.SAFE` preferred over `.zip`
when both are present, since they're almost always leftovers from an
earlier unzip of the same product) and infers COMPASS's `using_zipped`
from the suffix of the first file we picked.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@scottstanie scottstanie merged commit 86a8c61 into isce-framework:main Apr 16, 2026
4 checks passed
@scottstanie scottstanie deleted the feat-local-safe-search branch April 16, 2026 19:41
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.

zip file problem

1 participant