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

Fix QgsRasterLayer and QgsRasterBlock as_numpy methods #60275

Conversation

merydian
Copy link
Contributor

This PR addresses two issues:

  1. QgsRasterLayer.as_numpy(use_masking=True) previously did not return a masked array.
  2. QgsRasterBlock.as_numpy() did not use the correct fill value.

The updates ensure:
QgsRasterLayer.as_numpy(use_masking=True) now returns masked arrays using numpy.ma.stack().
QgsRasterBlock.as_numpy() correctly applies the set noDataValue for filling, defaulting to 0 if no value is set.

Fixes #60205.

@merydian merydian closed this Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[PyQGIS] as_numpy(use_masking=True) doesn't work well
1 participant