class documentation

class GDALBand(GDALRasterBase):

View In Hierarchy

Wrap a GDAL raster band, needs to be obtained from a GDALRaster object.
Method __init__ Undocumented
Method ​_flush Call the flush method on the Band's parent raster and force a refresh of the statistics attribute when requested the next time.
Method color​_interp Return the GDAL color interpretation for this band.
Method data No summary
Method datatype Return the GDAL Pixel Datatype for this band.
Method nodata​_value.setter Set the nodata value for this band.
Method statistics Compute statistics on the pixel values of this band.
Instance Variable ​_ptr Undocumented
Instance Variable ​_stats​_refresh Undocumented
Instance Variable source Undocumented
Property description Return the description string of the band.
Property height Height (Y axis) in pixels of the band.
Property max Return the maximum pixel value for this band.
Property mean Return the mean of all pixel values of this band.
Property min Return the minimum pixel value for this band.
Property nodata​_value Return the nodata value for this band, or None if it isn't set.
Property pixel​_count Return the total number of pixels in this band.
Property std Return the standard deviation of all pixel values of this band.
Property width Width (X axis) in pixels of the band.

Inherited from GDALRasterBase:

Method metadata.setter Set the metadata. Update only the domains that are contained in the value dictionary.
Property metadata Return the metadata for this raster or band. The return value is a nested dictionary, where the first-level key is the metadata domain and the second-level is the metadata item names and values for that domain.

Inherited from CPointerBase (via GDALRasterBase, GDALBase):

Method __del__ Free the memory used by the C++ object.
Method ptr.setter Undocumented
Class Variable destructor Undocumented
Property ptr Undocumented
def __init__(self, source, index):

Undocumented

def _flush(self):
Call the flush method on the Band's parent raster and force a refresh of the statistics attribute when requested the next time.
def color_interp(self, as_string=False):
Return the GDAL color interpretation for this band.
def data(self, data=None, offset=None, size=None, shape=None, as_memoryview=False):

Read or writes pixel values for this band. Blocks of data can be accessed by specifying the width, height and offset of the desired block. The same specification can be used to update parts of a raster by providing an array of values.

Allowed input data types are bytes, memoryview, list, tuple, and array.

def datatype(self, as_string=False):
Return the GDAL Pixel Datatype for this band.
@nodata_value.setter
def nodata_value(self, value):
Set the nodata value for this band.
def statistics(self, refresh=False, approximate=False):

Compute statistics on the pixel values of this band.

The return value is a tuple with the following structure: (minimum, maximum, mean, standard deviation).

If approximate=True, the statistics may be computed based on overviews or a subset of image tiles.

If refresh=True, the statistics will be computed from the data directly, and the cache will be updated where applicable.

For empty bands (where all pixel values are nodata), all statistics values are returned as None.

For raster formats using Persistent Auxiliary Metadata (PAM) services, the statistics might be cached in an auxiliary file.

_ptr =
_stats_refresh: bool =

Undocumented

source =

Undocumented

@property
description =
Return the description string of the band.
@property
height =
Height (Y axis) in pixels of the band.
@property
max =
Return the maximum pixel value for this band.
@property
mean =
Return the mean of all pixel values of this band.
@property
min =
Return the minimum pixel value for this band.
@property
nodata_value =
Return the nodata value for this band, or None if it isn't set.
@property
pixel_count =
Return the total number of pixels in this band.
@property
std =
Return the standard deviation of all pixel values of this band.
@property
width =
Width (X axis) in pixels of the band.