Re: can resampling not populate cell if source has nodata?

Nick Forfinski-Sarkozi
 

FYI...I was able to achieve the desired behavior by "lying" about the nodata value.  The actual nodata was nan, but when I specified something else (e.g., nodata=-9999) in the profile, the resampled raster didn't contain values for cells corresponding to source nans.


On Wed, May 27, 2020 at 4:20 PM Sean Gillies via groups.io <sean=mapbox.com@groups.io> wrote:
I see what you mean. Rasterio doesn't have a built in option for this, unless there is a GDAL resampling trick that I am not aware of.

On Wed, May 27, 2020 at 9:55 AM <nick.forfinski@...> wrote:
Hi Sean.  Thanks for the message.  I understand your example, but I may have been confusing in my email.  I think I'm asking something different.  Is there a way to force the resampling process to not populate a resampled value where there are corresponding nodata values in the original raster?  For example, in the image below, the lighter 5-m purple raster is the resampled version of the darker 1-m blue raster.  Many of the resampled raster's pixels correspond to gaps in the original raster.  How could I resample so that all 25 source cells are required to produce a resampled value?  
 
Thanks again for your help and a great module,
Nick
 



--
Sean Gillies

Join main@rasterio.groups.io to automatically receive all group messages.