Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into zarr_v3
Browse files Browse the repository at this point in the history
  • Loading branch information
will-moore committed Jan 14, 2025
2 parents c953723 + 1e3e3e2 commit 4f2a4b1
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build
dist/
target/
docs/build/

*.DS_Store
# Testing files
.tox*
.coverage*
Expand Down
10 changes: 2 additions & 8 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,11 @@ build:
os: ubuntu-22.04
tools:
python: "3.12"
# You can also specify other tool versions:
# nodejs: "16"
# rust: "1.55"
# golang: "1.17"

# Build documentation in the docs/ directory with Sphinx
sphinx:
fail_on_warning: true

# Build documentation in the docs/ directory with Sphinx
# sphinx:
# configuration: docs/conf.py
configuration: docs/source/conf.py

# If using Sphinx, optionally build your docs in additional formats such as PDF
# formats:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 0.10.3 (Janbuary 2025)

- Document Scaler attributes ([#418](https://github.com/ome/ome-zarr-py/pull/418))
- Fix dimension separator when downloading files ([#419](https://github.com/ome/ome-zarr-py/pull/419))
- Exclude bad version of fsspec in deps ([#420](https://github.com/ome/ome-zarr-py/pull/420))

# 0.10.2 (November 2024)

- Drop support for Python 3.8.
Expand Down
2 changes: 0 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,8 @@ Distributed under the terms of the `BSD`_ license,

.. |docs| image:: https://readthedocs.org/projects/ome-zarr/badge/?version=stable
:alt: Documentation Status
:scale: 100%
:target: https://ome-zarr.readthedocs.io/en/stable/?badge=stable

.. |coverage| image:: https://codecov.io/gh/ome/ome-zarr-py/branch/master/graph/badge.svg
:alt: Test coverage
:scale: 100%
:target: https://codecov.io/gh/ome/ome-zarr-py
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sphinx==8.1.3
sphinx-rtd-theme==3.0.2
fsspec==2023.6.0
zarr==v3.0.0-beta.3
fsspec
zarr>=v3.0.0
dask
numpy
scipy
Expand Down
15 changes: 15 additions & 0 deletions ome_zarr/scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,21 @@ class Scaler:
choices. These values can be returned by the
:func:`~ome_zarr.scale.Scaler.methods` method.
Attributes:
copy_metadata:
If `True`, copy Zarr attributes from the input array to the new group.
downscale:
Downscaling factor.
in_place:
Does not do anything.
labeled:
If `True`, check that the values in the downsampled levels are a subset
of the values found in the input array.
max_layer:
The maximum number of downsampled layers to create.
method:
Downsampling method
>>> import numpy as np
>>> data = np.zeros((1, 1, 1, 64, 64))
>>> scaler = Scaler()
Expand Down
4 changes: 3 additions & 1 deletion ome_zarr/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ def download(input_path: str, output_dir: str = ".") -> None:
for dataset, data in reversed(list(zip(datasets, resolutions))):
LOGGER.info("resolution %s...", dataset)
with pbar:
data.to_zarr(str(target_path / dataset))
data.to_zarr(
str(target_path / dataset), dimension_separator="/"
)
else:
# Assume a group that needs metadata, like labels
zarr.group(str(target_path))
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ dependencies = [
"numpy",
"dask",
"distributed",
"zarr==v3.0.0-beta.3",
"fsspec[s3]>=0.8,!=2021.07.0",
"zarr>=v3.0.0",
"fsspec[s3]>=0.8,!=2021.07.0,!=2023.9.0",
# See https://github.com/fsspec/filesystem_spec/issues/819
"aiohttp<4",
"requests",
Expand Down
28 changes: 28 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
from ome_zarr.utils import strip_common_prefix


def directory_items(directory: Path):
"""
Get all items (files and folders) in a directory, relative to that directory.
"""
if not directory.is_dir():
raise ValueError(f"{directory} is not a directory")

return sorted([p.relative_to(directory) for p in directory.glob("*")])


class TestCli:
@pytest.fixture(autouse=True)
def initdir(self, tmpdir):
Expand Down Expand Up @@ -40,6 +50,24 @@ def test_astronaut_download(self, tmpdir):
main(["download", filename, f"--output={out}"])
main(["info", f"{out}/{basename}"])

assert directory_items(Path(out) / "data-3") == [
Path(".zattrs"),
Path(".zgroup"),
Path("0"),
Path("1"),
Path("2"),
Path("3"),
Path("4"),
Path("labels"),
]

assert directory_items(Path(out) / "data-3" / "1") == [
Path(".zarray"),
Path("0"),
Path("1"),
Path("2"),
]

def test_s3_info(self, s3_address):
main(["info", s3_address])

Expand Down

0 comments on commit 4f2a4b1

Please sign in to comment.