Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Convert COGs To Zarr

ESA

COG is excellent for individual rasters. Zarr is often better when many rasters form a logical multidimensional collection, for example one COG per depth or one COG per time step. This notebook shows both a single-layer conversion and a depth-stack conversion.

Single COG To Single-Layer Zarr

Loading...
/home/krasen/micromamba/envs/pangeo/lib/python3.13/site-packages/zarr/api/asynchronous.py:244: ZarrUserWarning: Consolidated metadata is currently not part in the Zarr format 3 specification. It may not be supported by other zarr implementations and may change in the future.
  warnings.warn(
<xarray.backends.zarr.ZarrStore at 0x79054c1b3e20>

Stack Depth COGs Into One Zarr

The depth value is parsed from filenames like Tice_EPSG3031_depth_500m.tif. This keeps the stack robust if the selected depths change.

[PosixPath('/home/krasen/hackathon-repo/downloaded_data/Tice_EPSG3031_depth_0m.tif'), PosixPath('/home/krasen/hackathon-repo/downloaded_data/Tice_EPSG3031_depth_500m.tif'), PosixPath('/home/krasen/hackathon-repo/downloaded_data/Tice_EPSG3031_depth_1000m.tif'), PosixPath('/home/krasen/hackathon-repo/downloaded_data/Tice_EPSG3031_depth_1500m.tif'), PosixPath('/home/krasen/hackathon-repo/downloaded_data/Tice_EPSG3031_depth_2000m.tif'), PosixPath('/home/krasen/hackathon-repo/downloaded_data/Tice_EPSG3031_depth_3000m.tif')]
Loading...
Loading...
/home/krasen/micromamba/envs/pangeo/lib/python3.13/site-packages/zarr/api/asynchronous.py:244: ZarrUserWarning: Consolidated metadata is currently not part in the Zarr format 3 specification. It may not be supported by other zarr implementations and may change in the future.
  warnings.warn(
<xarray.backends.zarr.ZarrStore at 0x79054be55d00>