Improve no overlap ref/dem behaviour in accuracy worflow - #989
Improve no overlap ref/dem behaviour in accuracy worflow#989marinebcht wants to merge 2 commits into
Conversation
| ("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"]), |
There was a problem hiding this comment.
ex 5 and 6 : no overlap => moved to test_no_overlap()
| 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."): |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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 😉
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 NaNsNow, 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().