Skip to content

Comments

Don't fill masked output when reprojecting#3289

Closed
omarkhan wants to merge 1 commit intorasterio:mainfrom
useyardstick:reproject-masked
Closed

Don't fill masked output when reprojecting#3289
omarkhan wants to merge 1 commit intorasterio:mainfrom
useyardstick:reproject-masked

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
@snowman2 snowman2 added this to the 1.4.4 milestone Nov 6, 2025
@snowman2 snowman2 modified the milestones: 1.4.4, 1.5.0 Dec 5, 2025
@snowman2 snowman2 removed the backport-1.4 To be backported to maint-1.4 label Dec 10, 2025
@snowman2
Copy link
Member

@omarkhan mind updating this PR to the latest?

@omarkhan
Copy link
Contributor Author

Apologies - I no longer have permission to push to this branch. I rebased here instead: #3471

@snowman2 snowman2 closed this Dec 11, 2025
@snowman2 snowman2 removed this from the 1.5.0 milestone Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants