diff --git a/lindi/LindiH5ZarrStore/LindiH5ZarrStore.py b/lindi/LindiH5ZarrStore/LindiH5ZarrStore.py index b188e65..86cc173 100644 --- a/lindi/LindiH5ZarrStore/LindiH5ZarrStore.py +++ b/lindi/LindiH5ZarrStore/LindiH5ZarrStore.py @@ -501,7 +501,7 @@ def _get_external_array_link(self, parent_key: str, h5_item: h5py.Dataset): if self._url is not None: self._external_array_links[parent_key] = { "link_type": "hdf5_dataset", - "url": self._url, # url is not going to be null based on the check in __init__ + "url": self._url, "name": parent_key, } else: diff --git a/lindi/LindiH5ZarrStore/LindiH5ZarrStoreOpts.py b/lindi/LindiH5ZarrStore/LindiH5ZarrStoreOpts.py index a99341a..40fe998 100644 --- a/lindi/LindiH5ZarrStore/LindiH5ZarrStoreOpts.py +++ b/lindi/LindiH5ZarrStore/LindiH5ZarrStoreOpts.py @@ -11,6 +11,7 @@ class LindiH5ZarrStoreOpts: num_dataset_chunks_threshold (Union[int, None]): For each dataset in the HDF5 file, if the number of chunks is greater than this threshold, then the dataset will be represented as an external array link. If None, then - the threshold is not used. Default is 1000. + no datasets will be represented as external array links (equivalent to a + threshold of 0). Default is 1000. """ num_dataset_chunks_threshold: Union[int, None] = 1000 diff --git a/lindi/LindiH5pyFile/LindiH5pyFile.py b/lindi/LindiH5pyFile/LindiH5pyFile.py index 568db95..5968a34 100644 --- a/lindi/LindiH5pyFile/LindiH5pyFile.py +++ b/lindi/LindiH5pyFile/LindiH5pyFile.py @@ -58,7 +58,14 @@ def from_lindi_file(url_or_path: str, *, mode: LindiFileMode = "r", staging_area return LindiH5pyFile.from_reference_file_system(url_or_path, mode=mode, staging_area=staging_area, local_cache=local_cache, local_file_path=local_file_path) @staticmethod - def from_hdf5_file(url_or_path: str, *, mode: LindiFileMode = "r", local_cache: Union[LocalCache, None] = None, zarr_store_opts: Union[LindiH5ZarrStoreOpts, None] = None): + def from_hdf5_file( + url_or_path: str, + *, + mode: LindiFileMode = "r", + local_cache: Union[LocalCache, None] = None, + zarr_store_opts: Union[LindiH5ZarrStoreOpts, None] = None, + url: Union[str, None] = None + ): """ Create a LindiH5pyFile from a URL or path to an HDF5 file. @@ -73,11 +80,18 @@ def from_hdf5_file(url_or_path: str, *, mode: LindiFileMode = "r", local_cache: The local cache to use for caching data chunks, by default None. zarr_store_opts : Union[LindiH5ZarrStoreOpts, None], optional The options to use for the zarr store, by default None. + url : str or None + If url_or_path is a local file name, then this can + optionally be set to the URL of the remote file to be used when + creating references. If None, and the url_or_path is a + local file name, then you will need to set + zarr_store_opts.num_dataset_chunks_threshold to None, and you will not be able + to use the to_reference_file_system method. """ from ..LindiH5ZarrStore.LindiH5ZarrStore import LindiH5ZarrStore # avoid circular import if mode != "r": raise Exception("Opening hdf5 file in write mode is not supported") - zarr_store = LindiH5ZarrStore.from_file(url_or_path, local_cache=local_cache, opts=zarr_store_opts, url=url_or_path) + zarr_store = LindiH5ZarrStore.from_file(url_or_path, local_cache=local_cache, opts=zarr_store_opts, url=url) return LindiH5pyFile.from_zarr_store( zarr_store=zarr_store, mode=mode,