atlas-python 0.9.0__tar.gz → 0.10.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. atlas_python-0.10.0/.github/workflows/atlas-python-docs.yaml +88 -0
  2. {atlas_python-0.9.0 → atlas_python-0.10.0}/.gitignore +5 -1
  3. {atlas_python-0.9.0 → atlas_python-0.10.0}/CONTRIBUTING.md +1 -1
  4. {atlas_python-0.9.0 → atlas_python-0.10.0}/Cargo.lock +4 -4
  5. {atlas_python-0.9.0 → atlas_python-0.10.0}/Cargo.toml +3 -3
  6. {atlas_python-0.9.0 → atlas_python-0.10.0}/LICENSE +1 -1
  7. atlas_python-0.10.0/PKG-INFO +291 -0
  8. {atlas_python-0.9.0 → atlas_python-0.10.0}/README.md +17 -4
  9. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/Cargo.toml +1 -1
  10. atlas_python-0.10.0/atlas-python/LICENSE +201 -0
  11. atlas_python-0.10.0/atlas-python/README.md +258 -0
  12. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/benchmarks/README.md +4 -4
  13. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/benchmarks/bench_collection.py +9 -9
  14. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/docs/benchmarks.md +6 -6
  15. atlas_python-0.10.0/atlas-python/docs/examples.md +37 -0
  16. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/docs/guides/attributes.md +3 -3
  17. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/docs/guides/bulk-reads.md +8 -8
  18. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/docs/guides/cloud-storage.md +8 -8
  19. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/docs/guides/codecs-and-meta.md +2 -2
  20. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/docs/guides/dask.md +6 -6
  21. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/docs/guides/dtypes.md +5 -0
  22. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/docs/guides/durability.md +2 -2
  23. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/docs/guides/shared-arrays.md +2 -2
  24. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/docs/guides/stats.md +6 -1
  25. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/docs/guides/xarray.md +53 -8
  26. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/docs/index.md +11 -11
  27. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/docs/installation.md +5 -2
  28. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/docs/quickstart.md +5 -5
  29. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/docs/reference/xarray-accessor.md +2 -2
  30. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/docs/vs-zarr-netcdf.md +2 -2
  31. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/examples/02_xarray.py +6 -6
  32. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/examples/03_dask_streaming.py +3 -3
  33. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/examples/08_object_store.py +4 -4
  34. atlas_python-0.10.0/atlas-python/examples/09_missing_data.py +101 -0
  35. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/mkdocs.yml +5 -1
  36. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/src/dataset.rs +3 -3
  37. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/src/store.rs +17 -8
  38. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/tests/test_smoke.py +1 -1
  39. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/tests/test_xarray.py +205 -36
  40. {atlas_python-0.9.0 → atlas_python-0.10.0}/pyproject.toml +18 -1
  41. {atlas_python-0.9.0 → atlas_python-0.10.0}/python/atlas/__init__.pyi +16 -6
  42. {atlas_python-0.9.0 → atlas_python-0.10.0}/python/atlas/xarray.py +136 -13
  43. {atlas_python-0.9.0 → atlas_python-0.10.0}/src/store.rs +1 -1
  44. atlas_python-0.9.0/PKG-INFO +0 -17
  45. atlas_python-0.9.0/atlas-python/README.md +0 -275
  46. atlas_python-0.9.0/atlas-python/docs/examples.md +0 -36
  47. {atlas_python-0.9.0 → atlas_python-0.10.0}/.github/workflows/atlas-python-release.yaml +0 -0
  48. {atlas_python-0.9.0 → atlas_python-0.10.0}/.github/workflows/atlas-rust-release.yaml +0 -0
  49. {atlas_python-0.9.0 → atlas_python-0.10.0}/.github/workflows/ci.yaml +0 -0
  50. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/.python-version +0 -0
  51. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/benchmarks/_common.py +0 -0
  52. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/benchmarks/generate_bench_charts.py +0 -0
  53. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/docs/assets/bench_gridded.svg +0 -0
  54. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/docs/assets/bench_profile.svg +0 -0
  55. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/docs/guides/datasets-and-arrays.md +0 -0
  56. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/docs/reference/atlas.md +0 -0
  57. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/docs/reference/dataset-view.md +0 -0
  58. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/examples/01_basics.py +0 -0
  59. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/examples/04_meta_formats.py +0 -0
  60. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/examples/05_codecs.py +0 -0
  61. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/examples/06_stats_scan.py +0 -0
  62. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/examples/07_shared_arrays.py +0 -0
  63. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/src/attr.rs +0 -0
  64. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/src/dtype.rs +0 -0
  65. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/src/error.rs +0 -0
  66. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/src/lib.rs +0 -0
  67. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/src/logging.rs +0 -0
  68. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/src/runtime.rs +0 -0
  69. {atlas_python-0.9.0 → atlas_python-0.10.0}/atlas-python/tests/GL_PR_BO_JLKU.nc +0 -0
  70. {atlas_python-0.9.0 → atlas_python-0.10.0}/examples/lifecycle.rs +0 -0
  71. {atlas_python-0.9.0 → atlas_python-0.10.0}/examples/sensor_fleet.rs +0 -0
  72. {atlas_python-0.9.0 → atlas_python-0.10.0}/examples/weather_store.rs +0 -0
  73. {atlas_python-0.9.0 → atlas_python-0.10.0}/python/atlas/__init__.py +0 -0
  74. {atlas_python-0.9.0 → atlas_python-0.10.0}/python/atlas/py.typed +0 -0
  75. {atlas_python-0.9.0 → atlas_python-0.10.0}/src/array.rs +0 -0
  76. {atlas_python-0.9.0 → atlas_python-0.10.0}/src/config.rs +0 -0
  77. {atlas_python-0.9.0 → atlas_python-0.10.0}/src/dataset.rs +0 -0
  78. {atlas_python-0.9.0 → atlas_python-0.10.0}/src/error.rs +0 -0
  79. {atlas_python-0.9.0 → atlas_python-0.10.0}/src/lib.rs +0 -0
  80. {atlas_python-0.9.0 → atlas_python-0.10.0}/src/meta.rs +0 -0
  81. {atlas_python-0.9.0 → atlas_python-0.10.0}/src/schema.rs +0 -0
  82. {atlas_python-0.9.0 → atlas_python-0.10.0}/tests/integration.rs +0 -0
@@ -0,0 +1,88 @@
1
+ name: atlas-python-docs
2
+ on:
3
+ workflow_dispatch:
4
+ inputs:
5
+ version:
6
+ description: "Docs version to publish (e.g. 1.2.3). Leave blank to publish as 'dev'."
7
+ required: false
8
+ type: string
9
+ alias:
10
+ description: "Alias to update (e.g. latest)."
11
+ required: false
12
+ default: dev
13
+ type: string
14
+ release:
15
+ types: [published]
16
+ push:
17
+ tags:
18
+ - "v*" # triggers on tags like v1.0.0, v2.3, etc.
19
+ permissions:
20
+ contents: write
21
+ jobs:
22
+ deploy:
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+ - name: Configure Git Credentials
27
+ run: |
28
+ git config user.name github-actions[bot]
29
+ git config user.email 41898282+github-actions[bot]@users.noreply.github.com
30
+
31
+ - name: Extract version
32
+ id: vars
33
+ env:
34
+ INPUT_VERSION: ${{ github.event.inputs.version }}
35
+ INPUT_ALIAS: ${{ github.event.inputs.alias }}
36
+ run: |
37
+ if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
38
+ # Tag push or release: refs/tags/v1.2.3 -> version=1.2.3, alias=latest
39
+ VERSION="${GITHUB_REF#refs/tags/v}"
40
+ ALIAS=latest
41
+ else
42
+ # Manual run: use provided inputs, falling back to 'dev'
43
+ VERSION="${INPUT_VERSION:-dev}"
44
+ ALIAS="${INPUT_ALIAS:-dev}"
45
+ fi
46
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
47
+ echo "alias=$ALIAS" >> $GITHUB_OUTPUT
48
+
49
+ - name: Show version
50
+ run: |
51
+ echo "Deploying docs version '${{ steps.vars.outputs.version }}' (alias '${{ steps.vars.outputs.alias }}')"
52
+
53
+ - uses: actions/setup-python@v6
54
+ with:
55
+ python-version: "3.12"
56
+ - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
57
+ - uses: actions/cache@v4
58
+ with:
59
+ key: mkdocs-material-${{ env.cache_id }}
60
+ path: ~/.cache
61
+ restore-keys: |
62
+ mkdocs-material-
63
+ - run: pip install mkdocs-material mkdocstrings[python] mike
64
+ # Build & install the package so the compiled `atlas._atlas` extension is
65
+ # importable — mkdocstrings preloads it to resolve the re-exported API.
66
+ # Editable (-e) so maturin places the compiled `_atlas.*.so` into the
67
+ # python-source tree (atlas-python/python/atlas/), which is where griffe's
68
+ # `paths: ["python"]` search path looks for it. A plain install puts it in
69
+ # site-packages, outside that search path, and the alias fails to resolve.
70
+ # ubuntu-latest ships a Rust toolchain, so maturin can build from source.
71
+ - run: pip install -e ./atlas-python
72
+ - env:
73
+ VERSION: ${{ steps.vars.outputs.version }}
74
+ ALIAS: ${{ steps.vars.outputs.alias }}
75
+ run: |
76
+ git fetch origin gh-pages --depth=1 || true
77
+ # mike rejects an alias identical to the version, so only pass it when it differs
78
+ if [[ "$ALIAS" == "$VERSION" ]]; then
79
+ mike deploy --push --update-aliases -F atlas-python/mkdocs.yml "$VERSION"
80
+ else
81
+ mike deploy --push --update-aliases -F atlas-python/mkdocs.yml "$VERSION" "$ALIAS"
82
+ fi
83
+ # The site root must always redirect to `latest`, so only (re)write the
84
+ # root index.html when this run deploys the `latest` alias (releases).
85
+ # Manual `dev` runs are published at /dev/ but never touch the root.
86
+ if [[ "$ALIAS" == "latest" ]]; then
87
+ mike set-default --push -F atlas-python/mkdocs.yml latest
88
+ fi
@@ -28,4 +28,8 @@ raw_smoke_tests/
28
28
  pyatlas/python/pyatlas/_pyatlas.pyd
29
29
  pyatlas/python/pyatlas/_pyatlas.abi3.so
30
30
  playground/
31
- data/
31
+ data/
32
+ atlas-python/python/atlas/_atlas.pyd
33
+ atlas-python/python/atlas/_atlas.abi3.so
34
+ atlas-python/python/atlas/_atlas*.so
35
+ atlas-python/python/atlas/_atlas.pdb
@@ -83,7 +83,7 @@ Key design points:
83
83
  - **Sync Python API, backed by an internal multi-threaded tokio runtime.** Each blocking call uses `py.allow_threads(|| RT.block_on(...))` so other Python threads can run.
84
84
  - **Type dispatch via macros.** Atlas's read/write methods are generic over dtype (`T: ArrayElement`); the bindings dispatch at runtime via a `numeric_dispatch!` macro in [pyatlas/src/dataset.rs](pyatlas/src/dataset.rs).
85
85
  - **`numpy`-zero-copy on the numeric path.** Python `np.ndarray` ↔ `ndarray::ArrayView` via the `numpy` crate.
86
- - **xarray integration** lives in [pyatlas/python/pyatlas/xarray.py](pyatlas/python/pyatlas/xarray.py). The `Atlas.add_xr_dataset` Rust pymethod and the `ds.atlas.write` accessor both delegate to the `_write_xarray_new_dataset` helper. dask-backed variables are streamed one chunk at a time via `arr.blocks[idx].compute()`.
86
+ - **xarray integration** lives in [pyatlas/python/pyatlas/xarray.py](pyatlas/python/pyatlas/xarray.py). The `Atlas.add_xarray_dataset` Rust pymethod and the `ds.atlas.write` accessor both delegate to the `_write_xarray_new_dataset` helper. dask-backed variables are streamed one chunk at a time via `arr.blocks[idx].compute()`.
87
87
 
88
88
  ---
89
89
 
@@ -28,9 +28,9 @@ checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
28
28
 
29
29
  [[package]]
30
30
  name = "array-format"
31
- version = "0.9.0"
31
+ version = "0.10.0"
32
32
  source = "registry+https://github.com/rust-lang/crates.io-index"
33
- checksum = "d91c6d4d26f667272f8930d41bc95118716e12858baf115940a626510e7b5873"
33
+ checksum = "a637a3b5f23ba45eb53f09e643b363163114f0e94d0f6f05f330134cb86d381b"
34
34
  dependencies = [
35
35
  "bytes",
36
36
  "futures",
@@ -71,7 +71,7 @@ dependencies = [
71
71
 
72
72
  [[package]]
73
73
  name = "atlas-python"
74
- version = "0.9.0"
74
+ version = "0.10.0"
75
75
  dependencies = [
76
76
  "atlas-rust",
77
77
  "ndarray",
@@ -86,7 +86,7 @@ dependencies = [
86
86
 
87
87
  [[package]]
88
88
  name = "atlas-rust"
89
- version = "0.9.0"
89
+ version = "0.10.0"
90
90
  dependencies = [
91
91
  "array-format",
92
92
  "chrono",
@@ -5,11 +5,11 @@ members = ["atlas-python"]
5
5
  # Registry name on crates.io (`atlas` is taken). The library is still
6
6
  # imported as `atlas` — see `[lib]` below.
7
7
  name = "atlas-rust"
8
- version = "0.9.0"
8
+ version = "0.10.0"
9
9
  edition = "2024"
10
10
  description = "Directory-based store for thousands of N-dimensional datasets local or remote using object storage."
11
11
  license = "Apache-2.0"
12
- repository = "https://github.com/robinskil/atlas"
12
+ repository = "https://github.com/maris-development/atlas"
13
13
  readme = "README.md"
14
14
  keywords = ["array", "ndarray", "scientific", "storage", "object-store"]
15
15
  categories = ["science", "data-structures", "filesystem"]
@@ -22,7 +22,7 @@ all-features = true
22
22
  rustdoc-args = ["--cfg", "docsrs"]
23
23
 
24
24
  [dependencies]
25
- array-format = "0.9.0"
25
+ array-format = "0.10.0"
26
26
  object_store = "0.13"
27
27
  serde = { version = "1", features = ["derive"] }
28
28
  serde_json = "1"
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright [yyyy] [name of copyright owner]
189
+ Copyright 2026 Robin Kooyman
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
@@ -0,0 +1,291 @@
1
+ Metadata-Version: 2.4
2
+ Name: atlas-python
3
+ Version: 0.10.0
4
+ Classifier: Development Status :: 3 - Alpha
5
+ Classifier: Intended Audience :: Science/Research
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: Programming Language :: Rust
8
+ Classifier: Operating System :: OS Independent
9
+ Classifier: Topic :: Scientific/Engineering
10
+ Requires-Dist: numpy>=1.23
11
+ Requires-Dist: xarray>=2023.1
12
+ Requires-Dist: dask>=2023.1
13
+ Requires-Dist: zarr>=3 ; extra == 'bench'
14
+ Requires-Dist: numcodecs ; extra == 'bench'
15
+ Requires-Dist: netcdf4 ; extra == 'bench'
16
+ Requires-Dist: obstore>=0.9 ; extra == 'cloud'
17
+ Requires-Dist: pytest ; extra == 'test'
18
+ Requires-Dist: netcdf4 ; extra == 'test'
19
+ Provides-Extra: bench
20
+ Provides-Extra: cloud
21
+ Provides-Extra: test
22
+ License-File: LICENSE
23
+ Summary: Python bindings for the ATLAS array store
24
+ Keywords: array,ndarray,xarray,scientific,storage,object-store
25
+ Author-email: Robin Kooyman <robin.kooyman.work@gmail.com>
26
+ License-Expression: Apache-2.0
27
+ Requires-Python: >=3.10
28
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
29
+ Project-URL: Homepage, https://github.com/maris-development/atlas
30
+ Project-URL: Issues, https://github.com/maris-development/atlas/issues
31
+ Project-URL: Repository, https://github.com/maris-development/atlas
32
+
33
+ # atlas-python
34
+
35
+ Python bindings for **ATLAS** (Aggregated Tensor Large Array Store) — a directory-based store
36
+ for many similarly-shaped N-dimensional arrays, backed by local files or any object store
37
+ (S3 / GCS / Azure / HTTP). Built on a Rust core with a synchronous, NumPy-native API and
38
+ first-class [xarray](https://docs.xarray.dev) integration.
39
+
40
+ ```bash
41
+ pip install atlas-python
42
+ ```
43
+
44
+ ```python
45
+ import atlas
46
+ ```
47
+
48
+ | Extra | Install | Adds |
49
+ | --- | --- | --- |
50
+ | cloud | `pip install "atlas-python[cloud]"` | S3 / GCS / Azure / HTTP backends via [obstore](https://github.com/developmentseed/obstore) |
51
+
52
+ `numpy`, `xarray`, and `dask` are installed automatically.
53
+
54
+ ## Quick start
55
+
56
+ ```python
57
+ import numpy as np
58
+ import atlas
59
+
60
+ # The `with` block flushes (== close) on exit. Nothing is persisted before that.
61
+ with atlas.Atlas.create("/tmp/my_store", codec="zstd") as store: # "zstd" | "lz4" | "none"
62
+ ds = store.create_dataset("jan_2024")
63
+ ds.define_array(
64
+ "temperature",
65
+ dtype="float32",
66
+ dims=["lat", "lon"],
67
+ shape=[8, 16],
68
+ chunk_shape=[4, 8],
69
+ fill_value=float("nan"), # unwritten cells read back as NaN; NaN cells count as nulls in stats
70
+ )
71
+ ds.write_array("temperature", start=[0, 0], data=np.full((8, 16), 20.0, dtype=np.float32))
72
+ ds.set_attribute("month", 1)
73
+ ds.set_attribute("station", "KNMI")
74
+
75
+ # Reopen and read
76
+ store = atlas.Atlas.open("/tmp/my_store")
77
+ ds = store.open_dataset("jan_2024")
78
+ arr = ds.read_array("temperature") # full read -> np.ndarray
79
+ chunk = ds.read_array("temperature", [0, 0], [4, 8]) # partial read
80
+ stats = ds.array_stats("temperature") # {"row_count", "null_count", "min", "max"}
81
+ month = ds.get_attribute("month") # 1
82
+ ```
83
+
84
+ ## Durability model
85
+
86
+ This is the one concept to internalise: **writes are buffered in memory and only hit disk on
87
+ `flush()`.**
88
+
89
+ The store's metadata is loaded once on `open`/`create`. Every subsequent mutation — creating
90
+ datasets, defining arrays, `write_array`, `set_attribute` — updates in-memory state only.
91
+ **Nothing reaches disk until `store.flush()` (equivalently `store.close()`, or the `with store:`
92
+ block exiting).** Dropping an `Atlas` without flushing abandons every pending write.
93
+
94
+ The payoff: N consecutive writes amortise to a single flush — one delta file per touched array
95
+ name and one metadata rewrite, no matter how many datasets you touched.
96
+
97
+ ```python
98
+ store = atlas.Atlas.create("/tmp/my_store")
99
+ # ... many create_dataset / write_array calls ...
100
+ store.flush() # the single durability boundary
101
+ ```
102
+
103
+ ## xarray integration
104
+
105
+ Importing `atlas` registers an accessor at `xr.Dataset.atlas`, so the integration is always
106
+ available. The store must exist first; you then append xarray datasets to it.
107
+
108
+ ```python
109
+ import numpy as np, xarray as xr, atlas
110
+
111
+ ds = xr.Dataset(
112
+ data_vars={
113
+ "temperature": (["lat", "lon"], np.arange(8 * 16, dtype=np.float32).reshape(8, 16),
114
+ {"units": "C", "long_name": "surface temperature"}),
115
+ },
116
+ coords={"lat": np.arange(8, dtype=np.float32), "lon": np.arange(16, dtype=np.float32)},
117
+ attrs={"month": 1, "station": "KNMI"},
118
+ )
119
+
120
+ with atlas.Atlas.create("/tmp/my_store") as store:
121
+ store.add_xarray_dataset(ds, "jan_2024") # store-side method
122
+ ds.atlas.write(store, "jan_2025") # xarray accessor (same effect)
123
+
124
+ # Read back as an xr.Dataset
125
+ store = atlas.Atlas.open("/tmp/my_store")
126
+ ds_back = store.open_as_xarray_dataset("jan_2024")
127
+ xr.testing.assert_identical(ds, ds_back)
128
+ ```
129
+
130
+ ### Bulk ingestion
131
+
132
+ `add_xarray_dataset` never flushes by itself — N consecutive calls accumulate in memory and a single
133
+ `flush()` (or the `with` exit) persists everything.
134
+
135
+ ```python
136
+ import glob, os, atlas, xarray as xr
137
+
138
+ with atlas.Atlas.create("/tmp/store") as store:
139
+ for nc_path in sorted(glob.glob("*.nc")):
140
+ name = os.path.splitext(os.path.basename(nc_path))[0]
141
+ store.add_xarray_dataset(xr.open_dataset(nc_path), name)
142
+ # One delta file per array name across the whole batch (not one per file).
143
+ ```
144
+
145
+ ### Streaming dask-backed writes
146
+
147
+ If a variable's `.data` is a `dask.array.Array` (e.g. from `xr.open_dataset(path, chunks=...)`
148
+ or `ds.chunk({...})`), `add_xarray_dataset` / `ds.atlas.write` stream **one dask block at a time**
149
+ into the store rather than materialising the whole array. The dask chunk shape becomes the
150
+ on-disk `chunk_shape`, so the layout maps 1:1. Peak memory ≈ one chunk per variable.
151
+
152
+ ```python
153
+ ds = xr.open_dataset("big.nc", chunks={"time": 100, "lat": -1, "lon": -1})
154
+ with atlas.Atlas.create("/tmp/store") as store:
155
+ store.add_xarray_dataset(ds, "big") # streams chunk-by-chunk
156
+ ```
157
+
158
+ Pass `chunks={var: [...]}` to `add_xarray_dataset` / `ds.atlas.write` to override the on-disk chunk
159
+ shape independently of dask's chunking.
160
+
161
+ ### Lazy dask-backed reads
162
+
163
+ `store.open_as_xarray_dataset(name)` returns each variable dask-backed whenever it was stored with non-trivial
164
+ chunking (`chunk_shape != shape`); the dask `chunks` tuple mirrors the on-disk chunk grid and each
165
+ on-disk chunk is one dask task. Full-shape arrays (and 0-D scalars) come back eager as numpy. Call
166
+ `.compute()` to materialise, or slice / `map_blocks` to operate lazily.
167
+
168
+ ```python
169
+ ds_back = atlas.Atlas.open("/tmp/store").open_as_xarray_dataset("big")
170
+ ds_back["temperature"].data # -> dask.array.Array
171
+ ds_back["temperature"][0:100].compute() # reads exactly one chunk
172
+ ```
173
+
174
+ Reads run under dask's **threaded** scheduler only — the `DatasetView` captured in the graph isn't
175
+ picklable, so call `.compute()` before handing off to distributed/multiprocessing schedulers.
176
+
177
+ ### How xarray maps onto the store
178
+
179
+ | Item | How it's stored |
180
+ | --- | --- |
181
+ | Each coord / data variable | A separate array, with `dims` mapped 1:1. |
182
+ | Dataset attrs | Dataset attributes, plain keys. |
183
+ | Per-variable attrs | Flattened as `{var}.{attr}` at the dataset attr level. |
184
+ | Per-variable `_FillValue` | Consumed by `define_array` as a typed fill value (source `Dataset.attrs` is not mutated). See [Missing data](#missing-data). |
185
+ | Coord vs data_var distinction | JSON list in the internal `_pyatlas_coords` attr. |
186
+ | Non-scalar attr values (list, ndarray) | JSON-encoded string with a `json:` prefix marker. |
187
+
188
+ Each `add_xarray_dataset` / `ds.atlas.write` creates a *new* dataset — there is no append-into-existing
189
+ mode.
190
+
191
+ ### Missing data
192
+
193
+ When a dataset is opened with `mask_and_scale=True` (xarray's default), masked cells become `NaN`
194
+ (floats) / `NaT` (datetimes) and `_FillValue` is moved into `var.encoding`. So those cells are
195
+ recorded as **null** (counted in `null_count`, excluded from min/max stats), arrays default to a
196
+ sentinel fill on write: `NaN` for floats, `NaT` for `datetime64[ns]`, and `""` for strings (integers
197
+ have none). Missing string cells (`None`/`NaN`) are substituted with the string fill and a warning is
198
+ emitted, since a string can't be stored as null directly.
199
+
200
+ Override per write with `fill_value` — a bare scalar (numeric arrays) or a `{var: scalar}` dict
201
+ (`None` disables the default for that var); an explicit CF `_FillValue` attribute still takes
202
+ precedence over the default:
203
+
204
+ ```python
205
+ store.add_xarray_dataset(ds, "jan_2024", fill_value={"temperature": -9999.0})
206
+ ```
207
+
208
+ See the [xarray guide](https://github.com/maris-development/atlas/blob/main/atlas-python/docs/guides/xarray.md#fill-values-and-missing-data)
209
+ for the full resolution order.
210
+
211
+ ## Supported dtypes
212
+
213
+ | numpy dtype | atlas dtype |
214
+ | --- | --- |
215
+ | `int8/16/32/64`, `uint8/16/32/64`, `float32/64` | matching numeric |
216
+ | `datetime64[ns]` | `timestamp_nanoseconds` (aliases: `timestamp_ns`, `datetime64[ns]`) |
217
+ | `object` (`str`/`bytes`), `\|S<n>`, `\|U<n>` | `string` (variable-length; reads return Python `str`) |
218
+
219
+ - 0-D scalar arrays (`shape=[]`) are supported for every dtype above.
220
+ - `bool` is available as an *attribute* type but not as an array dtype.
221
+ - `binary`, `list[...]`, `fixed_size_list[...,N]` are reserved for a later release.
222
+
223
+ ## Cloud / object storage
224
+
225
+ With the `cloud` extra, `Atlas.open` / `Atlas.create` accept an
226
+ [obstore](https://github.com/developmentseed/obstore)-constructed S3 / GCS / Azure / HTTP store
227
+ handle instead of a local path. The path-based local-filesystem API works without it. See the
228
+ [cloud storage guide](https://github.com/maris-development/atlas/blob/main/atlas-python/docs/guides/cloud-storage.md).
229
+
230
+ ## API reference
231
+
232
+ ### `atlas.Atlas`
233
+
234
+ | Method | Description |
235
+ | --- | --- |
236
+ | `Atlas.create(path, codec="zstd")` | Create a new store at `path`. |
237
+ | `Atlas.open(path)` | Open an existing store. |
238
+ | `create_dataset(name) -> DatasetView` | New dataset (in-memory until flush). |
239
+ | `open_dataset(name) -> DatasetView` | Existing dataset. |
240
+ | `delete_dataset(name)` | Remove a dataset (persisted on next `flush`). |
241
+ | `list_datasets() -> list[str]` | All dataset names. |
242
+ | `list_arrays() -> list[str]` | Distinct array names across datasets. |
243
+ | `dataset_exists(name) -> bool` | Existence check. |
244
+ | `add_xarray_dataset(ds, name, chunks=None, fill_value=None)` | Append an `xarray.Dataset` (does **not** flush). `fill_value` overrides the per-array fill (scalar or `{var: scalar}`); see [Missing data](#missing-data). |
245
+ | `open_as_xarray_dataset(name) -> xr.Dataset` | Read a dataset back (chunked vars come back dask-backed). |
246
+ | `open_as_many_xarray_dataset(names, concat_dim="dataset") -> xr.Dataset` | Open many datasets stacked along `concat_dim` (eager numpy). |
247
+ | `flush()` | The single durability boundary — persist everything. |
248
+ | `close()` | Alias for `flush()`; also the `with`-block exit. |
249
+ | `compact()` | Reclaim tombstoned space across cached array files. |
250
+ | `__enter__` / `__exit__` | Context-manager support (`__exit__` calls `close()`). |
251
+
252
+ ### `atlas.DatasetView`
253
+
254
+ | Method | Description |
255
+ | --- | --- |
256
+ | `name` (property) | Dataset name. |
257
+ | `list_arrays() -> list[str]` | Array names in this dataset. |
258
+ | `define_array(name, dtype, dims, shape, chunk_shape=None, fill_value=None)` | Declare a new array. `fill_value` is a Python scalar matching the dtype; unwritten cells read back as it, and *written* cells equal to it count as nulls in `array_stats`. Dtype is enforced (`TypeError` on mismatch, `OverflowError` for out-of-range ints). |
259
+ | `write_array(name, start, data)` | Write a numpy ndarray (matching the stored dtype). |
260
+ | `read_array(name, start=None, shape=None) -> np.ndarray \| None` | Read full or partial; `None` if the array isn't in this dataset. |
261
+ | `delete_array(name)` | Tombstone the array within this dataset. |
262
+ | `array_meta(name) -> dict \| None` | `{"dtype", "shape", "chunk_shape", "dimension_names"}`. |
263
+ | `array_stats(name) -> dict \| None` | `{"row_count", "null_count", "min", "max"}` — populated after `flush()`. |
264
+ | `set_attribute(key, value, dtype=None)` | Type inferred from the Python value; pass `dtype` to override (e.g. `"int8"`, `"float32"`, `"timestamp_nanoseconds"`). On disk: bool, int64, float64, string, timestamp_nanoseconds. |
265
+ | `get_attribute(key)` / `attributes()` | Single attribute or dict of all. |
266
+
267
+ `DatasetView` does **not** expose its own `flush` / `compact` — both go through the parent `Atlas`.
268
+
269
+ ## Examples
270
+
271
+ Runnable, self-contained scripts (each writes to a temp directory):
272
+
273
+ - [01_basics.py](https://github.com/maris-development/atlas/blob/main/atlas-python/examples/01_basics.py) — create a store, define arrays, set attributes, reopen, read back.
274
+ - [02_xarray.py](https://github.com/maris-development/atlas/blob/main/atlas-python/examples/02_xarray.py) — round-trip an `xr.Dataset` via both `store.add_xarray_dataset(...)` and the `ds.atlas.write(...)` accessor.
275
+ - [03_dask_streaming.py](https://github.com/maris-development/atlas/blob/main/atlas-python/examples/03_dask_streaming.py) — stream a dask-chunked `xr.Dataset` in one chunk at a time.
276
+ - [09_missing_data.py](https://github.com/maris-development/atlas/blob/main/atlas-python/examples/09_missing_data.py) — masked/missing cells with default `NaN` / `NaT` / `""` fills, `null_count`, and `fill_value=` overrides.
277
+
278
+ ## Performance
279
+
280
+ ATLAS is tuned for collections of many similarly-shaped datasets. On a "1000 datasets" benchmark
281
+ against netCDF4 and Zarr v3, the bulk read paths (`Atlas.open_as_many_xarray_dataset` /
282
+ `Atlas.read_array_across_stacked`) beat Zarr by ~2.8× on large chunked slice reads, and on small
283
+ per-dataset workloads ATLAS leads on both reads and writes. See the
284
+ [benchmarks](https://github.com/maris-development/atlas/tree/main/atlas-python/benchmarks) for the full
285
+ methodology, numbers, and an API picker for the fastest read path per workload.
286
+
287
+ ## Links
288
+
289
+ - Source & issues: <https://github.com/maris-development/atlas>
290
+ - License: Apache-2.0
291
+
@@ -1,7 +1,20 @@
1
1
  # ATLAS — Aggregated Tensor Large Array Store
2
2
 
3
+ [![CI](https://github.com/maris-development/atlas/actions/workflows/ci.yaml/badge.svg)](https://github.com/maris-development/atlas/actions/workflows/ci.yaml)
4
+ [![crates.io](https://img.shields.io/crates/v/atlas-rust.svg?logo=rust)](https://crates.io/crates/atlas-rust)
5
+ [![docs.rs](https://img.shields.io/docsrs/atlas-rust?logo=docsdotrs&label=docs.rs)](https://docs.rs/atlas-rust)
6
+ [![PyPI](https://img.shields.io/pypi/v/atlas-python.svg?logo=pypi&logoColor=white)](https://pypi.org/project/atlas-python/)
7
+ [![Python docs](https://img.shields.io/badge/docs-atlas--python-blue?logo=materialformkdocs&logoColor=white)](https://maris-development.github.io/atlas/)
8
+ [![License](https://img.shields.io/crates/l/atlas-rust.svg)](LICENSE)
9
+
3
10
  A directory-based store for thousands of named datasets, each holding N-dimensional typed arrays. Built on top of the [`array-format`](https://github.com/robinskil/array-format) (`.af`) binary format, with configurable compression (Zstd, LZ4, or none), chunked I/O, and an [`object_store`](https://crates.io/crates/object_store) backend that works on local disk, S3, GCS, Azure Blob, and in-memory.
4
11
 
12
+ **Think of it as a "zip" for N-dimensional datasets.** Where a `.zip` bundles many files into one archive, ATLAS gathers many NetCDF / Zarr-style datasets — anything that's a set of named N-dimensional arrays — into a single high-performance collection. But it's more than a bundle: instead of storing each dataset whole, ATLAS lays the data out **variable-first**, so every dataset's `temperature` lives in one file. That makes it cheap to scan or slice a single variable across thousands of datasets at once, while still reading back any individual dataset as a normal NetCDF/xarray-like object.
13
+
14
+ > **Looking for Python?** The Python bindings live in [`atlas-python/`](atlas-python/) — `pip install atlas-python`, then `import atlas`. They add a NumPy-native API and first-class [xarray](https://docs.xarray.dev) integration. See the [atlas-python README](atlas-python/README.md) for usage.
15
+ >
16
+ > The rest of this document covers **how the format works and the Rust crate**.
17
+
5
18
  ---
6
19
 
7
20
  ## What it does
@@ -251,7 +264,7 @@ Choose LZ4 when decompression throughput matters more than storage size (e.g. la
251
264
 
252
265
  ### Write path
253
266
 
254
- Writes are buffered in-memory across the whole atlas. Calling `Atlas::flush()` compresses and writes every modified block across every cached array file, then rewrites `atlas.json` atomically (a single `PUT`). The write path scales with the number of modified chunks, not the number of datasets, and N consecutive `add_xr_dataset` / `create_dataset` calls amortise to a single flush.
267
+ Writes are buffered in-memory across the whole atlas. Calling `Atlas::flush()` compresses and writes every modified block across every cached array file, then rewrites `atlas.json` atomically (a single `PUT`). The write path scales with the number of modified chunks, not the number of datasets, and N consecutive `add_xarray_dataset` / `create_dataset` calls amortise to a single flush.
255
268
 
256
269
  ### Compaction
257
270
 
@@ -295,7 +308,7 @@ the `(0:25, 0:25, 0:12)` slice down to chunk-level reads.
295
308
  | **atlas-bulk** | 1 store, `read_array_across_stacked` with slice push-down | **2.12** | 59 | 6387 |
296
309
  | **atlas + `--use-dask`** | 1 store, dask-threaded per-dataset `view.read_arrays(...)` | **3.21** | 60 | 6387 |
297
310
  | zarr | 1000 separate stores, `xr.open_mfdataset(parallel=True).isel(...)` | 5.99 | 38 | 6392 |
298
- | atlas (default) | 1 store, serial per-dataset `to_xarray(...).isel(...).load()` | 10.23 | 51 | 6387 |
311
+ | atlas (default) | 1 store, serial per-dataset `open_as_xarray_dataset(...).isel(...).load()` | 10.23 | 51 | 6387 |
299
312
  | netcdf | 1000 `.nc` files, `xr.open_mfdataset(parallel=True).isel(...)` | 13.91 | 122 | 5596 |
300
313
 
301
314
  #### `--case profile --datasets 1000` (~67 MB raw — per-dataset overhead dominates)
@@ -326,9 +339,9 @@ For tiny-shape datasets the comparison is dominated by per-dataset overhead, whi
326
339
 
327
340
  ### What the numbers say
328
341
 
329
- - **Reads on gridded** (decompression-dominated, with realistic chunking + slice push-down): `atlas-bulk` reads in **2.12s vs zarr's 6.00s — 2.8× faster**. `atlas + --use-dask` (using the new `view.read_arrays(...)` fast path) hits **3.21s — 1.9× faster than zarr**. The win comes from atlas's structural advantage (one open of one file per variable, in-memory metadata) combined with APIs that bypass `to_xarray`'s xr.Dataset + per-chunk dask graph overhead. zarr and netcdf both push the slice down through `open_mfdataset(...).isel(...)` via dask graph optimization — they're not penalised by the chunking; atlas just wins by amortising metadata and skipping per-dataset Python overhead.
342
+ - **Reads on gridded** (decompression-dominated, with realistic chunking + slice push-down): `atlas-bulk` reads in **2.12s vs zarr's 6.00s — 2.8× faster**. `atlas + --use-dask` (using the new `view.read_arrays(...)` fast path) hits **3.21s — 1.9× faster than zarr**. The win comes from atlas's structural advantage (one open of one file per variable, in-memory metadata) combined with APIs that bypass `open_as_xarray_dataset`'s xr.Dataset + per-chunk dask graph overhead. zarr and netcdf both push the slice down through `open_mfdataset(...).isel(...)` via dask graph optimization — they're not penalised by the chunking; atlas just wins by amortising metadata and skipping per-dataset Python overhead.
330
343
  - **Reads on profile** (overhead-dominated): atlas wins by an order of magnitude. `atlas-bulk` is **~50× faster than zarr** (0.08s vs 4.07s) because the per-dataset I/O is small enough that everything is overhead — and atlas's structural design is built for exactly that case. Default serial `atlas` is still ~12× faster than zarr.
331
- - **Default `atlas.to_xarray` iteration is currently SLOW on chunked storage** (10.23s vs zarr's 6.00s). It goes through `to_xarray(name)` which returns dask-backed arrays per chunk (8 chunks/var × 3 vars × 1000 datasets = 24,000 dask delayed tasks just to build the graph). Dask graph overhead exceeds the parallelism win. **The fix is to use `view.read_arrays(vars, start, shape)` for per-dataset slice reads** — that's what `atlas + --use-dask` does internally and why it hits 3.21s. For cross-dataset reads of the *same* slice from many datasets, prefer `Atlas.to_xarray_many` / `read_array_across_stacked` (the `atlas-bulk` row).
344
+ - **Default `atlas.open_as_xarray_dataset` iteration is currently SLOW on chunked storage** (10.23s vs zarr's 6.00s). It goes through `open_as_xarray_dataset(name)` which returns dask-backed arrays per chunk (8 chunks/var × 3 vars × 1000 datasets = 24,000 dask delayed tasks just to build the graph). Dask graph overhead exceeds the parallelism win. **The fix is to use `view.read_arrays(vars, start, shape)` for per-dataset slice reads** — that's what `atlas + --use-dask` does internally and why it hits 3.21s. For cross-dataset reads of the *same* slice from many datasets, prefer `Atlas.open_as_many_xarray_dataset` / `read_array_across_stacked` (the `atlas-bulk` row).
332
345
  - **Workload sensitivity**: `--use-dask` helps when per-dataset decompression is the bottleneck and *hurts* when per-dataset overhead is the bottleneck (profile: default `atlas` 0.32s → dask 2.03s). Picking the right API for the workload matters more than picking dask vs serial.
333
346
  - **Writes on gridded**: zarr is fastest (~31s vs atlas's ~50s) — each `to_zarr(...)` just dumps bytes into a per-dataset subtree, while atlas does more bookkeeping per call (schema registration, per-dataset attrs into the shared `atlas.msgpack.zst`, block addressing in the shared array file). Atlas still beats netcdf decisively.
334
347
  - **Writes on profile**: atlas wins ~12× (0.91s vs zarr's 11.43s, netcdf's 2.98s). At small per-dataset sizes the metadata write dominates, and atlas's amortised single-flush model wins.
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "atlas-python"
3
- version = "0.9.0"
3
+ version = "0.10.0"
4
4
  edition = "2021"
5
5
  readme = "README.md"
6
6