Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a how do I? page #141

Merged
merged 3 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.1.2

### Doc improvements

- Added a ["How do I...?" page](how-to.md) that explains how to do common tasks with `ome-zarr-models`.

## 0.1.1

### Bug fixes
Expand Down
25 changes: 25 additions & 0 deletions docs/how-to.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# How do I...?

## Validate an OME-Zarr group

If you know what type of group it is, use the `to_zarr()` method on [one of the group objects](api/index.md):
dstansby marked this conversation as resolved.
Show resolved Hide resolved

```python
import zarr
import ome_zarr_models.v04

zarr_group = zarr.open(path_to_group, mode="r")
hcs_group = ome_zarr_models.v04.HCS.from_zarr(zarr_group)
```

If you don't know what type of group it is, use `open_ome_zarr()`:

```python
import zarr
import ome_zarr_models.v04

zarr_group = zarr.open(path_to_group, mode="r")
ome_group = ome_zarr_models.open_ome_zarr(zarr_group)
```

If there aren't any errors, the Zarr group is a valid OME-Zarr group.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ plugins:
nav:
- Home: index.md
- Tutorial: tutorial.py
- How do I...?: how-to.md
- API reference:
- api/index.md
- v04:
Expand Down
Loading