Skip to content

Commit 15d4d78

Browse files
committed
sync metadata methods with current master branch
1 parent ca4db80 commit 15d4d78

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

zarr/meta.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class Metadata2:
1616

1717
@classmethod
1818
def parse_metadata(cls, s: Union[MappingType, str]) -> MappingType[str, Any]:
19+
1920
# Here we allow that a store may return an already-parsed metadata object,
2021
# or a string of JSON that we will parse here. We allow for an already-parsed
2122
# object to accommodate a consolidated metadata store, where all the metadata for
@@ -24,9 +25,11 @@ def parse_metadata(cls, s: Union[MappingType, str]) -> MappingType[str, Any]:
2425
if isinstance(s, Mapping):
2526
# assume metadata has already been parsed into a mapping object
2627
meta = s
28+
2729
else:
2830
# assume metadata needs to be parsed as JSON
2931
meta = json_loads(s)
32+
3033
return meta
3134

3235
@classmethod
@@ -40,13 +43,14 @@ def decode_array_metadata(cls, s: Union[MappingType, str]) -> MappingType[str, A
4043

4144
# extract array metadata fields
4245
try:
43-
# dimension_separator = meta.get("dimension_separator", None)
4446
dtype = cls.decode_dtype(meta["dtype"])
4547
if dtype.hasobject:
4648
import numcodecs
4749
object_codec = numcodecs.get_codec(meta['filters'][0])
4850
else:
4951
object_codec = None
52+
53+
dimension_separator = meta.get("dimension_separator", None)
5054
fill_value = cls.decode_fill_value(meta['fill_value'], dtype, object_codec)
5155
meta = dict(
5256
zarr_format=meta["zarr_format"],
@@ -57,8 +61,9 @@ def decode_array_metadata(cls, s: Union[MappingType, str]) -> MappingType[str, A
5761
fill_value=fill_value,
5862
order=meta["order"],
5963
filters=meta["filters"],
60-
dimension_separator=meta.get("dimension_separator", "."),
6164
)
65+
if dimension_separator:
66+
meta['dimension_separator'] = dimension_separator
6267
except Exception as e:
6368
raise MetadataError("error decoding metadata") from e
6469
else:

0 commit comments

Comments
 (0)