Skip to content

Commit c0358a9

Browse files
authored
Merge pull request #650 from martindurant/small_storage_fixes
Fixes #649
2 parents 5d77292 + 07c11d9 commit c0358a9

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

zarr/convenience.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ def open(store=None, mode='a', **kwargs):
7373
path = kwargs.get('path', None)
7474
# handle polymorphic store arg
7575
clobber = mode == 'w'
76-
store = normalize_store_arg(store, clobber=clobber)
76+
# we pass storage options explicitly, since normalize_store_arg might construct
77+
# a store if the input is a fsspec-compatible URL
78+
store = normalize_store_arg(store, clobber=clobber,
79+
storage_options=kwargs.pop("storage_options", {}))
7780
path = normalize_storage_path(path)
7881

7982
if mode in {'w', 'w-', 'x'}:

zarr/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1688,7 +1688,7 @@ def _chunk_getitems(self, lchunk_coords, lchunk_selection, out, lout_selection,
16881688
out_is_ndarray = False
16891689

16901690
ckeys = [self._chunk_key(ch) for ch in lchunk_coords]
1691-
cdatas = self.chunk_store.getitems(ckeys)
1691+
cdatas = self.chunk_store.getitems(ckeys, on_error="omit")
16921692
for ckey, chunk_select, out_select in zip(ckeys, lchunk_selection, lout_selection):
16931693
if ckey in cdatas:
16941694
self._process_chunk(out, cdatas[ckey], chunk_select, drop_axes,

zarr/storage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ def _normalize_key(self, key):
10381038
key = '/'.join(bits + [end.replace('.', self.key_separator)])
10391039
return key.lower() if self.normalize_keys else key
10401040

1041-
def getitems(self, keys):
1041+
def getitems(self, keys, **kwargs):
10421042
keys = [self._normalize_key(key) for key in keys]
10431043
return self.map.getitems(keys, on_error="omit")
10441044

zarr/tests/test_storage.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,11 @@ def test_s3(self):
955955

956956
assert g.data[:].tolist() == [0, 1, 2, 3, 0, 0, 0, 0]
957957

958+
# test via convenience
959+
g = zarr.open("s3://test/out.zarr", mode='r',
960+
storage_options=self.s3so)
961+
assert g.data[:].tolist() == [0, 1, 2, 3, 0, 0, 0, 0]
962+
958963
@pytest.mark.usefixtures("s3")
959964
def test_s3_complex(self):
960965
import zarr

0 commit comments

Comments
 (0)