Always prepare data in accuracy worflow (coreg/no coreg process)#873
Always prepare data in accuracy worflow (coreg/no coreg process)#873marinebcht wants to merge 17 commits intoGlacioHack:mainfrom
Conversation
|
@marinebcht I know this is a draft, but for info, the line changes of the PR seem to be mixed with recent history, so we can't see what the new changes are. A good solution to tackle this is usually to do beforehand: To correct a posteriori, I usually have to Google to know what to do... 😅 |
18dff40 to
93a622c
Compare
|
I repaired my branch :) Had to git rebase + git skip so many time .. ^^ |
That's perfect for the issue for the new arrivals document ;) |
20b30b4 to
366cac4
Compare
bdfa5fe to
47c379d
Compare
|
@belletva @adebardo @rhugonnet @adehecq I think this PR is done :) |
|
Great, thanks @marinebcht! The PR was very well explained, and reviewing the code changes I don't have much to add 🙂 One question: I see you |
|
Thanks a lot @rhugonnet 😎 |
|
@marinebcht Perfect! I think we can slightly adjust the note: The value CLI users don't know what "the dictionary" is, I think? It's internal mechanics, just for us to convert the YAML into Python API arguments. They don't have to know about it. So we can remove! Maybe we adjust into something like: We accept both |
3e59998 to
85907d4
Compare
85907d4 to
921cbc6
Compare
Resolves #840
Currently, in the CLI, the data are reprojected and intersected (=preparation) only when the user enables coregistration. The purpose of this PR is to always prepare the data, even when the coreg process is not asked.
Thus, the
_prepare_datas_for_coreg()function is now called_prepare_datas()at the beginning of the process, if the value ofsampling_gridis not None, outside of theif self.compute_coregcondition.Config
Since the accuracy workflow requires the
sampling_gridparameter to perform the reprojection, coregistration or not, this parameters was moved to inputs :It can be equals to :
"reference_elev"to reprojectto_be_aligned_elevtoreference_elev"to_be_aligned_elev"to reprojectreference_elevtoto_be_aligned_elevnull, if no reprojection/intersection wanted BUT its is required in case of a coreg process (Error: 'In case of a coregistration process, "sampling grid" must be set to ''"reference_elev" or "to_be_aligned_elev"') AND the workflow may generate an error if the two inputs have not the same shape, transform and CRS.As the process key became more critic, I added it in the template_config (=True) here
/!\ During YAML reading, None is serialized as "None". A function was added to correct this behaviour + little note in the doc.
Test
The test consists of :
We obtaining
Total counts = N2in both stats. If samling_grid = null, it raises of an error.The two intermediate rasters to_be_aligned_elev_reprojected.tif and reference_elev_reprojected.tif are now generated by
_prepare_datas()when the level is greater than 1.Also, I added a test for the
_prepare_datas()function: test_prepa_data, covering cropped inputs, no intersection and bothsampling_gridvalues.CLI improvment
For topo and accuracy workflow, I proposed to add also the optional --output (already present for --config) for --template-config to save the dict directely in a file (print if not).
xdem topo --template-config template_config.yamlgives: