From 753ad16ad423e4cd952cdd12c1faf6b073202160 Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Tue, 3 Sep 2024 10:30:42 -0400 Subject: [PATCH] docstring --- kerchunk/hdf4.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/kerchunk/hdf4.py b/kerchunk/hdf4.py index 95dc548..449e4e0 100644 --- a/kerchunk/hdf4.py +++ b/kerchunk/hdf4.py @@ -15,21 +15,19 @@ def f(func): class HDF4ToZarr: + """Experimental: interface to HDF4 archival files""" + def __init__( self, path, storage_options=None, inline_threshold=100, out=None, - remote_protocol=None, - remote_options=None, ): self.path = path self.st = storage_options self.thresh = inline_threshold self.out = out or {} - self.remote_protocol = remote_protocol - self.remote_options = remote_options def read_int(self, n): return int.from_bytes(self.f.read(n), "big") @@ -76,7 +74,8 @@ def translate(self, filename=None, storage_options=None): import zarr from kerchunk.codecs import ZlibCodec - self.f = fsspec.open(self.path, **(self.st or {})).open() + fo = fsspec.open(self.path, **(self.st or {})) + self.f = fo.open() # magic header assert self.f.read(4) == b"\x0e\x03\x13\x01" @@ -134,11 +133,13 @@ def translate(self, filename=None, storage_options=None): # hierarchical output output = self._descend_vg(*list(roots)[0]) + prot = fo.fs.protocol + prot = prot[0] if isinstance(prot, tuple) else prot fs = fsspec.filesystem( "reference", fo=self.out, - remote_protocol=self.remote_protocol, - remote_options=self.remote_options, + remote_protocol=prot, + remote_options=self.st, ) g = zarr.open_group("reference://", storage_options=dict(fs=fs)) refs = {}