Add LocalSafeSearch source for pre-downloaded SAFE dirs / zips#136
Merged
scottstanie merged 3 commits intoisce-framework:mainfrom Apr 16, 2026
Merged
Conversation
… 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.ziparchives) and want sweets to feed them straight into COMPASS. The v0.2 rewrite replaced the oldASFQuery+_unzip.pypath with burst2safe-only downloads, leaving no way to consume pre-existing zips.LocalSafeSearch(kind=\"local\")source: accepts.SAFEdirs or.ziparchives in a user-suppliedout_dir, auto-detects the COMPASSusing_zippedflag (.SAFEpreferred when both are present; explicit override available), nostart/end/trackrequired.Sourcediscriminated union;_download()validates non-empty and returns what's on disk;_geocode_slcsthreadsusing_zippedthrough to COMPASS;_dem_bboxapplies the 1-deg buffer so full IW frames fit. CLI--source localskips date flags.Closes #135.
Test plan
test_core.py/test_cli.pycover model validation, zip-vs-SAFE auto-detect,using_zippedoverride, YAML round-trip, DEM buffer,--source localCLI assembly, and that non-local sources still require--start/--end.pixi run pytest tests/ --ignore=tests/test_download_search.py— 62 passed).pre-commit run -aclean (black, ruff, mypy)..zipSAFEs throughsweets runstill needed — I don't have a zip stack handy locally.Example usage
Or via CLI:
🤖 Generated with Claude Code