Skip to content

Conversation

@wietzesuijker
Copy link
Contributor

Adds Sentinel-2 (Vienna) to GeoZarr example with embedded STAC

  • Queries Earth-Search for a low-cloud Sentinel-2 L2A scene over Vienna.
  • Streams RGB COGs into xarray/rioxarray and writes a consolidated, 512 × 512-chunk GeoZarr dataset.
  • Embeds a minimal STAC Item (proj:code, bbox, geometry, gsd, etc.) in root/.zattrs and calls zarr.consolidate_metadata.
  • Reopens with xr.open_zarr(consolidated=True), prints the STAC block, and shows a 4 × 4 coarsened preview.

@emmanuelmathot
Copy link

@wietzesuijker, thank you for this notebook. I’m playing with it and trying to make it fully operational. Is it working for you? I’m currently stuck at ## Populate Zarr array with overview data, but I’ll keep going. I’m just curious about your progress.

Copy link
Member

@maxrjones maxrjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thank you @wietzesuijker!

I know people are looking to build off this helpful example, so I will merge it after the zarr.consolidate_metadata comment is resolved and open a separate PR to apply light formatting (no substantive changes) and add it to the website.

@maxrjones
Copy link
Member

@wietzesuijker I actually also think it would be best to pop the ds['spatial_ref'].attrs['spatial_ref'] attribute before writing to Zarr. Rioxarray adds the WKT to both the spatial_ref and crs_wkt attributes for compatibility with GDAL, but that redundancy should not be propagated to the stored metadata (spatial ref is not included in CF conventions but crs_wkt is included as a attribute for CRS information).

@wietzesuijker
Copy link
Contributor Author

Thanks for the feedback. Ready for another review.

@maxrjones maxrjones merged commit 3b1ad43 into developmentseed:main Jun 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants