Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Don't fill masked output when reprojecting #3289

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

omarkhan
Copy link
Contributor

@omarkhan omarkhan commented Jan 13, 2025

#3156 added a masked argument to rasterio.warp.reproject:

rasterio/rasterio/warp.py

Lines 254 to 255 in 64474c1

masked: bool, optional
If True and destination is None, return a masked array.

I tried calling rasterio.warp.reproject with masked=True, without passing a destination array. The documentation above suggests the output should be a masked array, but it's not. Reading through the code, it looks like a masked array is created but then immediately filled in:

destination = np.ma.masked_array(destination).filled(dst_nodata)

I tried removing the .filled(dst_nodata). The tests pass when I run them locally. I added a small test to check that the output is a masked array.

@sgillies sgillies self-assigned this Feb 4, 2025
@sgillies sgillies added bug warp backport-1.4 To be backported to maint-1.4 labels Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-1.4 To be backported to maint-1.4 bug warp
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants