def mask(self, vector, mask_shape_nodata=False):
        """
        Set pixels outside vector as nodata.

        :param vector: GeoVector, GeoFeature, FeatureCollection
        :param mask_shape_nodata: if True - pixels inside shape are set nodata, if False - outside shape is nodata
        :return: GeoRaster2
        """
        from telluric.collections import BaseCollection

        # crop raster to reduce memory footprint
        cropped = self.crop(vector)

        if isinstance(vector, BaseCollection):
            shapes = [cropped.to_raster(feature) for feature in vector]
        else:
            shapes = [cropped.to_raster(vector)]

        mask = geometry_mask(shapes, (cropped.height, cropped.width), Affine.identity(), invert=mask_shape_nodata)
        masked = cropped.deepcopy_with()
        masked.image.mask |= mask
        return masked
def mask ( self , vector , mask_shape_nodata = False ) : from telluric . collections import BaseCollection cropped = self . crop ( vector ) if isinstance ( vector , BaseCollection ) : shapes = [ cropped . to_raster ( feature ) for feature in vector ] else : shapes = [ cropped . to_raster ( vector ) ] mask = geometry_mask ( shapes , ( cropped . height , cropped . width ) , Affine . identity ( ) , invert = mask_shape_nodata ) masked = cropped . deepcopy_with ( ) masked . image . mask |= mask return masked
Set pixels outside vector as nodata.

        :param vector: GeoVector, GeoFeature, FeatureCollection
        :param mask_shape_nodata: if True - pixels inside shape are set nodata, if False - outside shape is nodata
        :return: GeoRaster2