zarrs
zarrs is a Rust library for the Zarr storage format for multidimensional arrays and metadata. It supports:
- Zarr V3, and
- (New in 0.15) A V3 compatible subset of Zarr V2.
A changelog can be found here. Correctness issues with past versions are detailed here.
Developed at the Department of Materials Physics, Australian National University, Canberra, Australia.
Getting Started
- Review the implementation status, array support, and storage support.
- View the examples and the example below.
- Read the documentation.
array::Arrayis a good place to start. - Check out the
zarrsecosystem.
Example
use GroupBuilder;
use ;
use GzipCodec; // requires gzip feature
use ArraySubset;
use ReadableWritableListableStorage;
use FilesystemStore; // requires filesystem feature
// Create a filesystem store
let store_path: PathBuf = "/path/to/hierarchy.zarr".into;
let store: ReadableWritableListableStorage =
new;
// Write the root group metadata
new
.build?
// .attributes(...)
.store_metadata?;
// Create a new V3 array using the array builder
let array = new
.bytes_to_bytes_codecs
.dimension_names
.attributes
.build?; // /path/to/hierarchy.zarr/array
// Store the array metadata
array.store_metadata?;
println!;
// {
// "zarr_format": 3,
// "node_type": "array",
// ...
// }
// Perform some operations on the chunks
array.?;
array.?;
array.erase_chunk?;
// Retrieve all array elements as an ndarray
let array_ndarray = array.?;
println!;
// [[ NaN, NaN, 0.2, 0.3],
// [ NaN, -1.1, -1.2, 1.3],
// [ NaN, -2.1, NaN, NaN]]
zarrs Ecosystem
| Crate | Description | Version | Docs |
|---|---|---|---|
| Core | |||
zarrs |
The core library for manipulating Zarr hierarchies | ||
zarrs_metadata |
Zarr metadata support | ||
zarrs_storage |
The storage API for zarrs |
||
| Stores | |||
zarrs_filesystem |
A filesystem store | ||
zarrs_object_store |
object_store store support |
||
zarrs_opendal |
opendal store support |
||
zarrs_http |
A synchronous http store | ||
zarrs_zip |
A storage adapter for zip files | ||
| Bindings | |||
| zarrs_ffi | A subset of zarrs exposed as a C/C++ API |
zarrs_tools
- A reencoder that can change codecs, chunk shape, convert Zarr V2 to V3, etc.
- Create an OME-Zarr hierarchy from a Zarr array.
- Transform arrays: crop, rescale, downsample, gradient magnitude, gaussian, noise filtering, etc.
- Benchmarking tools and performance benchmarks of
zarrs.
Licence
zarrs is licensed under either of
- the Apache License, Version 2.0 LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0 or
- the MIT license LICENSE-MIT or http://opensource.org/licenses/MIT, at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.