odc.geo.cog.save_cog_with_dask
- odc.geo.cog.save_cog_with_dask(xx, dst='', *, compression=<odc.geo.types.Unset object>, compressionargs=None, level=None, predictor=<odc.geo.types.Unset object>, blocksize=<odc.geo.types.Unset object>, bigtiff=True, overview_resampling='nearest', tile_batching=4, tile_batching_threshold=20, merge_compressed_overviews=4, aws=None, azure=None, client=None, stats=True, **kw)[source]
Save a Cloud Optimized GeoTIFF to S3, Azure Blob Storage, or file with Dask.
To optimise performance, pre-chunk your data to the desired COG block sizes. Then configure batching and overview merging as needed:
tile_batching is how many tiles get grouped into a single compression task. If it’s an integer, that fixed number of tiles are compressed together. If it’s a callable, it is given the total tile count and returns a number of tiles to compress at once. Combining small tile tasks can reduce overhead.
tile_batching_threshold is the minimum number of tiles in a given layer before any tile batching occurs. If a layer has fewer tiles than this threshold, batching is skipped because overhead might outweigh the benefits.
merge_compressed_overviews merges n topmost overview layers after they have been compressed, reducing overhead from having multiple small overview layers. If you only have a few overviews, you can disable or lower this. By default, it’s set to merge up to four of the highest overview layers.
- Parameters:
xx (
DataArray) – Pixels asxarray.DataArraybacked by Dask.dst (
str) – S3, Azure URL, or file path.compression (
Union[str,Unset]) – Compression to use, default isDEFLATE.level (
Union[int,float,None]) – Compression “level”, depends on chosen compression.predictor (
Union[int,bool,Unset]) – TIFF predictor setting.compressionargs (
Optional[Any]) – Any other compression arguments.overview_resampling (
Union[int,str]) – Resampling method used for computing overviews.tile_batching (
Union[int,Callable[[int],int]]) – How many tiles to group into each compression task. Can be an integer or a function of total tile count. Default is 4.tile_batching_threshold (
int) – Minimum number of tiles in a layer before batching is applied. Default is 20.merge_compressed_overviews (
Optional[int]) – Merges that many highest-level overview layers after compression into a single chunk. Default is 4. Set to None or 0 to disable merging.blocksize (
Union[Unset,int,list[Union[int,tuple[int,int]]]]) – Configure block sizes for main and overview images.bigtiff (
bool) – Generate BigTIFF by default, set toFalseto disable.aws (
Optional[dict[str,Any]]) – Configure AWS write access.azure (
Optional[dict[str,Any]]) – Azure credentials/config.stats (
bool|int) – Set to False to disable stats computation. If True, uses a mid-level layer to compute stats.
- Return type:
- Returns:
Dask delayed.