Skip to content

Conversation

@siligam
Copy link
Owner

@siligam siligam commented Jan 14, 2026

Overview

This PR adds complete STAC (SpatioTemporal Asset Catalog) support to dummyxarray, enabling export/import of datasets as STAC Items and Collections with full spatial and temporal metadata handling.

Features Implemented

Core STAC Functionality

  • ✅ STAC Item export/import (, )
  • ✅ STAC Collection export/import (, )
  • ✅ Multi-asset collection creation ()
  • ✅ File I/O operations for Items and Collections

Spatial Metadata

  • ✅ Automatic bbox extraction with coordinate fallback
  • ✅ Spatial extent management ()
  • ✅ Spatial metadata validation ()
  • ✅ Support for alternative coordinate names (lat/latitude, lon/longitude)
  • ✅ Geospatial bounds handling

Temporal Metadata

  • ✅ Temporal extent inference from time coordinates ()
  • ✅ CF-compliant time unit parsing
  • ✅ Datetime handling for STAC Items

Documentation

User Guides (3 comprehensive guides)

  • STAC Catalogs - Complete API reference with examples
  • Spatial Metadata - Extent, validation, and coordinate systems
  • Geospatial Workflows - 6 real-world workflow examples

Examples

  • Added 6 practical STAC examples to examples.md
  • Updated index.md with STAC references

Testing

  • 27 STAC-specific tests across 8 test classes
  • 242/242 total tests passing
  • 89% coverage for STAC module
  • 82% overall coverage

Test categories:

  • Basic STAC Item/Collection operations
  • Spatial validation and bbox extraction
  • Temporal extent inference
  • File I/O and roundtrip conversions
  • Error handling
  • Integration with CF compliance and data generation

Configuration Updates

  • Added STAC dependencies: , ,
  • Added missing core dependencies: , ,
  • Updated both and
  • Added for coverage reporting

Merge Conflicts Note

⚠️ This PR has conflicts with main due to recent configuration changes (pixi.toml → pyproject.toml migration). The conflicts are in:

  • (deleted in main, modified here)
  • (configuration differences)
  • (binary conflict)

These will need to be resolved during merge.

Breaking Changes

None - all new functionality is additive.

Checklist

  • ✅ All tests pass
  • ✅ Documentation added
  • ✅ Examples provided
  • ✅ Test coverage maintained (82%)
  • ✅ Configuration files updated
  • ⚠️ Merge conflicts need resolution

- Implement core STAC functionality in new stac.py module
- Add STAC I/O methods to IOMixin:
  - to_stac_item() and from_stac_item() for dataset conversion
  - to_stac_collection() for multi-dataset collections
  - save_stac_item() and save_stac_collection() for file output
  - load_stac_item() and load_stac_collection() for file input
- Add comprehensive unit tests for all STAC functionality
- Add STAC as an optional dependency in pyproject.toml
- Include STAC support documentation and proposal
…d documentation

- Implement STAC Item and Collection export/import functionality
- Add spatial metadata validation and bbox extraction with coordinate fallback
- Add temporal extent inference from time coordinates
- Implement multi-asset STAC collection creation
- Add comprehensive test suite (27 STAC-specific tests, 242 total tests passing)
- Add complete documentation: STAC catalogs, spatial metadata, geospatial workflows
- Add STAC examples to examples.md
- Update mkdocs.yml and index.md with STAC documentation links
- Fix mfdataset.md anchor link for API documentation
- Update pixi.toml and pyproject.toml with STAC dependencies and configuration cleanup
- Achieve 89% test coverage for STAC module, 82% overall coverage
- Add STAC Catalogs user guide with complete API reference and examples
- Add Spatial Metadata guide covering extent, validation, and coordinate systems
- Add Geospatial Workflows guide with 6 real-world workflow examples
- Add comprehensive test suite with 27 STAC-specific tests (100% passing)

Documentation includes:
- Basic STAC Item/Collection creation and usage
- Spatial metadata validation and bbox extraction
- Temporal extent inference
- Multi-asset collection creation
- Regional datasets and custom extents
- Complete roundtrip workflows
- Integration examples with CF compliance and data generation
- Best practices and error handling

Test coverage:
- 27 STAC-specific tests across 8 test classes
- Tests for Items, Collections, spatial validation, temporal extent
- File I/O, error handling, and integration tests
- 89% coverage for STAC module
- Lock file updated after adding pystac, pyproj, shapely, and other STAC dependencies
- Ensures reproducible environments across all platforms
Resolved merge conflicts:
- Removed pixi.toml (moved to pyproject.toml in main)
- Updated pyproject.toml with main's structure + STAC dependencies
- Regenerated pixi.lock with STAC packages (pystac, pyproj, shapely, cftime)
- Accepted main's configuration improvements (hatchling, pixi features)
- Sort imports in core.py, io.py, stac.py
- Sort imports in test_io.py, test_stac.py
- All formatting checks now pass
- Move yaml import to top of file (E402)
- Add pystac.Collection to TYPE_CHECKING imports
- Add noqa comments for pystac availability checks
- Fix blind exception assertions in tests (use ValueError/KeyError)
- Remove unused imports (auto-fixed by ruff)

All ruff checks now pass.
The linting fix incorrectly changed Exception to ValueError, but the actual
code raises STACError. Reverted to Exception with comment indicating STACError.

All 242 tests now passing.
Import STACError from dummyxarray.stac and use it directly in error
handling tests to avoid B017 linting error (blind exception assertion).

All linting checks and 242 tests now passing.
Break long lines in overview sections to comply with MD013 (120 char limit):
- geospatial-workflows.md: Split overview description
- spatial-metadata.md: Split overview into 3 lines
- stac-catalogs.md: Split STAC description

All markdown linting checks now pass.
These imports were auto-removed by ruff --fix but not committed.
The imports were genuinely unused in these specific test functions:
- test_to_stac_item_basic
- test_to_stac_collection_basic
- test_stac_roundtrip
- test_save_load_stac_item_roundtrip

All linting checks now pass.
@siligam siligam merged commit 67a27a7 into main Jan 14, 2026
4 checks passed
@siligam siligam deleted the feat/stac branch January 14, 2026 22:01
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.

2 participants