masking using another raster


Gregory, Matthew
 

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

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