Skip to content

Commit

Permalink
forgot to add the file with the test
Browse files Browse the repository at this point in the history
  • Loading branch information
TomNicholas committed Apr 1, 2024
1 parent 79f39e1 commit 98a259e
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions virtualizarr/tests/test_zarr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import xarray as xr
import numpy as np
import xarray.testing as xrt
from virtualizarr import open_virtual_dataset, ManifestArray
from virtualizarr.manifests.manifest import ChunkEntry


def test_zarr_v3_roundtrip(tmpdir):
arr = ManifestArray(
chunkmanifest={"0.0": ChunkEntry(path="test.nc", offset=6144, length=48)},
zarray=dict(
shape=(2, 3),
dtype=np.dtype("<i8"),
chunks=(2, 3),
compressor=None,
filters=None,
fill_value=None,
order="C",
zarr_format=3,
),
)
original = xr.Dataset({"a": (["x", "y"], arr)})

original.virtualize.to_zarr(tmpdir / "store.zarr")
roundtrip = open_virtual_dataset(tmpdir / "store.zarr", filetype="zarr_v3", indexes={})

xrt.assert_identical(roundtrip, original)

0 comments on commit 98a259e

Please sign in to comment.