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