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

Masking with reproject #251

Open
mmann1123 opened this issue Mar 29, 2023 · 1 comment
Open

Masking with reproject #251

mmann1123 opened this issue Mar 29, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@mmann1123
Copy link
Collaborator

@jgrss

It looks like reprojecting is happening before masking no data. Not sure this is urgent but wanted to put it on the radar. Given the way nodata is implemented could we just run mask_nodata() before projection?

import geowombat as gw
import matplotlib.pyplot as plt
from geowombat.data import l8_224078_20200518    

fig, ax = plt.subplots(dpi=200)

# set desired CRS with config.update
with gw.config.update(ref_crs='epsg:32618'):
    # define resampling method
    with gw.open(l8_224078_20200518, 
                 resampling='cubic',
                 nodata=0) as src:
        print(src.crs)
        src.gw.mask_nodata().plot.imshow(robust=True, ax=ax)
plt.tight_layout(pad=1)

output

@mmann1123 mmann1123 added the bug Something isn't working label Mar 29, 2023
@jgrss
Copy link
Owner

jgrss commented Mar 29, 2023

Thanks, I'll look into this. I think this is happening in WarpedVRT because we pass nodata and the destination CRS and transform to that rasterio method. And this occurs with method='cubic' because 0s (nodata in this image) are converted to 1s.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants