Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/xtensor-stack/xtensor-zarr

Implementation of the Zarr core protocol (version 2 and 3) based on xtensor.
https://github.com/xtensor-stack/xtensor-zarr

cpp xtensor zarr

Last synced: about 1 month ago
JSON representation

Implementation of the Zarr core protocol (version 2 and 3) based on xtensor.

Awesome Lists containing this project

README

        

# ![xtensor-zarr](docs/source/xtensor-zarr.svg)

[![Azure Pipelines](https://dev.azure.com/xtensor-stack/xtensor-stack/_apis/build/status/xtensor-stack.xtensor-zarr?branchName=master)](https://dev.azure.com/xtensor-stack/xtensor-stack/_build/latest?definitionId=9&branchName=master)
[![ReadTheDocs](https://readthedocs.org/projects/xtensor-zarr/badge/?version=latest)](http://xtensor-zarr.readthedocs.io/en/latest)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/xtensor-stack/xtensor-zarr/master?urlpath=lab%2Ftree%2Fexamples)
[![Join the Gitter Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/QuantStack/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Implementation of the Zarr core protocol (version 2 and 3) based on xtensor

## Introduction

`xtensor-zarr` offers an API to create and access a Zarr (v2 or v3) hierarchy in a store (locally or in the cloud), read and write arrays (in various formats) and groups in the hierarchy, and explore the hierarchy.

## Installation

`xtensor-zarr` comes with a `libxtensor-zarr-gdal` shared library for accessing stores through GDAL's Virtual File System or the local file system. For all other stores, `xtensor-zarr` is a header-only library.

We provide a package for the mamba (or conda) package manager:

```bash
mamba install xtensor-zarr -c conda-forge
```

- `xtensor-zarr` depends on `xtensor` `^0.23.8`, `xtensor-io` `^0.12.7`, `zarray` `^0.0.7`, `nlohmann_json` `^3.9.1`, `Blosc` `^1.21.0`, `zlib` `^1.2.11`, `gdal` `^3.0.0` and `cpp-filesystem` `^1.3.0`.

- `google-cloud-cpp` and `aws-sdk-cpp` are optional dependencies to `xtensor-zarr`.

- `google-cloud-cpp` is required to access a store in Google Cloud Storage.
- `aws-sdk-cpp` is required to access a store in AWS S3.

You can also install `xtensor-zarr` from source:

```
mkdir build
cd build
cmake ..
make
sudo make install
```

## Trying it online

To try out xtensor-zarr interactively in your web browser, just click on the binder
link:

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/xtensor-stack/xtensor-zarr/master?filepath=examples%2Fzarr_v3.ipynb)

## Documentation

To get started with using `xtensor-zarr`, check out the full documentation:

http://xtensor-zarr.readthedocs.io/

## Usage

```cpp
// create a hierarchy on the local file system
xt::xzarr_file_system_store store("test.zr3");
auto h = xt::create_zarr_hierarchy(store);

// create an array in the hierarchy
nlohmann::json attrs = {{"question", "life"}, {"answer", 42}};
using S = std::vector;
S shape = {4, 4};
S chunk_shape = {2, 2};
xt::zarray a = h.create_array(
"/arthur/dent", // path to the array in the store
shape, // array shape
chunk_shape, // chunk shape
"