odc.geo.xr.ODCExtensionDa.to_cog
- ODCExtensionDa.to_cog(blocksize: int | None = None, ovr_blocksize: int | None = None, overviews: Iterable[xr.DataArray] | None = None, overview_resampling: str | None = None, overview_levels: List[int] | None = None, use_windowed_writes: bool = False, intermediate_compression: bool | str | Dict[str, Any] = False, tags: Dict[str, Any] | None = None, **extra_rio_opts) bytes
Compress
xarray.DataArrayinto Cloud Optimized GeoTiff bytes in memory.This function doesn’t write to disk, it compresses in RAM, which is useful for saving data to S3 or other cloud object stores.
- Parameters:
geo_im (
DataArray) –xarray.DataArraywith crsblocksize (
Optional[int]) – Size of internal tiff tiles (512x512 pixels)ovr_blocksize (
Optional[int]) – Size of internal tiles in overview images (defaults to blocksize)overviews (
Optional[Iterable[DataArray]]) – Write pre-computed overviews if suppliedoverview_resampling (
Optional[str]) – Use this resampling when computing overviewsoverview_levels (
Optional[List[int]]) – List of shrink factors to compute overiews for: [2,4,8,16,32]nodata – Set
nodataflag to this value if supplied, by defaultnodatais read from the attributes of the input array (geo_im.attrs['nodata']).use_windowed_writes (
bool) – Write image block by block (might need this for large images)intermediate_compression (
Union[bool,str,Dict[str,Any]]) – Configure compression settings for first pass write , default is no compressiontags (
Optional[Dict[str,Any]]) – Dictionary of tags to write into the output file. These are written as GDAL Metadata items in the GeoTIFF file.extra_rio_opts – Any other option is passed to
rasterio.open
- Return type:
- Returns:
In-memory GeoTiff file as bytes