ngff_zarr._remote_reader¶
Remote OME-Zarr reads through zarrista’s async API over obstore.
zarrista’s synchronous Array/Group only accept its closed store
union (FilesystemStore/MemoryStore/ZipStore); remote object
stores are reached through AsyncArray/AsyncGroup over any obstore
store (HTTP(S), S3, GCS, Azure). This module bridges that async surface to
ngff-zarr’s synchronous read path:
Every zarrista coroutine runs on a dedicated daemon event-loop thread.
asyncio.runwould fail inside environments that already run a loop (e.g. Jupyter), and zarrista’s pyo3 futures require a running loop at call time, so calls are submitted as coroutine factories executed inside the loop.fsspec-style
storage_optionsare translated to obstore configuration where a mapping exists; unrecognized keys are first passed through verbatim (so obstore-native option names keep working) and dropped with a warning only when obstore rejects them.- class:
RemoteZarrGroup/:class:RemoteZarrArrayprovide the same read surface as the compat layer’sLocalZarrGroup/LocalZarrArray.
zarrista requires Python >= 3.11 and obstore is an optional dependency
(the remote extra), so both are imported lazily inside each function.
Module Contents¶
Classes¶
Handle for a remote OME-Zarr store read via zarrista’s async API. |
|
Read-only handle for an array node within a remote store. |
|
Read-only handle for a group node within a remote store. |
Functions¶
Whether the zarrista/obstore remote read engine can be used. |
|
The shared event loop running on a daemon thread, started on demand. |
|
Execute the awaitable produced by factory on the IO loop. |
|
Split fsspec-style storage_options into obstore option dicts. |
|
The region AWS reports for bucket, or |
|
Add the bucket’s region to translated when nothing else supplies one. |
|
Construct the obstore store for url, translating storage_options. |
|
dask adapter over an |
|
Wrap |
|
The |
|
Open the node at component within remote store. |
|
Open the array at component within store as a lazy dask array. |
Data¶
API¶
- ngff_zarr._remote_reader.__all__¶
[‘RemoteZarrArray’, ‘RemoteZarrGroup’, ‘RemoteZarrStore’, ‘open_remote_lazy’, ‘open_remote_node’, ‘r…
- ngff_zarr._remote_reader._MISSING_METADATA_MARKER¶
‘metadata is missing’
- ngff_zarr._remote_reader.remote_read_available() bool¶
Whether the zarrista/obstore remote read engine can be used.
- ngff_zarr._remote_reader._IO_LOOP: asyncio.AbstractEventLoop | None¶
None
- ngff_zarr._remote_reader._IO_LOOP_LOCK¶
‘Lock(…)’
- ngff_zarr._remote_reader._io_loop() asyncio.AbstractEventLoop¶
The shared event loop running on a daemon thread, started on demand.
- ngff_zarr._remote_reader._run(factory)¶
Execute the awaitable produced by factory on the IO loop.
factory is a zero-argument callable evaluated inside the loop, not a coroutine object: zarrista’s pyo3 methods create their futures at call time and require the running loop to exist then.
- ngff_zarr._remote_reader._S3_ALIASES¶
None
- ngff_zarr._remote_reader._GS_ALIASES¶
None
- ngff_zarr._remote_reader._AZURE_ALIASES¶
None
- ngff_zarr._remote_reader._HTTP_ALIASES¶
None
- ngff_zarr._remote_reader._SCHEME_ALIASES¶
None
- ngff_zarr._remote_reader._CLIENT_KWARGS_ALIASES¶
None
- ngff_zarr._remote_reader._translate_storage_options( ) tuple[dict, dict]¶
Split fsspec-style storage_options into obstore option dicts.
Returns
(translated, passthrough): translated holds options with a known obstore equivalent, passthrough the remaining keys forwarded verbatim (they may already be obstore-native names). The caller drops the passthrough set with a warning when obstore rejects it.
- ngff_zarr._remote_reader._REGION_TIMEOUT¶
10.0
- ngff_zarr._remote_reader._resolve_bucket_region(bucket: str) str | None¶
The region AWS reports for bucket, or
Noneif it does not say.obstore sends the request to
us-east-1when no region is configured, and S3 answers for a bucket held elsewhere with a 301 that carries noLocation, so the read fails instead of being redirected. AWS names the region in a header on the bucket itself, and answers unsigned.
- ngff_zarr._remote_reader._fill_bucket_region(url: str, translated: dict, passthrough: dict) None¶
Add the bucket’s region to translated when nothing else supplies one.
- ngff_zarr._remote_reader._build_obstore(url: str, storage_options: dict | None)¶
Construct the obstore store for url, translating storage_options.
- class ngff_zarr._remote_reader.RemoteZarrStore(url: str, storage_options: dict | None = None, prefix: str = '')¶
Handle for a remote OME-Zarr store read via zarrista’s async API.
Wraps the obstore store for url plus an optional node prefix (HCS well/field views).
str()is the full URL so shared error messages keep pointing at what the user passed in.Initialization
- with_prefix(prefix: str) ngff_zarr._remote_reader.RemoteZarrStore¶
A view of the same store narrowed to prefix (joined to any existing prefix). The underlying obstore client is shared.
- ngff_zarr._remote_reader._async_adapter(arr)¶
dask adapter over an
AsyncArray, fetching through the IO loop.
- ngff_zarr._remote_reader._remote_array_to_dask(arr) dask.array.Array¶
Wrap
AsyncArrayarr as a lazy dask array on its chunk grid.Mirrors the sync
zarrista_array_to_dask: sharded arrays chunk on the subchunk (inner chunk) shape so reads stay at the efficient granularity.
- class ngff_zarr._remote_reader.RemoteZarrArray(
- store: ngff_zarr._remote_reader.RemoteZarrStore,
- component: str,
- arr,
Read-only handle for an array node within a remote store.
The read half of :class:
~ngff_zarr._zarrista_utils.LocalZarrArray: the node’sshape,dtype,chunksandattrs, numpy style[]reads, and :meth:to_daskfor lazy pixel access. Writes are refused, a remote store being read-only here.Initialization
- _array()¶
The synchronous adapter over the async node, made once.
- property dtype: numpy.dtype¶
- __getitem__(selection) numpy.ndarray¶
- to_dask() dask.array.Array¶
- class ngff_zarr._remote_reader.RemoteZarrGroup(
- store: ngff_zarr._remote_reader.RemoteZarrStore,
- component: str,
- group,
Read-only handle for a group node within a remote store.
Provides the slice of the group surface the read path uses –
attrs(a dict withasdict()),__contains__/__getitem__path navigation, andkeys()– backed by zarristaAsyncGroupmetadata reads. Child arrays open their pixel data lazily.Initialization
- __getitem__(name)¶
- ngff_zarr._remote_reader._fetch_v2_group_attrs(
- store: ngff_zarr._remote_reader.RemoteZarrStore,
- component: str | None,
The
.zattrsof the zarr format 2 group at component, if one exists.Used when auto-detection opened a format 3 group with empty attributes: like the local read path, a spurious
zarr.jsonsitting on top of a format 2 store must not hide the real.zgroup/.zattrsdocuments. ReturnsNonewhen there is no format 2 group here.
- ngff_zarr._remote_reader.open_remote_node(
- store: ngff_zarr._remote_reader.RemoteZarrStore,
- component: str | None = None,
Open the node at component within remote store.
Returns a :class:
RemoteZarrGroupor :class:RemoteZarrArray, orNonewhen neither node type exists there (missing metadata). zarrista auto-detects the zarr format, preferring format 3; transport and store errors propagate unchanged.
- ngff_zarr._remote_reader.open_remote_lazy(
- store: ngff_zarr._remote_reader.RemoteZarrStore,
- component: str | None = None,
Open the array at component within store as a lazy dask array.