本文整理汇总了Python中osgeo.gdal.GMF_ALPHA属性的典型用法代码示例。如果您正苦于以下问题:Python gdal.GMF_ALPHA属性的具体用法?Python gdal.GMF_ALPHA怎么用?Python gdal.GMF_ALPHA使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类osgeo.gdal
的用法示例。
在下文中一共展示了gdal.GMF_ALPHA属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: nb_data_bands
# 需要导入模块: from osgeo import gdal [as 别名]
# 或者: from osgeo.gdal import GMF_ALPHA [as 别名]
def nb_data_bands(dataset):
"""
Return the number of data (non-alpha) bands of a gdal dataset
"""
alphaband = dataset.GetRasterBand(1).GetMaskBand()
if ((alphaband.GetMaskFlags() & gdal.GMF_ALPHA) or
dataset.RasterCount == 4 or
dataset.RasterCount == 2):
return dataset.RasterCount - 1
else:
return dataset.RasterCount
示例2: open_inumpyut
# 需要导入模块: from osgeo import gdal [as 别名]
# 或者: from osgeo.gdal import GMF_ALPHA [as 别名]
def open_inumpyut(self,vrt):
if vrt:
self.in_ds = gdal.Open(vrt, gdal.GA_ReadOnly)
else:
raise Exception("No vrt file was specified")
if self.options.verbose:
print("Inumpyut file:", "( %sP x %sL - %s bands)" % (self.in_ds.RasterXSize, self.in_ds.RasterYSize, self.in_ds.RasterCount))
if not self.in_ds:
# Note: GDAL prints the ERROR message too
self.error("It is not possible to open the inumpyut file '%s'." % vrt )
if self.in_ds.RasterCount == 0:
self.error( "Inumpyut file '%s' has no raster band" % vrt )
self.out_ds = self.in_ds
# Get alpha band (either directly or from NODATA value)
self.alphaband = self.out_ds.GetRasterBand(1).GetMaskBand()
if (self.alphaband.GetMaskFlags() & gdal.GMF_ALPHA) or self.out_ds.RasterCount==4 or self.out_ds.RasterCount==2:
self.dataBandsCount = self.out_ds.RasterCount - 1
else:
self.dataBandsCount = self.out_ds.RasterCount
# -------------------------------------------------------------------------