Skip to content

Improve no overlap ref/dem behaviour in accuracy worflow - #989

Open
marinebcht wants to merge 2 commits into
GlacioHack:mainfrom
marinebcht:985_accuracy_no_overlap
Open

Improve no overlap ref/dem behaviour in accuracy worflow#989
marinebcht wants to merge 2 commits into
GlacioHack:mainfrom
marinebcht:985_accuracy_no_overlap

Conversation

@marinebcht

@marinebcht marinebcht commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Resolves #985

Before: the error message when ref and tba do not overlap was really not understable for ordinary users:
ValueError: 'dem_to_be_aligned' had only NaNs

Now, it is fixed:
ValueError: Reference and To-be-align elevations do not overlap.

Add/gather all tests with the different sampling_grid/coreg_process values in test_no_overlap().

("reference_elev", ["to_be_aligned_elev"]),
("to_be_aligned_elev", ["reference_elev"]),
("to_be_aligned_elev", ["to_be_aligned_elev"]),
("reference_elev", ["reference_elev", "to_be_aligned_elev"]),

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.

ex 5 and 6 : no overlap => moved to test_no_overlap()

@marinebcht
marinebcht requested a review from belletva August 7, 2026 09:24
user_config["inputs"]["to_be_aligned_elev"]["path_to_elev"] = str(tmp_path / "tba_cropped.tif")

workflows = Accuracy(user_config)
with pytest.raises(ValueError, match="Reference and To-be-align elevations do not overlap."):

@rhugonnet rhugonnet Aug 13, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's try to draft a more helpful message for users with more details and potential solutions, maybe something along those lines:
"Reference and to-be-aligned elevation datasets do not overlap horizontally. Their coregistration method '{coreg_method}' relies on elevation differencing, and thus produces only NaNs. To resolve this: If a large initial misalignment is expected, use a first coregistration method not requiring initial overlap such as ICP or CPD. If no large misalignment was expected, check the georeferencing of your data and re-set it manually with set_crs or set_transform."

@rhugonnet rhugonnet left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great initiative! I think we should move this error message directly into the coreg.base module, not only in the workflows, so that it is self-consistent and also applies to users of the Python API 😉

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.

Accuracy workflow when ref and tba do not overlap

2 participants