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.

Create A COG From A GeoTIFF

ESA

Inspect The Source Raster

We check the CRS, dimensions, block layout, and nodata value before writing the COG. The source file can still be read lazily with rioxarray.

/home/krasen/hackathon-repo/downloaded_data/basal_melt_map_racmo_firn_air_corrected.tif is NOT a valid cloud optimized GeoTIFF

CRS: EPSG:3031
Size: 6120 x 6435
Bounds: BoundingBox(left=-3060277.25, bottom=-3217740.25, right=3059722.75, top=3217259.75)
Resolution: (1000.0, 1000.0)
Nodata: -3.4028234663852886e+38
Tiled: False
Block shapes: [(1, 6120)]
Loading...

Write The COG

driver="COG" asks GDAL/rasterio to create a cloud-optimized layout. Compression reduces object-store transfer size; 512-pixel blocks are a common starting point for analytical rasters.

Wrote /home/krasen/hackathon-repo/downloaded_data/basal_melt_map_racmo_firn_air_corrected_cog.tif
Source size: 150.3 MiB
COG size:    7.4 MiB
/home/krasen/hackathon-repo/downloaded_data/basal_melt_map_racmo_firn_air_corrected_cog.tif is a valid cloud optimized GeoTIFF

Total overview levels found: 4
<Figure size 1800x600 with 6 Axes>