-
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
Consistency fixes, and added error/residual methods to Coreg class. #121
Consistency fixes, and added error/residual methods to Coreg class. #121
Conversation
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.
Very nice list of fixes 👍
…ich is not always faster on GitHub's CI
biascorr = coreg.BiasCorr() | ||
icp = coreg.ICP() | ||
|
||
pytest.raises(ValueError, biascorr.fit, dem1, dem2, transform=affine) |
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.
Does this function just check that the method biascorr.fit with arguments dem1, dem2 and tranform raises a ValueError??
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.
Yes!
|
||
def error(self, reference_dem: Union[np.ndarray, np.ma.masked_array], | ||
dem_to_be_aligned: Union[np.ndarray, np.ma.masked_array], | ||
error_type: str = "nmad", |
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.
Looks really great! Just one comment is that sometimes one might want more than just one statistics, and it is counter-productive to calculate the residuals each time. So it would be nice to be able to request several statistics at once rather than only one...
entries = mask.ds[mask.ds.intersects(shapely.geometry.box(*self.bounds))] | ||
|
||
ddem_mask = nans.copy() | ||
ddem_mask = nans.copy().squeeze() |
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 thought in this new implementation, the squeeze was not needed anymore?
Very nice fixes! |
We are getting quite many issues, and many of them are relatively small. I therefore decided to just tackle a few in one PR!
Coreg
centroid if it exists #114: ACoreg.centroid()
method now exists which fetches the centroid if it exists.coreg.ICP
may raise confusing cv2.error instead of a builtin error #113: A more descriptiveValueError
replaces the cv2 error.coreg.BiasCorr
warns for all-nans but doesn't fail #112: AllCoreg
approaches now raise an error if only nans are encountered.apply_matrix()
function further. #110: The better "check if matrix is only vertical" suggestion by @adehecq is implemented.spatial_tools.get_array_and_mask()
now converts to (height, width) and raises an error if it can't be converted..error()
method or similar toCoreg
class #76: ACoreg.residuals()
method is added. Then aCoreg.error()
method is added for preset error measures made form the residuals.spatial_tools.nmad()
to work properly with masked_arrays. (previously, the mask was ignored)