def _crop(self, bounds, xsize=None, ysize=None, resampling=Resampling.cubic):
        """Crop raster outside vector (convex hull).

        :param bounds: bounds on image
        :param xsize: output raster width, None for full resolution
        :param ysize: output raster height, None for full resolution
        :param resampling: reprojection resampling method, default `cubic`

        :return: GeoRaster2
        """
        out_raster = self[
            int(bounds[0]): int(bounds[2]),
            int(bounds[1]): int(bounds[3])
        ]

        if xsize and ysize:
            if not (xsize == out_raster.width and ysize == out_raster.height):
                out_raster = out_raster.resize(dest_width=xsize, dest_height=ysize, resampling=resampling)
        return out_raster
def _crop ( self , bounds , xsize = None , ysize = None , resampling = Resampling . cubic ) : out_raster = self [ int ( bounds [ 0 ] ) : int ( bounds [ 2 ] ) , int ( bounds [ 1 ] ) : int ( bounds [ 3 ] ) ] if xsize and ysize : if not ( xsize == out_raster . width and ysize == out_raster . height ) : out_raster = out_raster . resize ( dest_width = xsize , dest_height = ysize , resampling = resampling ) return out_raster
Crop raster outside vector (convex hull).

        :param bounds: bounds on image
        :param xsize: output raster width, None for full resolution
        :param ysize: output raster height, None for full resolution
        :param resampling: reprojection resampling method, default `cubic`

        :return: GeoRaster2