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.

Build STAC Metadata For A COG

ESA

This notebook derives spatial and raster metadata from the basal-melt COG and uses it to build a STAC Item. The same pattern applies to cloud-hosted COGs: derive machine-checkable fields from the asset wherever possible, then add human and provenance metadata explicitly.

Repository root: /home/krasen/hackathon-repo
Data directory: /home/krasen/hackathon-repo/downloaded_data

Derive Spatial And Raster Fields

EPSG: 3031
WGS84 bbox: (-180.0, -90.0, 180.0, -50.68637942059157)
Shape: [6435, 6120]
Data type: float32, nodata: -3.4028234663852886e+38

Create And Validate The STAC Item

{'type': 'Feature', 'stac_version': '1.1.0', 'stac_extensions': ['https://stac-extensions.github.io/projection/v2.0.0/schema.json', 'https://stac-extensions.github.io/raster/v1.1.0/schema.json'], 'id': 'antarctic-ice-shelf-basal-melt-cog', 'geometry': {'type': 'Polygon', 'coordinates': (((180.0, -90.0), (180.0, -50.68637942059157), (-180.0, -50.68637942059157), (-180.0, -90.0), (180.0, -90.0)),)}, 'bbox': [-180.0, -90.0, 180.0, -50.68637942059157], 'properties': {'title': 'Antarctic ice shelf basal melt rate COG', 'description': 'Cloud Optimized GeoTIFF example for Antarctic ice shelf basal melt rates.', 'license': 'cc-by-4.0', 'start_datetime': '1997-01-01T00:00:00Z', 'end_datetime': '2021-12-31T23:59:59Z', 'proj:code': 'EPSG:3031', 'proj:shape': [6435, 6120], 'proj:bbox': [-3060277.25, -3217740.25, 3059722.75, 3217259.75], 'proj:transform': [1000.0, 0.0, -3060277.25, 0.0, -1000.0, 3217259.75], 'datetime': '2021-01-01T00:00:00Z'}, 'links': [], 'assets': {'basal_melt_rate': {'href': 'https://s3.waw4-1.cloudferro.com/EarthCODE/OSCAssets/polar_cube_datasets/basal_melt/basal_melt_map_racmo_firn_air_corrected.tif', 'type': 'image/tiff; application=geotiff; profile=cloud-optimized', 'title': 'Basal melt rate COG', 'raster:bands': [{'nodata': -3.4028234663852886e+38, 'data_type': 'float32', 'spatial_resolution': 1000.0, 'unit': 'm yr-1'}], 'roles': ['data']}}}