Skip to content
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

Merged
merged 5 commits into from
May 18, 2021

Conversation

erikmannerfelt
Copy link
Contributor

@erikmannerfelt erikmannerfelt commented May 13, 2021

We are getting quite many issues, and many of them are relatively small. I therefore decided to just tackle a few in one PR!

@erikmannerfelt erikmannerfelt linked an issue May 14, 2021 that may be closed by this pull request
rhugonnet
rhugonnet previously approved these changes May 17, 2021
Copy link
Member

@rhugonnet rhugonnet left a 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 👍

xdem/coreg.py Show resolved Hide resolved
xdem/coreg.py Show resolved Hide resolved
@erikmannerfelt erikmannerfelt merged commit f9e3137 into GlacioHack:main May 18, 2021
@erikmannerfelt erikmannerfelt deleted the coreg_improvements branch May 18, 2021 05:50
biascorr = coreg.BiasCorr()
icp = coreg.ICP()

pytest.raises(ValueError, biascorr.fit, dem1, dem2, transform=affine)
Copy link
Member

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??

Copy link
Contributor Author

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",
Copy link
Member

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()
Copy link
Member

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?

@adehecq
Copy link
Member

adehecq commented May 18, 2021

Very nice fixes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants