Skip to content

Commit 0cf8cfd

Browse files
authored
Add goat link (#576)
* Add goat link * fix a couple of tests for latest zarr (still working)
1 parent 3a2e9de commit 0cf8cfd

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

docs/source/index.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ Indices and tables
7979
* :ref:`modindex`
8080
* :ref:`search`
8181

82+
These docs pages collect anonymous tracking data using goatcounter, and the
83+
dashboard is available to the public: https://kerchunk.goatcounter.com/ .
84+
85+
8286
.. raw:: html
8387

8488
<script data-goatcounter="https://kerchunk.goatcounter.com/count"

kerchunk/hdf.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ def _translator(
340340
for v in val
341341
]
342342
kwargs["data"] = out
343-
kwargs["filters"] = [numcodecs.JSON()]
343+
kwargs["filters"] = [numcodecs.VLenUTF8()]
344344
fill = None
345345
elif self.vlen == "null":
346346
dt = "O"
@@ -466,7 +466,7 @@ def _translator(
466466
)
467467
dt = "O"
468468
kwargs["data"] = data2
469-
kwargs["filters"] = [numcodecs.JSON()]
469+
kwargs["filters"] = [numcodecs.VLenUTF8()]
470470
fill = None
471471
else:
472472
raise NotImplementedError
@@ -481,6 +481,8 @@ def _translator(
481481

482482
# Create a Zarr array equivalent to this HDF5 dataset.
483483
data = kwargs.pop("data", None)
484+
if (dt or h5obj.dtype) == object:
485+
dt = "string"
484486
za = self._zroot.require_array(
485487
name=h5obj.name.lstrip("/"),
486488
shape=h5obj.shape,

tests/test_hdf.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,15 @@ def test_times_str(times_data):
195195

196196
def test_string_embed():
197197
fn = osp.join(here, "vlen.h5")
198-
h = kerchunk.hdf.SingleHdf5ToZarr(fn, fn, vlen_encode="embed", error="pdb")
198+
h = kerchunk.hdf.SingleHdf5ToZarr(fn, fn, vlen_encode="embed")
199199
out = h.translate()
200200

201201
localfs = AsyncFileSystemWrapper(fsspec.filesystem("file"))
202202
fs = refs_as_fs(out, fs=localfs)
203203
# assert txt in fs.references["vlen_str/0"]
204204
store = fs_as_store(fs)
205205
z = zarr.open(store, zarr_format=2)
206-
assert z["vlen_str"].dtype == "O"
206+
assert "String" in str(z["vlen_str"])
207207
assert z["vlen_str"][0] == txt
208208
assert (z["vlen_str"][1:] == "").all()
209209

@@ -218,14 +218,16 @@ def test_string_pathlib():
218218
fs = fsspec.filesystem("reference", fo=out)
219219
assert txt in fs.references["vlen_str/0"]
220220
z = zarr.open(fs_as_store(fs))
221-
assert z["vlen_str"].dtype == "O"
221+
assert "String" in str(z["vlen_str"])
222222
assert z["vlen_str"][0] == txt
223223
assert (z["vlen_str"][1:] == "").all()
224224

225225

226226
def test_string_null():
227227
fn = osp.join(here, "vlen.h5")
228-
h = kerchunk.hdf.SingleHdf5ToZarr(fn, fn, vlen_encode="null", inline_threshold=0)
228+
h = kerchunk.hdf.SingleHdf5ToZarr(
229+
fn, fn, vlen_encode="null", inline_threshold=0, error="pdb"
230+
)
229231
out = h.translate()
230232
localfs = AsyncFileSystemWrapper(fsspec.filesystem("file"))
231233
store = refs_as_store(out, fs=localfs)

0 commit comments

Comments
 (0)