Re: masking using another raster

Sean Gillies

Hi Matt,

Yes, I think that's the only builtin command that will do it. Enhancing rio-stack to more clearly provide this feature might be feasible. Note that few formats support addition of a mask and that adding a mask generally requires creation of a new file.

On Fri, Oct 11, 2019 at 3:12 PM Gregory, Matthew <matt.gregory@...> wrote:
Hi all,

Simple question, but I want to make sure I'm doing this the canonical way. 

Assume two single-band rasters with identical projections/transforms and one of the rasters has NODATA pixels defining an irregular shape and 1 otherwise.  Is the best way to mask the other raster to use rio calc? e.g.:

  rio calc "(* (read 1) (read 2))" -o out.tif input.tif mask.tif

This works, but didn't know if a different utility is better suited.

thanks, matt

Sean Gillies

Join to automatically receive all group messages.