src/cirrus/builtins/tasks/add-preview/lambda_function.py
def cogify(fin, fout, logger, nodata=None):
    """ Turn a geospatial image into a COG """
    logger.info(f"Turning {fin} into COG named {fout}")
    output_profile = cog_profiles.get('deflate')
    output_profile.update(dict(BIGTIFF=os.environ.get("BIGTIFF", "IF_SAFER")))
    output_profile['blockxsize'] = 256
    output_profile['blockysize'] = 256

    threads = 1
    overview_blocksize = 128

    config = dict(
        NUM_THREADS=threads,
        GDAL_TIFF_INTERNAL_MASK=os.environ.get("GDAL_TIFF_INTERNAL_MASK", True),
        GDAL_TIFF_OVR_BLOCKSIZE=str(overview_blocksize),
    )
    cog_translate(
        fin,
        fout,
        output_profile,
        config=config,
        nodata=nodata,
        overview_resampling="bilinear",
        add_mask=False,
        web_optimized=False,
    )
    return fout
 Turn a geospatial image into a COG 
Turn a geospatial image into a COG
Turn a geospatial image into a COG
def cogify(fin, fout, logger, nodata=None):
    logger.info(f"Turning {fin} into COG named {fout}")
    output_profile = cog_profiles.get('deflate')
    output_profile.update(dict(BIGTIFF=os.environ.get("BIGTIFF", "IF_SAFER")))
    output_profile['blockxsize'] = 256
    output_profile['blockysize'] = 256
    threads = 1
    overview_blocksize = 128
    config = dict(
        NUM_THREADS=threads,
        GDAL_TIFF_INTERNAL_MASK=os.environ.get("GDAL_TIFF_INTERNAL_MASK", True),
        GDAL_TIFF_OVR_BLOCKSIZE=str(overview_blocksize),
    )
    cog_translate(
        fin,
        fout,
        output_profile,
        config=config,
        nodata=nodata,
        overview_resampling="bilinear",
        add_mask=False,
        web_optimized=False,
    )
    return fout
def cogify ( fin , fout , logger , nodata = None ) : logger . info ( f"Turning {fin} into COG named {fout}" ) output_profile = cog_profiles . get ( 'deflate' ) output_profile . update ( dict ( BIGTIFF = os . environ . get ( "BIGTIFF" , "IF_SAFER" ) ) ) output_profile [ 'blockxsize' ] = 256 output_profile [ 'blockysize' ] = 256 threads = 1 overview_blocksize = 128 config = dict ( NUM_THREADS = threads , GDAL_TIFF_INTERNAL_MASK = os . environ . get ( "GDAL_TIFF_INTERNAL_MASK" , True ) , GDAL_TIFF_OVR_BLOCKSIZE = str ( overview_blocksize ) , ) cog_translate ( fin , fout , output_profile , config = config , nodata = nodata , overview_resampling = "bilinear" , add_mask = False , web_optimized = False , ) return fout
Turn a geospatial image into a COG
Turn a geospatial image into a COG
""" Turn a geospatial image into a COG """
fin
fout
logger
nodata