

def get_overview_data(fn, band_index=1, level=(- 1)):
    'Returns an array containing data from an overview.\n\n    fn         - path to raster file\n    band_index - band number to get overview for\n    level      - overview level, where 1 is the highest resolution;\n                 the coarsest can be retrieved with -1\n    '
    ds = gdal.Open(fn)
    band = ds.GetRasterBand(band_index)
    if (level > 0):
        ov_band = band.GetOverview(level)
    else:
        num_ov = band.GetOverviewCount()
        ov_band = band.GetOverview((num_ov + level))
    return ov_band.ReadAsArray()

dataset/ETHPy150Open cgarrard/osgeopy-code/Chapter13/listing13_5.py get_overview_data/original