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

Add tests+functionality to assess the interchangeability of Rasters and arrays #178

Open
erikmannerfelt opened this issue Jul 3, 2021 · 0 comments
Labels
enhancement Feature improvement or request priority Needs to be fixed rapidly test-suite Issue related to testing

Comments

@erikmannerfelt
Copy link
Contributor

Brought up by @rhugonnet in #175.

Here is the conversation:

Actually, a big question raised by this:
With GlacioHack/GeoUtils#210 and this PR, we now have many use cases where we can use np.ndarray and Raster objects interchangeably. But there is still several functions for which it does not work, right? Such as terrain attributes.

Should we aim to have xdem working with np.ndarrays and Raster objects interchangeably? If yes, what is left to do? (I think that, @erikmannerfelt, you have the best viewpoint on all this!)
Also, it should be crystal clear when a Raster can be provided simply as a convenience and a np.ndarray would suffice, or when georeferenced data is absolutely necessary. It will get blurry for the users if we allow to provide both everywhere for convenience, so I'm not sure how to tackle this!

Since, geoutils==0.0.3, Rasters implement the array interface, so they should be possible to use interchangeably with ndarrays. The tests don't cover that "should" part, however, and Rasters are not consistently returned if provided as an argument. For now, all functions that show a Raster/RasterType argument/return type hint returns a RasterType if given a RasterType, and those who don't will return an ndarray/masked_array.

Long story short, the only way to validate how interchangeable they are is to include more tests!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature improvement or request priority Needs to be fixed rapidly test-suite Issue related to testing
Projects
None yet
Development

No branches or pull requests

2 participants