Index
DaskArrayWrapper
dataclass
#
Bases: BaseArrayWrapper
An array wrapper that wraps a zarr.Array
in a dask array using dask.array.from_array
.
The attributes of this class are a subset of the keyword arguments to dask.array.from_array
;
specifically, those keyword arguments that make sense when the input to from_array
is a
zarr.Array
.
Attributes:
Name | Type | Description |
---|---|---|
chunks |
str | int | tuple[int, ...] tuple[tuple[int, ...], ...] = "auto"
|
The chunks for the Dask array. See |
meta |
Any = `None`
|
The array type of each chunk of the Dask array. See |
inline_array |
bool = True
|
Whether slices of this array should be inlined into the Dask task graph.
See |
naming |
'auto' | 'array_url'
|
The naming scheme for the Dask array. If "auto", the default, then Dask will name the array with a non-deterministic hash. If "array_url", then the array will be named according to its URL. |
wrap #
Wrap the input in a dask array.
Source code in src/xarray_ome_ngff/array_wrap.py
ZarrArrayWrapper
dataclass
#
Bases: BaseArrayWrapper
An array wrapper that passes zarr.Array
instances through unchanged.
read_multiscale_group #
Create a dictionary of xarray.DataArray
from a Zarr group that implements some version of the
OME-NGFF multiscale image specification.
The keys of the dictionary are the paths to the Zarr arrays. The values of the dictionary are
xarray.DataArray
objects, one per Zarr array described in the OME-NGFF multiscale metadata.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
group |
Group
|
A handle for the Zarr group that contains the OME-NGFF metadata. |
required |
array_wrapper |
ZarrArrayWrapper | DaskArrayWrapper | ArrayWrapperSpec
|
Either an object that implements |
ZarrArrayWrapper()
|
**kwargs |
Additional keyword arguments that will be passed to the |
{}
|
Source code in src/xarray_ome_ngff/__init__.py
read_multiscale_array #
Read a single Zarr array as an xarray.DataArray
, using OME-NGFF
metadata.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
array |
Array
|
A Zarr array that is part of a version 0.4 OME-NGFF multiscale image. |
required |
array_wrapper |
ZarrArrayWrapper | DaskArrayWrapper | ArrayWrapperSpec
|
The array wrapper class to use when converting the Zarr array to an |
ZarrArrayWrapper()
|
Returns:
Type | Description |
---|---|
DataArray
|
|
Source code in src/xarray_ome_ngff/__init__.py
model_multiscale_group #
model_multiscale_group(*, arrays, transform_precision=None, ngff_version='0.4', chunks='auto', compressor=multiscale_v04.DEFAULT_COMPRESSOR, fill_value=0)
Create a model of an OME-NGFF multiscale group from a dict of xarray.DataArray
.
The dimensions / coordinates of the arrays will be used to infer OME-NGFF axis metadata, as well
as the OME-NGFF coordinate transformation metadata (i.e., scaling and translation).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
arrays |
dict[str, DataArray]
|
A mapping from strings to |
required |
transform_precision |
int | None
|
Whether, and how much, to round the transformations estimated from the coordinates.
The default ( |
None
|
ngff_version |
Literal['0.4']
|
The OME-NGFF version to use. |
'0.4'
|
chunks |
tuple[int, ...] | tuple[tuple[int, ...]] | Literal['auto']
|
The chunks for the arrays in the multiscale group. If the string "auto" is provided, each array will have chunks set to the zarr-python default value, which depends on the shape and dtype of the array. If a single sequence of ints is provided, then this defines the chunks for all arrays. If a sequence of sequences of ints is provided, then this defines the chunks for each array. |
'auto'
|
compressor |
Codec | None
|
The compressor to use for the arrays. Default is |
DEFAULT_COMPRESSOR
|
fill_value |
Any
|
The fill value for the Zarr arrays. |
0
|
Source code in src/xarray_ome_ngff/__init__.py
create_multiscale_group #
create_multiscale_group(*, store, path, arrays, transform_precision=None, ngff_version='0.4', chunks='auto', compressor=multiscale_v04.DEFAULT_COMPRESSOR, fill_value=0, overwrite=False)
store: zarr.storage.BaseStore
The storage backend for the Zarr hierarchy.
path: str
The path in the storage backend for the multiscale group.
arrays: dict[str, DataArray]
A mapping from strings to xarray.DataArray
.
transform_precision: int | None, default is None
Whether, and how much, to round the transformations estimated from the coordinates.
The default (None
) results in no rounding; specifying an int
x will round transforms to
x decimal places using numpy.round(transform, x)
.
ngff_version: Literal["0.4"]
The OME-NGFF version to use.
chunks: tuple[int] | tuple[tuple[int, ...]] | Literal["auto"], default = "auto"
The chunks for the arrays in the multiscale group.
If the string "auto" is provided, each array will have chunks set to the zarr-python default
value, which depends on the shape and dtype of the array.
If a single sequence of ints is provided, then this defines the chunks for all arrays.
If a sequence of sequences of ints is provided, then this defines the chunks for each array.
compressor: Codec | None, default = numcodecs.ZStd.
The compressor to use for the arrays. Default is numcodecs.ZStd
.
fill_value: Any
The fill value for the Zarr arrays.