RASTER OPERATIONS.
479def calculate_overviews(ds, band_from = None, band_to = None):
480 assert ds is not None
481
482 if band_from is None:
483 band_from = 0
484 if band_to is None:
485 band_to = ds.RasterCount
486
487 assert band_to <= ds.RasterCount,'Failed checking band_to=%d <= RasterCount=%d' % (band_to,ds.RasterCount)
488 assert band_from <= band_to
489
490 nov = 0
491 for i in range(band_from, band_to + 1):
492 n = ds.GetRasterBand(i).GetOverviewCount()
493 if 0 == nov:
494 nov = n
495 assert n == nov, 'Number of raster overviews is not the same for all bands'
496
497 return nov
498