Skip to content

Fix/propagate cslc date fmt to ministack#710

Open
scottstanie wants to merge 5 commits intoisce-framework:mainfrom
scottstanie:fix/propagate-cslc-date-fmt-to-ministack
Open

Fix/propagate cslc date fmt to ministack#710
scottstanie wants to merge 5 commits intoisce-framework:mainfrom
scottstanie:fix/propagate-cslc-date-fmt-to-ministack

Conversation

@scottstanie
Copy link
Copy Markdown
Member

Change Summary

When run_wrapped_phase_sequential is invoked with a non-default cslc_date_fmt (e.g. "%Y%m%d%H%M%S" with same-day repeats, like Delta-X needs), the date format was not forwarded to MiniStackPlanner. As a result, phase-linked SLCs and CRLB rasters were written using the default "%Y%m%d", and create_ifgs in wrapped_phase later raised IndexError trying to extract dates from those filenames with the caller's longer format.

Two fixes:

  1. sequential.py: pass file_date_fmt=cslc_date_fmt when constructing MiniStackPlanner.

  2. stack.py: in MiniStackPlanner.plan(), forward self.file_date_fmt to each MiniStackInfo it creates. The planner already accepted the field but did not propagate it to its children.

With both in place, _name_slcs / _name_crlbs produce filenames that preserve the time-of-day component, and create_ifgs can parse them back round-trip.

Related issue number

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Tests pass on CI
  • Documentation reflects the changes where applicable
  • My PR is ready to review

scottstanie and others added 5 commits April 25, 2026 13:04
When run_wrapped_phase_sequential is invoked with a non-default
cslc_date_fmt (e.g. "%Y%m%d%H%M%S" for non-SSO cadences with same-day
repeats), the date format was not forwarded to MiniStackPlanner. As a
result, phase-linked SLCs and CRLB rasters were written using the
default "%Y%m%d", and create_ifgs in wrapped_phase later raised
IndexError trying to extract dates from those filenames with the
caller's longer format.

Two complementary fixes:

1. sequential.py: pass file_date_fmt=cslc_date_fmt when constructing
   MiniStackPlanner.

2. stack.py: in MiniStackPlanner.plan(), forward self.file_date_fmt to
   each MiniStackInfo it creates. The planner already accepted the
   field but did not propagate it to its children.

With both in place, _name_slcs / _name_crlbs produce filenames that
preserve the time-of-day component, and create_ifgs can parse them
back round-trip.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
After the prior commit, phase-linked SLCs were written with the caller's
cslc_date_fmt (e.g. "%Y%m%d%H%M%S"), but the interferogram VRT names
were still hardcoded to "%Y%m%d" because Network and convert_pl_to_ifg
default to that format. The resulting "%Y%m%d_%Y%m%d.int.vrt" filenames
then failed downstream stitching: stitching_bursts.run calls
merge_by_date with file_date_fmt=cslc_date_fmt, the long-format regex
matches no dates in the date-only filenames, and merge_images either
groups all ifgs together or builds a clip window with negative
dimensions ("Computed -srcwin ... has negative width and/or height").

Forward file_date_fmt into:
- interferogram.Network(...) constructions in create_ifgs (3 sites)
- interferogram.VRTInterferogram(...) construction for the extra-ref
  case
- interferogram.convert_pl_to_ifg(...) (2 sites)

convert_pl_to_ifg now accepts a date_format parameter (default unchanged
for backward compatibility) and uses it for both date extraction from
the input SLC name and output filename formatting.

With this and the prior MiniStack propagation in place, IFG VRT
filenames preserve the time-of-day component end-to-end and downstream
merge_by_date round-trips correctly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Spurt's emcf workflow now accepts a --date-fmt CLI flag (default
"%Y%m%d") that controls how acquisition dates are extracted from SLC
filenames and written into unwrapped output filenames. Without
forwarding the caller's cslc_date_fmt, dolphin's spurt subprocess used
the default %Y%m%d slice and same-day acquisitions collapsed to a
single date in the output (e.g. 20240709_20240709.unw.tif), losing the
time-of-day component already preserved in the upstream ifg names.

Thread file_date_fmt: str = "%Y%m%d" through:
- unwrap_spurt: append "--date-fmt <fmt>" to the spurt subprocess
  command, and forward to filled_masked_unw_regions for the
  ambiguity-interpolation gap-fill step (which already accepted the
  parameter but was being called with the default).
- unwrap.run: forward into unwrap_spurt.
- workflows.unwrapping.run: forward into unwrap.run.
- workflows.displacement.run: pass cfg.input_options.cslc_date_fmt
  into unwrapping.run.

With this in place, e.g. cslc_date_fmt="%Y%m%d%H%M%S" produces
spurt outputs like 20240709040329_20240712025153.unw.tif round-trippable
end-to-end.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
timeseries.run already accepted file_date_fmt, but it was not being
forwarded from displacement.run, and several internal call sites
ignored it. As a result, with cslc_date_fmt="%Y%m%d%H%M%S" the
upstream stages produced ifg/unw filenames with time-of-day, but the
timeseries/ outputs collapsed back to %Y%m%d (e.g.
20251002_20251005.tif), losing the disambiguation that motivated the
custom format in the first place.

Forward file_date_fmt at five sites:
- displacement.run: pass cfg.input_options.cslc_date_fmt into
  timeseries.run.
- timeseries.run -> invert_unw_network: forward file_date_fmt (the
  callee accepted but the caller did not pass it).
- _redo_reference: pass fmt=file_date_fmt into format_dates when
  building the re-referenced filenames for extra_reference_date.
- invert_unw_network: pass fmt=file_date_fmt into both format_dates
  calls that build out_paths and out_residuals_paths.
- create_nonzero_conncomp_counts: replace hardcoded
  d.strftime('%Y%m%d') with d.strftime(file_date_fmt) (the function
  already exposed the parameter).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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