Skip to content

Commit

Permalink
fix/repair docs (#42)
Browse files Browse the repository at this point in the history
* fix broken docs environment config, and add a section to the docs about xarray

* remove Union in favor of operator
  • Loading branch information
d-v-b authored Aug 29, 2024
1 parent 0ae46fd commit 5d90ef1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# pydantic-ome-ngff

[Pydantic](https://docs.pydantic.dev/latest/) models for [OME-NGFF](https://ngff.openmicroscopy.org/)
[Pydantic](https://docs.pydantic.dev/latest/) models for [OME-NGFF](https://ngff.openmicroscopy.org/).

# About

Expand All @@ -13,7 +13,7 @@ You can use this library to:

See the [reading](#reading-a-multiscale-group) and [writing](#creating-a-multiscale-group) examples for basic usage.

The base Pydantic models for Zarr groups and arrays used in this library are defined in [`pydantic-zarr`](https://janelia-cellmap.github.io/pydantic-zarr/)
The base Pydantic models for Zarr groups and arrays used in this library are defined in [`pydantic-zarr`](https://janelia-cellmap.github.io/pydantic-zarr/).

## Limitations

Expand All @@ -25,6 +25,8 @@ Version 0.4 of OME-NGFF has pretty extensive support, although my focus has been

This library only models the *structure* of a Zarr hierarchy, i.e. the layout of Zarr groups and arrays, and their metadata; it provides no functionality for efficiently reading or writing data from Zarr arrays. Use [`zarr-python`](https://github.com/zarr-developers/zarr-python) or [`tensorstore`](https://google.github.io/tensorstore/) for getting data in and out of Zarr arrays.

I highly recommend representing OME-NGFF datasets with the tools provided in [`xarray`](https://docs.xarray.dev/en/stable/). To make this easier, I maintain a library to bridge OME-NGFF and xarray: [`xarray-ome-ngff`](https://janeliascicomp.github.io/xarray-ome-ngff/).

# Examples

## Reading a Multiscale group
Expand Down Expand Up @@ -429,7 +431,7 @@ using a combination of `pydantic-ome-ngff` and `pydantic-zarr`:
```python
from pydantic_zarr.v2 import GroupSpec
from pydantic_ome_ngff.v04 import MultiscaleGroup, Axis
from typing import Union, Any
from typing import Any
import numpy as np
import zarr

Expand All @@ -438,7 +440,7 @@ import zarr
# type parameters. the first type parameter is for the attributes,
# which we set to `Any`, and the second type parameter is for the members of the group
# which we set to the union of GroupSpec and MultiscaleGroup.
GroupOfMultiscales = GroupSpec[Any, Union[GroupSpec, MultiscaleGroup]]
GroupOfMultiscales = GroupSpec[Any, GroupSpec | MultiscaleGroup]
axes = [Axis(name='x', type='space'), Axis(name='y', type='space')]

m_group_a = MultiscaleGroup.from_arrays(
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ extra-dependencies = [
[tool.hatch.envs.types.scripts]
check = "mypy --install-types --non-interactive {args:src/pydantic_ome_ngff tests}"

[tool.hatch.env.docs]
[tool.hatch.envs.docs]
dependencies = [
"mkdocs-material==9.5.5",
"mkdocstrings==0.24.0"
"mkdocs-material==9.5.33",
"mkdocstrings[python]==0.25.2"
]

[tool.hatch.envs.docs.scripts]
Expand Down

0 comments on commit 5d90ef1

Please sign in to comment.