{"id":20101579,"url":"https://github.com/xtensor-stack/xtensor-zarr","last_synced_at":"2025-05-06T06:33:31.242Z","repository":{"id":40384251,"uuid":"280190662","full_name":"xtensor-stack/xtensor-zarr","owner":"xtensor-stack","description":"Implementation of the Zarr core protocol (version 2 and 3) based on xtensor.","archived":false,"fork":false,"pushed_at":"2022-05-11T16:18:43.000Z","size":249,"stargazers_count":43,"open_issues_count":12,"forks_count":10,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-09T09:51:48.315Z","etag":null,"topics":["cpp","xtensor","zarr"],"latest_commit_sha":null,"homepage":"http://xtensor-zarr.readthedocs.io","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xtensor-stack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-16T15:32:07.000Z","updated_at":"2025-04-06T10:32:13.000Z","dependencies_parsed_at":"2022-08-09T19:00:19.076Z","dependency_job_id":null,"html_url":"https://github.com/xtensor-stack/xtensor-zarr","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtensor-stack%2Fxtensor-zarr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtensor-stack%2Fxtensor-zarr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtensor-stack%2Fxtensor-zarr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtensor-stack%2Fxtensor-zarr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xtensor-stack","download_url":"https://codeload.github.com/xtensor-stack/xtensor-zarr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252633906,"owners_count":21779944,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","xtensor","zarr"],"created_at":"2024-11-13T17:25:49.954Z","updated_at":"2025-05-06T06:33:30.979Z","avatar_url":"https://github.com/xtensor-stack.png","language":"C++","readme":"# ![xtensor-zarr](docs/source/xtensor-zarr.svg)\n\n[![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\u0026branchName=master)\n[![ReadTheDocs](https://readthedocs.org/projects/xtensor-zarr/badge/?version=latest)](http://xtensor-zarr.readthedocs.io/en/latest)\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/xtensor-stack/xtensor-zarr/master?urlpath=lab%2Ftree%2Fexamples)\n[![Join the Gitter Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/QuantStack/Lobby?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nImplementation of the Zarr core protocol (version 2 and 3) based on xtensor\n\n## Introduction\n\n`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.\n\n## Installation\n\n`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.\n\nWe provide a package for the mamba (or conda) package manager:\n\n```bash\nmamba install xtensor-zarr -c conda-forge\n```\n\n- `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`.\n\n- `google-cloud-cpp` and `aws-sdk-cpp` are optional dependencies to `xtensor-zarr`.\n\n  - `google-cloud-cpp` is required to access a store in Google Cloud Storage.\n  - `aws-sdk-cpp` is required to access a store in AWS S3.\n\nYou can also install `xtensor-zarr` from source:\n\n```\nmkdir build\ncd build\ncmake ..\nmake\nsudo make install\n```\n\n## Trying it online\n\nTo try out xtensor-zarr interactively in your web browser, just click on the binder\nlink:\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/xtensor-stack/xtensor-zarr/master?filepath=examples%2Fzarr_v3.ipynb)\n\n## Documentation\n\nTo get started with using `xtensor-zarr`, check out the full documentation:\n\nhttp://xtensor-zarr.readthedocs.io/\n\n## Usage\n\n```cpp\n// create a hierarchy on the local file system\nxt::xzarr_file_system_store store(\"test.zr3\");\nauto h = xt::create_zarr_hierarchy(store);\n\n// create an array in the hierarchy\nnlohmann::json attrs = {{\"question\", \"life\"}, {\"answer\", 42}};\nusing S = std::vector\u003cstd::size_t\u003e;\nS shape = {4, 4};\nS chunk_shape = {2, 2};\nxt::zarray a = h.create_array(\n    \"/arthur/dent\",  // path to the array in the store\n    shape,  // array shape\n    chunk_shape,  // chunk shape\n    \"\u003cf8\",  // data type, here little-endian 64-bit floating point\n    'C',  // memory layout\n    '/',  // chunk identifier separator\n    xt::xio_binary_config(),  // compressor (here, raw binary)\n    attrs,  // attributes\n    10,  // chunk pool size\n    0.  // fill value\n);\n\n// write array data\na(2, 1) = 3.;\n\n// read array data\nstd::cout \u003c\u003c a(2, 1) \u003c\u003c std::endl;\n// prints `3.`\nstd::cout \u003c\u003c a(2, 2) \u003c\u003c std::endl;\n// prints `0.` (fill value)\nstd::cout \u003c\u003c a.attrs() \u003c\u003c std::endl;\n// prints `{\"answer\":42,\"question\":\"life\"}`\n\n// create a group\nauto g = h.create_group(\"/tricia/mcmillan\", attrs);\n\n// explore the hierarchy\n// get children at a point in the hierarchy\nstd::string children = h.get_children(\"/\").dump();\nstd::cout \u003c\u003c children \u003c\u003c std::endl;\n// prints `{\"arthur\":\"implicit_group\",\"marvin\":\"explicit_group\",\"tricia\":\"implicit_group\"}`\n// view the whole hierarchy\nstd::string nodes = h.get_nodes().dump();\nstd::cout \u003c\u003c nodes \u003c\u003c std::endl;\n// prints `{\"arthur\":\"implicit_group\",\"arthur/dent\":\"array\",\"tricia\":\"implicit_group\",\"tricia/mcmillan\":\"explicit_group\"}`\n\n// use cloud storage\n// create an anonymous Google Cloud Storage client\ngcs::Client client((gcs::ClientOptions(gcs::oauth2::CreateAnonymousCredentials())));\nxzarr_gcs_store s1(\"zarr-demo/v3/test.zr3\", client);\n// list keys under prefix\nauto keys1 = s1.list_prefix(\"data/root/arthur/dent/\");\nfor (const auto\u0026 key: keys1)\n{\n    std::cout \u003c\u003c key \u003c\u003c std::endl;\n}\n// prints:\n// data/root/arthur/dent/c0/0\n// data/root/arthur/dent/c0/1\n// data/root/arthur/dent/c1/0\n// data/root/arthur/dent/c1/1\n// data/root/arthur/dent/c2/0\n// data/root/arthur/dent/c2/1\n\nxzarr_gcs_store s2(\"zarr-demo/v3/test.zr3/meta/root/marvin\", client);\n// list all keys\nauto keys2 = s2.list();\nfor (const auto\u0026 key: keys2)\n{\n    std::cout \u003c\u003c key \u003c\u003c std::endl;\n}\n// prints:\n// android.array.json\n// paranoid.group.json\n```\n\n## License\n\nWe use a shared copyright model that enables all contributors to maintain the\ncopyright on their contributions.\n\nThis software is licensed under the BSD-3-Clause license. See the [LICENSE](LICENSE) file for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxtensor-stack%2Fxtensor-zarr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxtensor-stack%2Fxtensor-zarr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxtensor-stack%2Fxtensor-zarr/lists"}