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

User-input type checks of nodata bypassed in from_array() and other dependent functions #516

Closed
rhugonnet opened this issue Mar 14, 2024 · 0 comments · Fixed by #531
Closed
Labels
invalid This doesn't seem right priority

Comments

@rhugonnet
Copy link
Member

The from_array() function expects the nodata to be checked when calling the class with the dictionary of input values: https://github.com/GlacioHack/geoutils/blob/main/geoutils/raster/raster.py#L788
And rightfully so, as we have a nodata.setter() with a good list of checks: https://github.com/GlacioHack/geoutils/blob/main/geoutils/raster/raster.py#L1463

However the attribute is set during class instantiation by-passing the setter: https://github.com/GlacioHack/geoutils/blob/main/geoutils/raster/raster.py#L464
We need to use set_nodata(nodata, update_array=False, update_mask=False) during instantiation, or we could have any nodata from user input!

It would probably be good practice to this consistently for other data as well (CRS, transform):

  • Either have it in the .setter() and not every function that relies on the attribute as input,
  • Or have a consistent input check function written outside of the Raster class that is called at every occurence.
@rhugonnet rhugonnet changed the title User-input checks of nodata bypassed in from_array() and other dependent functions User-input type checks of nodata bypassed in from_array() and other dependent functions Mar 14, 2024
@rhugonnet rhugonnet added invalid This doesn't seem right priority labels Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant