Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
martindurant committed Aug 1, 2024
1 parent 6efac29 commit 429d1df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
10 changes: 3 additions & 7 deletions kerchunk/combine.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,8 @@ def store_coords(self):
"""
Write coordinate arrays into the output
"""
fs = fsspec.filesystem(
"reference",
fo=self.out,
remote_protocol=self.remote_protocol,
remote_options=self.remote_options,
)
store = zarr.storage.FSStore("", fs=fs)
kv = {}
store = zarr.storage.KVStore(kv)
group = zarr.open(store)
m = self.fss[0].get_mapper("")
z = zarr.open(m)
Expand Down Expand Up @@ -442,6 +437,7 @@ def store_coords(self):
else:
arr.attrs.update(self.cf_units[k])
# TODO: rewrite .zarray/.zattrs with ujson to save space. Maybe make them by hand anyway.
self.out.update(kv)
logger.debug("Written coordinates")
for fn in [".zgroup", ".zattrs"]:
# top-level group attributes from first input
Expand Down
8 changes: 4 additions & 4 deletions kerchunk/tests/test_combine.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,29 +475,29 @@ def test_lazy_filler(tmpdir, refs):
mzz.second_pass()

# actual references don't show
assert set(out) == {
assert set(out.zmetadata) == {
".zattrs",
".zgroup",
".zmetadata",
"data/.zarray",
"data/.zattrs",
"static/.zarray",
"static/.zattrs",
"time/.zarray",
"time/.zattrs",
}
assert out._items
out.flush()
assert set(out) == {
assert set(out.zmetadata) == {
".zattrs",
".zgroup",
".zmetadata",
"data/.zarray",
"data/.zattrs",
"static/.zarray",
"static/.zattrs",
"time/.zarray",
"time/.zattrs",
}
assert set(out._items) == {".zmetadata"}
allfiles = fs.find(tmpdir)
assert [
f"{tmpdir}/{a}" in allfiles for a in ["static/refs.0.parq", "data/refs.0.parq"]
Expand Down

0 comments on commit 429d1df

Please sign in to comment.