greenwich/raster.py
def new(self, size=(), affine=None):
        """Derive new Raster instances.

        Keyword args:
        size -- tuple of image size (width, height)
        affine -- AffineTransform or six-tuple of geotransformation values
        """
        size = size or self.size + (len(self),)
        band = self.ds.GetRasterBand(1)
        driver = ImageDriver('MEM')
        rcopy = driver.raster(driver.ShortName, size, band.DataType)
        rcopy.sref = self.GetProjection()
        rcopy.affine = affine or tuple(self.affine)
        colors = band.GetColorTable()
        for outband in rcopy:
            if self.nodata is not None:
                outband.SetNoDataValue(self.nodata)
            if colors:
                outband.SetColorTable(colors)
        return rcopy
def new(self, size=(), affine=None):
        size = size or self.size + (len(self),)
        band = self.ds.GetRasterBand(1)
        driver = ImageDriver('MEM')
        rcopy = driver.raster(driver.ShortName, size, band.DataType)
        rcopy.sref = self.GetProjection()
        rcopy.affine = affine or tuple(self.affine)
        colors = band.GetColorTable()
        for outband in rcopy:
            if self.nodata is not None:
                outband.SetNoDataValue(self.nodata)
            if colors:
                outband.SetColorTable(colors)
        return rcopy
def new ( self , size = ( ) , affine = None ) : size = size or self . size + ( len ( self ) , ) band = self . ds . GetRasterBand ( 1 ) driver = ImageDriver ( 'MEM' ) rcopy = driver . raster ( driver . ShortName , size , band . DataType ) rcopy . sref = self . GetProjection ( ) rcopy . affine = affine or tuple ( self . affine ) colors = band . GetColorTable ( ) for outband in rcopy : if self . nodata is not None : outband . SetNoDataValue ( self . nodata ) if colors : outband . SetColorTable ( colors ) return rcopy
Derive new Raster instances.

        Keyword args:
        size -- tuple of image size (width, height)
        affine -- AffineTransform or six-tuple of geotransformation values
Derive new Raster instances .