-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
148 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import pytest | ||
import xarray as xr | ||
|
||
|
||
@pytest.fixture | ||
def netcdf4_file(tmpdir): | ||
# Set up example xarray dataset | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
import xarray as xr | ||
import numpy as np | ||
import xarray as xr | ||
import xarray.testing as xrt | ||
from virtualizarr import open_virtual_dataset, ManifestArray | ||
|
||
from virtualizarr import ManifestArray, open_virtual_dataset | ||
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, | ||
), | ||
) | ||
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)}, attrs={"something": 0}) | ||
|
||
original.virtualize.to_zarr(tmpdir / "store.zarr") | ||
roundtrip = open_virtual_dataset(tmpdir / "store.zarr", filetype="zarr_v3", indexes={}) | ||
roundtrip = open_virtual_dataset( | ||
tmpdir / "store.zarr", filetype="zarr_v3", indexes={} | ||
) | ||
|
||
xrt.assert_identical(roundtrip, original) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.