Skip to content

assign_index: Add GeoTIFF & STAC metadata support#56

Merged
dcherian merged 5 commits intoxarray-contrib:mainfrom
dcherian:stac-metadata-support
Nov 17, 2025
Merged

assign_index: Add GeoTIFF & STAC metadata support#56
dcherian merged 5 commits intoxarray-contrib:mainfrom
dcherian:stac-metadata-support

Conversation

@dcherian
Copy link
Copy Markdown
Contributor

Resolves #55

This commit adds support for creating RasterIndex from STAC metadata
(model_tiepoint and model_pixel_scale attributes) in addition to the
existing GeoTransform and coordinate array methods.

Changes:

  • Enhanced get_affine() to extract affine transforms from STAC metadata
  • Added validation that Z pixel scale must be 0 (2D rasters only)
  • STAC metadata attributes are automatically cleaned up after use
  • Improved error messages when coordinates lack explicit values
  • Added comprehensive test coverage for assign_index function

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

@dcherian dcherian changed the title Add STAC metadata support for spatial index creation assign_index: Add STAC metadata support Nov 15, 2025
@maxrjones
Copy link
Copy Markdown
Member

The GeoTIFF specification uses these attributes to describe the spatial information. STAC uses the projection extension AFAIK - https://github.com/stac-extensions/projection - which has a transform attribute.

dcherian and others added 3 commits November 15, 2025 16:01
Resolves xarray-contrib#55

This commit adds support for creating RasterIndex from STAC metadata
(model_tiepoint and model_pixel_scale attributes) in addition to the
existing GeoTransform and coordinate array methods.

Changes:
- Enhanced get_affine() to extract affine transforms from STAC metadata
- Added validation that Z pixel scale must be 0 (2D rasters only)
- STAC metadata attributes are automatically cleaned up after use
- Improved error messages when coordinates lack explicit values
- Added comprehensive test coverage for assign_index function

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Documents the decision-making logic and priority order used by
assign_index() when detecting affine transformations from various
metadata formats (GeoTransform, STAC proj:transform, GeoTIFF metadata,
and coordinate arrays).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add two new classmethods to RasterIndex:
- from_tiepoint_and_scale: Create index from GeoTIFF metadata
- from_stac_proj_metadata: Create index from STAC proj:transform

Refactored affine transform extraction into reusable helper functions
in lib.py that are used by both assign_index and the new classmethods:
- affine_from_tiepoint_and_scale
- affine_from_stac_proj_metadata

This provides more flexible APIs for creating RasterIndex instances
directly from metadata dictionaries.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@dcherian dcherian force-pushed the stac-metadata-support branch from 4a2994e to ceaf718 Compare November 15, 2025 23:09
@dcherian dcherian force-pushed the stac-metadata-support branch from 61ea662 to bf60b33 Compare November 15, 2025 23:19
@dcherian dcherian force-pushed the stac-metadata-support branch from bf60b33 to 90bdde7 Compare November 15, 2025 23:23
@dcherian dcherian changed the title assign_index: Add STAC metadata support assign_index: Add GeoTIFF & STAC metadata support Nov 17, 2025
@dcherian dcherian merged commit e144693 into xarray-contrib:main Nov 17, 2025
6 checks passed
@dcherian dcherian deleted the stac-metadata-support branch November 18, 2025 01:13
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.

Support index creation from STAC metadata

2 participants