Skip to content

Handle case where no samples in a rangline are valid#327

Merged
bhawkins merged 4 commits into
isce-framework:developfrom
bhawkins:fix_fill_gaps
Jun 24, 2026
Merged

Handle case where no samples in a rangline are valid#327
bhawkins merged 4 commits into
isce-framework:developfrom
bhawkins:fix_fill_gaps

Conversation

@bhawkins

Copy link
Copy Markdown
Contributor

This patch allows RSLC processing to continue when there are pulses in the L0B with no samples marked as valid. Without these changes one will get an error message like

  File "/opt/conda/lib/python3.12/site-packages/isce3/focus/valid_regions.py", line 554, in get_gap_slices
    yield slice(None, pulse_swaths[0, 0])
                      ~~~~~~~~~~~~^^^^^^
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

While this limitation has been around for a while, it gains new relevance with the recent L0B processor update that marks the first 500 pulses of a datatake as invalid during the HPA warm-up period.

The heart of this patch is the four lines added to isce3.focus.fill_gaps. The rest of the changes are just to generate some concise log messages to help debugging cases with missing data down the line.

@hfattahi hfattahi added this to the R05.02.2 milestone Jun 24, 2026
Comment on lines +552 to +555
# If there's no valid data then the whole rangeline is a "gap".
if len(pulse_swaths) == 0:
yield slice(None)
return

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Even though in reality and during warmup the entire pulse is not invalid but first 2/3rd and then 1/3rd is missing, looks like we have decided to mark all invalid in L0B. Anyways that is an upstream discussion which we already had. So that is ok to give up on the warm up part in RSLC.
Out of curiosity what happens if the entire L0B has a mask that marks all pulses invalid? Does focus detect and complain, or with this minor change we are letting that go through?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I guess that's true about the first 1/3rd of the swath. We'd want to test that EAP does the right thing in that case.

If all pulses are marked completely invalid then yes processing would continue and the result would be an image of all zeros. Similarly, a block of 5 seconds of missing data would no longer be a fatal error. That's why I added the extra logging so there's at least some visibility into those sorts of edge cases.

The L0B .met file contains information about missing rangelines, so PCM could implement a rule to avoid RLSC processing stuff with missing data.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree that it is the responsibility of job manager (PCM) to check if we want a threshold for not submitting job. I think it is actually a good thing to let data be processed even if there is 5 sec or whatever gap in the data. Again somebody else's job (e.g, QA) to accept the partial SLC or not!

@hfattahi hfattahi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Thanks @bhawkins

@Tyler-g-hudson Tyler-g-hudson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks!

@rad-eng-59 rad-eng-59 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Thanks.

return algorithm, wavelets


def log_bad_pulses(swaths, max_slices=10):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I assume the purpose of the max_slices is to avoid crowding the log/screen with too many bad range lines.

@bhawkins
bhawkins merged commit 813d729 into isce-framework:develop Jun 24, 2026
7 of 8 checks passed
Tyler-g-hudson added a commit that referenced this pull request Jun 25, 2026
commit 0e1f80c
Author: xhuang-jpl <118782850+xhuang-jpl@users.noreply.github.com>
Date:   Wed Jun 24 16:38:22 2026 -0700

    Fix the Ampcor issues from Lijun's branch and increase the limit of the search radius  (#282)

    * sm r3.4

    * change the SM commit id for R4.0.2

    * remove the mask description for the wrapped ifgram

    * remove the tmp folder

    * fix minors

    * comment out the checkPixelInImageRange

    * pycuampcor: fix the pixels out of range issue

    * pycuampcor: fix an error in determining the corrwindow size

    * update the maximum search radius to be 256

    ---------

    Co-authored-by: Xiaodong Huang <xhuang@nisar-adt-dev-3.jpl.nasa.gov>
    Co-authored-by: Lijun Zhu <ljzhu@gps.caltech.edu>

commit 813d729
Author: Brian Hawkins <1729052+bhawkins@users.noreply.github.com>
Date:   Wed Jun 24 13:56:09 2026 -0500

    Handle case where no samples in a rangline are valid (#327)

    * Handle case where all subswaths are invalid.

    * Log some details about missing data.

    * Fix typo

    * Use signed integer for negative values...

commit 075795f
Author: Gustavo H. X. Shiroma <52007211+gshiroma@users.noreply.github.com>
Date:   Thu Jun 18 15:59:58 2026 -0700

    Fix STATIC filenames with fractional posting by rounding posting after converting to decimeters. (#314)

    * disable polarimetric symmetrization by default

    * revert changes to `symmetrize_cross_pol_channels`

    * Update GCOV and GSLC specification XMLs

    * Revert changes to the GCOV and GSLC specification XMLs

    * round posting after conversion to decimeters

commit 3f7027d
Author: SamNemo <11642807+nemo794@users.noreply.github.com>
Date:   Thu Jun 18 10:29:43 2026 -0700

    Fix text encoding: Replace en dash (U+2013) with ASCII hyphen in descriptions (#292)

    Replaced Unicode en dash character (U+2013 "–") with standard ASCII hyphen
    (U+002d "-") in 19 locations across 4 Python files. The en dash was causing
    display issues in some programs, appearing as "â€"" instead of "–".

    Files modified:
    - python/packages/isce3/signal/rfi_freq_null.py (1 occurrence in citation)
    - python/packages/nisar/products/insar/GUNW_writer.py (5 occurrences in mask descriptions)
    - python/packages/nisar/products/insar/GOFF_writer.py (4 occurrences in mask descriptions)
    - python/packages/nisar/products/insar/InSAR_L1_writer.py (9 occurrences in mask descriptions)

    This fix ensures HDF5 attribute descriptions display correctly across all
    programs and avoids confusion with special Unicode characters in source code.

    Co-authored-by: Samantha C. Niemoeller <samantha.c.niemoeller@jpl.nasa.gov>

commit db4f65b
Author: Gustavo H. X. Shiroma <52007211+gshiroma@users.noreply.github.com>
Date:   Wed Jun 17 14:59:11 2026 -0700

    Add margins to the STATIC product Doppler LUT grid boundaries to ensure full radargrid coverage. (#298)

    * disable polarimetric symmetrization by default

    * revert changes to `symmetrize_cross_pol_channels`

    * Update GCOV and GSLC specification XMLs

    * Revert changes to the GCOV and GSLC specification XMLs

    * Add margins to the Doppler LUT grid boundaries to ensure full radargrid coverage.

    * Add margins to the Doppler LUT grid boundaries to ensure full radargrid coverage.

    * Add margins to the Doppler LUT grid boundaries to ensure full radargrid coverage.

commit 67f0878
Author: Gustavo H. X. Shiroma <52007211+gshiroma@users.noreply.github.com>
Date:   Mon Jun 8 11:43:17 2026 -0700

    Improve DEM bounding box selection when product coordinates are in a different projection than the DEM (#275)

    * disable polarimetric symmetrization by default

    * revert changes to `symmetrize_cross_pol_channels`

    * Update GCOV and GSLC specification XMLs

    * Revert changes to the GCOV and GSLC specification XMLs

    * Update DEM bounding box selection

    * Improve variable names, docstrings, and handle incorrect starting/ending ordering

    * Improve variable names

    * Ensure latitude values remain within [-90, 90]

    * Ensure latitude values remain within [-90, 90]

    * Simplify code

    * Use parenthesis to make it clear evaluation order

    * improve comments

    * revert changes to constructor of variables `all_x` and `all_y`

    * change margin types from `float` to `double`
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.

4 participants