def build_pyramid(filename, verbose=False):
    if 'BQA' in filename:
        resample_alg = 'nearest'
    else:
        resample_alg = 'average'

    run_command(
        'gdaladdo %s -ro -r %s --config COMPRESS_OVERVIEW DEFLATE --config PREDICTOR_OVERVIEW 2 --config GDAL_TIFF_OVR_BLOCKSIZE 512 %s 3 9 27 81' % (
            '' if verbose else '-q',
            resample_alg,
            filename),
        verbose=verbose)
dataset/ETHPy150Open landsat-pds/landsat_ingestor/ingestor/splitter.py/build_pyramid/original