-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement one-liner coregistration #267
Conversation
Bypassing tests since it is an opened issue addressed in PR #322. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to have a first version of this done! 😄
We probably don't want to spend to much time improving it right now, because the Coreg
classes will change and so will the code of this function.
In more details (not much can be done right now, just to keep track for the future), we would probably need to include:
- The
filtering
argument with the possibility to call classes offilters.py
that could be combined withCoreg
objects, - Same for
biascorr.py
classes, - Extract the statistics directly computed within the
Coreg
classes in._metadata
(that needs to become a user-available attribute) to stay fully consistent with the results of the classes, instead of re-performing them manually here, - Use the plots directly generated within the
Coreg
classes once those exist, - Have an option for co-registration with point data once this exists,
- Use
Coreg.pipeline()
instead of performing the steps manually.
And, inversely, some parameters of this function should probably be moved to Coreg
class so that they retain all flexibility:
- The
grid
argument should also be an option ofCoreg
objects, that always performs the same operation by default right now, - Adding
exclude_mask
,include_mask
might also be a great option, instead of just having aninlier_mask
that requires projecting vectors on the same grid, but the mask passed should retain full flexibility (Raster
object,Vector
objects, or both).
In short, eventually, I think the one-liner co-registration needs to become a convenience function that passes the most robust default parameters to a CoregPipeline
object and captures the outputs. All its options have to be available directly in the Coreg
classes, while maintaining complete flexibility.
Do you picture it the same, @adehecq?
:param src_dem_path: path to the input DEM to be coregistered | ||
:param ref_dem: path to the reference DEM | ||
:param out_dem_path: Path where to save the coregistered DEM. If set to None (default), will not save to file. | ||
:param shpfile: path to a vector file containing areas to be masked for coregistration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably use filename_vector
for clarity with the parameter naming of GeoUtils functions, or maybe something similar than this function https://github.com/GlacioHack/xdem/blob/main/xdem/spatialstats.py#L445 for flexibility on inclusion or exclusion of the shapefile.
:param vmode: The method to be used for vertically aligning the DEMs, e.g. mean/median bias correction or \ | ||
deramping. Can be any of {list(hmodes_dict.keys())}. | ||
:param deramp_degree: The degree of the polynomial for deramping. | ||
:param grid: the grid to be used during coregistration, set either to "ref" or "src". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name grid
is not so transparent as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would you use?
Good ideas yes.
Yes, yes and yes.
There is an option to provide a Coreg.pipeline directly to
Indeed, we could make the reprojection and creation of the
Yes, that seems sensible. |
This is mainly to fix issue #257.
See David and old own implementations for ideas.
This PR adds a function in
coreg.py
to run all the coregistration steps in one line, i.e.:To be added: