ALWAYS read plan.md first to understand the project's goals, architecture decisions, and implementation approach before making any code changes.
xarray-ome provides an xarray backend for reading and writing OME-Zarr (OME-NGFF) files. We use ngff-zarr as the foundation for OME-Zarr I/O operations, and focus on the xarray integration layer.
User Code → xarray-ome API → Coordinate Translation → ngff-zarr → zarr → Storage
- ngff-zarr: Handles OME-Zarr spec parsing, zarr I/O, metadata validation
- xarray-ome: Converts OME-NGFF transforms ↔ xarray coordinates, builds DataTree/Dataset structures
reader.py:open_ome_datatree(),open_ome_dataset()- read OME-Zarr into xarraywriter.py:write_ome_datatree(),write_ome_dataset()- write xarray to OME-Zarrtransforms.py: Coordinate transformation logic (OME-NGFF ↔ xarray)
Branch: implement-ngff-zarr-integration
Completed:
- OME-NGFF v0.1-v0.5 support (read all, write v0.4-v0.5 via ngff-zarr)
- Core reading functionality (open_ome_dataset, open_ome_datatree)
- Coordinate transformation logic (transforms_to_coords, coords_to_transforms)
- Writing functionality (write_ome_dataset, write_ome_datatree)
- Comprehensive test suite (42 tests: reading, writing, transforms, backend, integration)
- Xarray backend integration (engine="ome-zarr")
- Complete Sphinx documentation with MyST Markdown and executable notebooks
- Integration tests with real IDR sample data
- Channel label extraction from OME metadata (omero.channels)
- Read the Docs configuration with uv support
Future Enhancements:
- Add working code example at the very start of docs homepage
- HCS plate structure support
- Performance optimizations
- Integration with visualization tools
- Additional metadata validation options
- Use pythonic patterns and conventions
- Follow PEP 8 style guidelines (enforced by ruff)
- Write clear, readable code that speaks for itself
- Use meaningful variable and function names
- Follow established patterns in the existing codebase
DO NOT leave excessive comments in code.
- Write self-documenting code with clear names and structure
- Only add comments when absolutely necessary to explain complex logic or non-obvious decisions
- Prefer docstrings for functions/classes over inline comments
- Trust that the code itself tells the story
- All code must pass pre-commit hooks (ruff, mypy, etc.)
- Follow the existing project structure and patterns
- Use type hints appropriately (mypy strict mode enabled)
- Write tests for new functionality
- Keep functions and classes focused and single-purpose
- Read
plan.mdto understand context - Check existing code patterns before implementing
- Write clean, self-documenting code
- Ensure all linting and type checking passes
- Use uv for environment management:
uv run python,uv run pytest
NEVER use indiscriminate git adds like git add -A or git add .
- Always be specific with git add commands
- Add files individually or by directory:
git add file1.py file2.pyorgit add src/ - Review changes with
git statusandgit diffbefore staging - This prevents accidentally committing unintended files
- OME-NGFF spec: https://ngff.openmicroscopy.org/latest/
- ngff-zarr docs: https://ngff-zarr.readthedocs.io/
- xarray-ome-ngff (coordinate logic reference): https://github.com/JaneliaSciComp/xarray-ome-ngff