I have a raster which I want to crop multiple times using different shapefiles. My code uses
mask method which returns numpy array and its metadata:
out_img, out_transform = mask(raster=data, shapes=coords, crop=True)
I run different kinds of thresholding on
out_img and I want to crop it again using another shapefile but I'm not sure how to do that since
out_img is simply a numpy array.
Do I need to save
out_transform as TIFF, load it and use
mask method again? Is there any more straightforward method of achieving it (i.e. without saving the intermediate steps)?