Skip to content

Masked reference point #672

@scottstanie

Description

@scottstanie

Discussed in #670

Originally posted by giorgoskouroupis January 8, 2026
Hello @scottstanie and the whole team :)

I have been running the dolphin and so far it seems quite robust.
thank you for your work. :)

However i came to a small bug(?), i guess from using a (water) mask file.
After an unsuccessful inversion run (all good up until the inversion step) the log reads:

[INFO|timeseries|L153] 2026-01-07T09:38:41+0100: Selecting a reference point for unwrapped interferograms
INFO:dolphin:Selecting a reference point for unwrapped interferograms
[INFO|timeseries|L1313] 2026-01-07T09:38:41+0100: Selecting reference point
INFO:dolphin:Selecting reference point
[INFO|timeseries|L1395] 2026-01-07T09:38:41+0100: Creating intersection of connected components
INFO:dolphin:Creating intersection of connected components

100%|██████████| 156/156 [00:29<00:00, 5.37it/s]

[INFO|timeseries|L1415] 2026-01-07T09:39:11+0100: Found 36530 connected components in intersection
INFO:dolphin:Found 36530 connected components in intersection
[INFO|timeseries|L1363] 2026-01-07T09:39:11+0100: Saving ReferencePoint(row=1456, col=122) to ./reference_point.txt
INFO:dolphin:Saving ReferencePoint(row=1456, col=122) to ./reference_point.txt
[INFO|stitching|L694] 2026-01-07T09:39:11+0100: Using ./water_mask_tile_0.tif, already matches size of ./unwrapped/20200105_20200117.unw.tif
INFO:dolphin:Using ./water_mask_tile_0.tif, already matches size of ./unwrapped/20200105_20200117.unw.tif
[INFO|timeseries|L207] 2026-01-07T09:39:11+0100: Inverting network of 600 unwrapped ifgs
INFO:dolphin:Inverting network of 600 unwrapped ifgs
[INFO|timeseries|L1060] 2026-01-07T09:39:11+0100: Inverting network using L1-norm minimization
INFO:dolphin:Inverting network using L1-norm minimization
[INFO|timeseries|L1095] 2026-01-07T09:39:11+0100: Using unweighted unw inversion
INFO:dolphin:Using unweighted unw inversion
[WARNING|timeseries|L1101] 2026-01-07T09:39:12+0100: Masked data found at 1456, 122.
WARNING:dolphin:Masked data found at 1456, 122.
[WARNING|timeseries|L1102] 2026-01-07T09:39:12+0100: Zeroing out reference pixel. Results may be wrong.
WARNING:dolphin:Zeroing out reference pixel. Results may be wrong.

From the look of the code, the reference point is calculated before any consideration of the the mask in

if reference_point is None:
logger.info("Selecting a reference point for unwrapped interferograms")
if quality_file is None:
raise ValueError("Must provide quality_file if not reference_point given")
ref_point = select_reference_point(
quality_file=quality_file,
output_dir=output_path,
candidate_threshold=reference_candidate_threshold,
ccl_file_list=conncomp_paths,
)
else:
ref_point = ReferencePoint(row=reference_point[0], col=reference_point[1])
ifg_date_pairs = [get_dates(f, fmt=file_date_fmt) for f in unwrapped_paths]
sar_dates = sorted(set(flatten(ifg_date_pairs)))
# Read in the binary mask
if mask_path is not None:
matching_mask_path = _get_matching_raster(
mask_path, output_path, unwrapped_paths[0]
)
mask = io.load_gdal(matching_mask_path, masked=True).filled(0)
bad_pixel_mask = mask == 0
else:
bad_pixel_mask = np.zeros((rows, cols), dtype=bool)

If this is indeed a small bug, a naive solution would be to call the mask into the "def select_reference_point(...)"

logger.info("Selecting reference point")
quality_file_values = io.load_gdal(quality_file, masked=True)

and multiply the quality_file_values with the mask to remove masked areas, but i am not sure if there would be a more appropriate solution.

Any ideas, or thoughts?

Many thanks for your time :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions