Skip to content

Resample v2 geometric reramp - #422

Open
Tyler-g-hudson wants to merge 4 commits into
isce-framework:developfrom
Tyler-g-hudson:resample_v2_geometric_reramp
Open

Tyler-g-hudson wants to merge 4 commits into
isce-framework:developfrom
Tyler-g-hudson:resample_v2_geometric_reramp

Conversation

@Tyler-g-hudson

@Tyler-g-hudson Tyler-g-hudson commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

This PR modifies the resample_slc_v2 workflow to separately handle resampling and reramping when two separate offsets files are given, namely in the fine resampling case in which resampling is handled using rubbersheet offsets and reramping is handled by the coarse geometric offsets.

This change is intended to avert situations in which high amounts of ionospheric scintillation cause phase distortions to be introduced by the rubbersheet workflow. This will hopefull produce interferograms with decreased phase variability at times and locations of high ionospheric variability, in cases where rubbersheeting is used.

This change only adds new options to the public-facing interfaces of the Python code; it will not disrupt users currently using these interfaces, only provide them with new options. The exception to this is that it does change the default behavior of the InSAR workflow to use this updated behavior.

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

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.

Some comments for this review that I didn't think were appropriate for inclusion in the code itself

Comment on lines +378 to +383
def offsets_to_indices(
out_block_slice: tuple[slice, slice],
in_block_slice: tuple[slice, slice],
az_offsets: np.ndarray,
rg_offsets: np.ndarray,
) -> tuple[np.ndarray, np.ndarray]:

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.

This function deprecated from use in the main algorithm but kept to maintain a public interface

Comment on lines +81 to +88
rg_off_path = offsets_path / "range.off"
az_off_path = offsets_path / "azimuth.off"
# The fine offsets workflow resamples to the rubbersheet offsets (known
# in this workflow as "total" offsets) but reramping with these offsets
# can introduce phase distortions in data with e.g. high amounts of
# ionospheric scintillations. Pass the coarse "geometric" offsets for
# reramping.
az_geom_path = geom_offsets_path / "azimuth.off"

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.

@xhuang-jpl I opted to make it so that the user inputs the "total" offsets by default and the "geometric" offsets are optional. The reason for this is that, while the coarse offsets are geometric offsets, it works the same to pass these offsets as the total offsets and None as the geometric offsets; since the total offsets are the locations that the actual resampling is occurring, this is a sensible default input location; we only need to pass geometric offsets in as an optional in the case where we are doing this separate reramping.

More simply, I think it makes more sense to a user to say "Give me the locations you want to resample to, and a separate geometric offsets if you want to reramp somewhere other than your resampling locations" than it does to say "Give me the geometric offsets you want to reramp to, plus a different set of offsets to resample to if they're different from your geometric offsets"

It's a purely interface decision, the logical functioning of the code works the same underneath

Comment on lines 174 to 178
const double doppler_resampled_phase =
doppler_freq * azimuth_input_index_remainder;
doppler_freq_geom * (azimuth_geom_ind - azimuth_tot_ind_int);
const std::complex<float> doppler_resampled_phasor(
std::cos(doppler_resampled_phase),
std::sin(doppler_resampled_phase)

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.

@bhawkins I wonder if you might be willing to look at this and give your thoughts.

Basically, before there was only one offsets file being put in, and this step was taking the doppler at the index and locally deramping the chip at that position, then reramping to the remainder between the integer chip center location and the actual resampled location.

The new code does something different - two offsets rasters are input, one "total" (i.e. rubbersheet for fine resampling or geometric for coarse resampling) and one always geometric. The doppler is calculated at both azimuth positions - the chip is deramped and resampled using the total doppler but the output location is reramped using the geometric doppler. The reramp geometry is defined as the geometric float-valued index and the total integer-valued sinc chip center position. The intended (and now once observed) result is a product with the good coherence of rubbersheet offsets but the smooth unwrapped phase of a purely geometric or polynomial fit interferogram.

Questions:

  1. Does it make sense to use the geometric doppler frequency here or the total doppler frequency, or the doppler frequency at the midpoint between the two?
  2. Does azimuth_geom_ind - azimuth_tot_ind_int make sense as a reramping distance? If I just use the azimuth_geom_index_remainder then I get sharp discontinuities where the index values of azimuth_tot_ind_int and azimuth_geom_ind_int step relative to each other.
  3. More generally, is this an appropriate method? We have confirmed at least that the coherence is very similar between a develop product and a product between this branch while having improved smoothness of unwrapped offsets.

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.

It doesn't make sense to have two Doppler frequencies floating around here. It's broken up into a demodulation step and remodulation step, and it's essential to use the same frequency for both steps. Perhaps a simpler way to think about the algorithm is that the demodulation phase is zero at the output point. That is,

const double doppler_phase = doppler_freq * (i_chip - chip_half);

means the deramp phase is zero at chip_half while

const double doppler_resampled_phase = doppler_freq * azimuth_input_index_remainder;

moves the zero-phase point to the output location since azimuth_input_index_remainder is the distance between the output location and chip_half (in the sub-image domain of the chip). Like I mentioned when reviewing this code a while back, one could skip the remodulation step by just bookkeeping the remainder in the deramp step. Using two frequencies would break this property, though the effect is probably small in most cases.

That's also why you have to use azimuth_geom_ind - azimuth_tot_ind_int, since azimuth_tot_ind_int corresponds to the zero-phase point of the deramp (equivalent of chip_half in full-image domain). That is, now we want the zero-phase point to be at the geometric location, just like we do range "flattening" with only the geometric part of the shift.

An unrelated thing I noticed when looking at this code is that there seems to be an off-by-one in how the chip is filled. The indices are basically [-4, -3, -2, -1, 0, 1, 2, 3] + floor(x), and the interpolation kernel is always centered at some positive offset from chip_half like below:

Image

I think that's why I opted for ceil(x) in the version here. I don't think there's a big problem since the Sinc2dInterpolator::interpolate call is being asked for the correct point, it's just less accurate than it would be if properly centered. Although, maybe Sinc2dInterpolator::interpolate has the same bug.

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.

Thanks for this response! A couple of questions:

Given that I would be using only one doppler frequency, my intuition is that the frequency associated with the geometric doppler location would be the correct one to use, right? Since that's the one we're reramping to. I imagine the effect will be small either way but I want to be certain I'm using the better of the two.

Second, regarding the off-by-one error, this only applies to a grid with even dimension, yes? The chip dimension is defined as SINC_ONE which is 9, so the indices would run from -4 to 4, no? I recall some discussion of always making sure that the chip had an odd width when I was writing this code.

@hfattahi hfattahi added this to the R05.04.0 milestone Nov 18, 2026

This branch has not been deployed

No deployments
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.

3 participants