File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,8 +61,31 @@ MuData objects can be read and cached from remote locations including via HTTP(S
6161A caching layer can be added in the following way:
6262::
6363 fname_cached = "filecache::" + fname
64- with fsspec.open(fname_cached, filecache={'cache_storage': '/tmp/'}):
64+ with fsspec.open(fname_cached, filecache={'cache_storage': '/tmp/'}) as f :
6565 mdata = mudata.read_h5mu(f)
6666
6767
6868For more `fsspec ` usage examples see [its documentation](https://filesystem-spec.readthedocs.io/).
69+
70+ S3
71+ ^^
72+
73+ MuData objects in the ``.h5mu `` format stored in an S3 bucket can be read with ``fsspec `` as well:
74+ ::
75+ storage_options = {
76+ 'endpoint_url': 'localhost:9000',
77+ 'key': 'AWS_ACCESS_KEY_ID',
78+ 'secret': 'AWS_SECRET_ACCESS_KEY',
79+ }
80+
81+ with fsspec.open('s3://bucket/dataset.h5mu', **storage_options) as f:
82+ mudata.read_h5mu(f)
83+
84+
85+ MuData objects stored in the ``.zarr `` format in an S3 bucket can be read from a *mapping *:
86+ ::
87+ import s3fs
88+
89+ s3 = s3fs.S3FileSystem(**storage_options)
90+ store = s3.get_mapper('s3://bucket/dataset.zarr')
91+ mdata = mudata.read_zarr(store)
Original file line number Diff line number Diff line change @@ -369,10 +369,13 @@ def _validate_h5mu(filename: PathLike) -> (str, Callable | None):
369369 # with fsspec.open("s3://bucket/file.h5mu") as f:
370370 # mdata = read_h5mu(f)
371371 # or
372- # mdata = read_h5mu(fsspec.open("s3://bucket/file.h5mu")
372+ # mdata = read_h5mu(fsspec.open("s3://bucket/file.h5mu"))
373373 if (
374374 filename .__class__ .__name__ == "BufferedReader"
375375 or filename .__class__ .__name__ == "OpenFile"
376+ or filename .__class__ .__name__ == "HTTPFile"
377+ or filename .__class__ .__name__ == "HTTPStreamFile"
378+ or filename .__class__ .__name__ == "S3File"
376379 ):
377380 try :
378381 from fsspec .core import OpenFile
Original file line number Diff line number Diff line change @@ -544,7 +544,7 @@ def _update_attr(
544544 if OPTIONS ["pull_on_update" ] is None :
545545 warnings .warn (
546546 "From 0.4 .update() will not pull obs/var columns from individual modalities by default anymore. "
547- "Set mudate .set_options(pull_on_update=False) to adopt the new behaviour, which will become the default. "
547+ "Set mudata .set_options(pull_on_update=False) to adopt the new behaviour, which will become the default. "
548548 "Use new pull_obs/pull_var and push_obs/push_var methods for more flexibility." ,
549549 FutureWarning ,
550550 stacklevel = 2 ,
You can’t perform that action at this time.
0 commit comments