xdem
xdem copied to clipboard
Raise type errors for coregistration inputs using existing TypedDicts
Context
We have highlighted that typing errors in APIs are not very clear.
aligned_dem = tba_dem.coregister_3d(ref_dem, xdem.coreg.NuthKaab(max_iterations="6"))
@rhugonnet indicates that this relies on the typing work of our classes.
Yes, the static typing works (if users use an IDE, they'll probably see that their argument is wrong), but the code doesn't fail elegantly if not because we aren't actually checking the inputs.
It isn't too much work to raise proper TypeError because we can use the TypedDict we have defined in coreg/base to automatically check those with what's already defined.