-
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
Add Initial shift Capability to DEM Coregistration #650
Conversation
Quick note, the tests you are adding are in a xdem/tests/test_coreg/test_workflows.py Line 186 in 22dbe7c
I see some code in this test that is now deprecated (for example using == to check raster equality was an old choice, now changed to raster_equal() to mirror NumPy and leave == for element-wise equality, as for arrays). I will update that quickly in a separate PR and see if I can make the original test pass 😉
|
72db165
to
e7f3724
Compare
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.
I can't remember if we talked about adding a section in the documentation.
6b07e67
to
d31d074
Compare
@adebardo I added xdem.coreg.workflows.dem_coregistration in API documentation, and a raise when an estimated shift is provided but the coregistration method is not affine |
@duboise-cnes @rhugonnet it's good for you ? |
This is great, thanks! Just a couple comments above that can be solved quickly 😄 (Can also remove "xdem" in the PR title, to echo the comment on the argument description!) |
Additionally, I think this PR raises a question for future discussion (no need to answer this to merge this PR, just for the record): Recently we had been moving all functions to be only object method like It's simply about moving the functionality elsewhere, so minimal effort once we have decided on a format. |
d31d074
to
79c4eab
Compare
@rhugonnet many thanks for your feedback.
|
@vschaffn Perfect!
Actually the There was a different small issue with |
79c4eab
to
6e5ab5f
Compare
@rhugonnet thanks for your modifications. I added a |
6e5ab5f
to
5fc282c
Compare
4e182bc
to
ba50aa9
Compare
Resolves #603.
Description:
This PR introduces the ability to specify an initial shift (in X and Y) for DEM co-registration. The key changes include the integration of an
estimated_initial_shift
parameter in thedem_coregistration()
function, allowing users to apply a custom translation (affine-based) to the source DEM before coregistration.Key Modifications:
dem_coregistration()
function:estimated_initial_shift
parameter is added, allowing users to input a list representing the initial shifts along the X and Y axes.geoutils.translate()
based on the calculated pixel resolution.shift_x
andshift_y
values in the coregistration method’s metadata (meta['outputs']['affine']
) are updated to include the initial shifts.Raise
TypeError
if the coregistration method or one of the coregistration method in the coregistration pipeline is not affine when an initial shift is provided.Recursive Shift Update Logic:
update_shift()
function is implemented to handle bothCoreg
andCoregPipeline
objects, ensuring that the shift is propagated across all coregistration steps in a pipeline.Coreg
objects.Unit Tests:
estimated_initial_shift
parameter.TypeError
is raised an initial shift is provided and the coregistration method is not affine.How It Works:
estimated_initial_shift
input, given as a list[x_shift, y_shift]
, is multiplied by the DEM’s pixel resolution to calculate the translation in map units.shift_x
andshift_y
in themeta
are updated accordingly.CoregPipeline
, this process is repeated for each coregistration step to ensure consistency.Example:
In this case, the source DEM is initially translated by 10 pixels in the X direction and 5 pixels in the Y direction before the coregistration process begins.
Documentation
estimated_initial_shift
parameter and its usage.