natcap/pygeoprocessing

Duplicate rasterization in `align_and_resize_raster_stack` when masking with a vector

Closed this issue · 1 comments

When using a vector mask in align_and_resize_raster_stack, the vector is rasterized once for each layer that needs to be aligned and masked - and if this is a big vector or a big raster, that can be prohibitively expensive. Runtime is not really an issue for small regions and/or at coarse resolutions, and especially if the vector has very simple geometry.

A preferable solution would be to only rasterize once and then reuse that vector mask once for each warp call.

Resolved in #367