Add ssar#1494
Conversation
Reviewer's GuideAdds a band-aware NISAR loading workflow that introduces a configurable SAR product family (LSAR/SSAR) option, threads it through CLI and MintPy config, and refactors all NISAR HDF5 path resolution and preparation utilities to derive datasets dynamically from the selected band while preserving LSAR as the default. Flow diagram for band-aware NISAR loading pipelineflowchart LR
subgraph User_Input
A1[CLI prep_nisar.py --band]
A2[smallbaselineApp.cfg mintpy.load.band]
end
A1 --> B[prep_nisar.load_nisar]
A2 --> C[load_data.prepare_metadata]
C -->|builds args with --band| D[CLI prep_nisar.py]
D --> B
B --> E[_normalize_sar_band]
E -->|sar_band| F[_science_root]
E -->|sar_band| G[_processinfo]
B -->|sar_band, frequency, polarization| H[_datasets_for_pol]
B -->|sar_band| I[_get_date_pairs]
B -->|sar_band| J[extract_metadata]
B -->|sar_band| K[prepare_geometry]
B -->|sar_band| L[prepare_water_mask]
B -->|sar_band| M["prepare_stack (ifgram/ion/tropo/set)"]
F --> H
G --> J
G --> I
G --> K
G --> L
G --> M
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider defining a module-level constant for the default SAR band (e.g.,
DEFAULT_SAR_BAND = "LSAR") and using it consistently instead of repeating the literal "LSAR" in many function signatures and messages, which will reduce the risk of future mismatches. - Several public helpers now accept a
sar_bandargument and internally normalize it; you could normalizesar_bandonce at the top-level (e.g., inload_nisar/CLI) and pass the normalized value through to avoid repeated normalization and make error messages and logging more predictable.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider defining a module-level constant for the default SAR band (e.g., `DEFAULT_SAR_BAND = "LSAR"`) and using it consistently instead of repeating the literal "LSAR" in many function signatures and messages, which will reduce the risk of future mismatches.
- Several public helpers now accept a `sar_band` argument and internally normalize it; you could normalize `sar_band` once at the top-level (e.g., in `load_nisar`/CLI) and pass the normalized value through to avoid repeated normalization and make error messages and logging more predictable.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
@sourcery-ai review |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Now that
sar_bandis threaded through most helpers, consider introducing a small context object (e.g., carryingsar_band,science_root, andprocessinfo) and passing that instead of the rawsar_bandparameter to reduce repeated root/path computation and make future band-specific extensions easier to maintain.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Now that `sar_band` is threaded through most helpers, consider introducing a small context object (e.g., carrying `sar_band`, `science_root`, and `processinfo`) and passing that instead of the raw `sar_band` parameter to reduce repeated root/path computation and make future band-specific extensions easier to maintain.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
@yunjunz |
Description of proposed changes
This PR adds SSAR support to the NISAR loading workflow while keeping the current LSAR behavior as the default.
It introduces a new
bandoption for NISAR loading through both the CLI and the MintPy template:--bandinprep_nisar.pymintpy.load.bandinsmallbaselineApp.cfgThe selected band is passed through
load_data.pyintoprep_nisar.py, where the HDF5 dataset and metadata paths are now resolved dynamically from the NISAR product family instead of being hardcoded for LSAR.As part of this update, the NISAR preparation logic is made band-aware across:
This allows the same workflow to ingest both LSAR and SSAR GUNW products without manual path edits or separate code paths.
Defaults remain backward compatible:
band=autoresolves toLSARfrequency=autocontinues to resolve toAThese changes keep existing LSAR processing unchanged while extending MintPy support to SSAR NISAR products.
Reminders
Summary by Sourcery
Add band-aware NISAR loading to support both LSAR and SSAR products while keeping LSAR as the default.
New Features:
Enhancements:
Documentation: