@@ -16,6 +16,7 @@ class Metadata2:
16
16
17
17
@classmethod
18
18
def parse_metadata (cls , s : Union [MappingType , str ]) -> MappingType [str , Any ]:
19
+
19
20
# Here we allow that a store may return an already-parsed metadata object,
20
21
# or a string of JSON that we will parse here. We allow for an already-parsed
21
22
# 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]:
24
25
if isinstance (s , Mapping ):
25
26
# assume metadata has already been parsed into a mapping object
26
27
meta = s
28
+
27
29
else :
28
30
# assume metadata needs to be parsed as JSON
29
31
meta = json_loads (s )
32
+
30
33
return meta
31
34
32
35
@classmethod
@@ -40,13 +43,14 @@ def decode_array_metadata(cls, s: Union[MappingType, str]) -> MappingType[str, A
40
43
41
44
# extract array metadata fields
42
45
try :
43
- # dimension_separator = meta.get("dimension_separator", None)
44
46
dtype = cls .decode_dtype (meta ["dtype" ])
45
47
if dtype .hasobject :
46
48
import numcodecs
47
49
object_codec = numcodecs .get_codec (meta ['filters' ][0 ])
48
50
else :
49
51
object_codec = None
52
+
53
+ dimension_separator = meta .get ("dimension_separator" , None )
50
54
fill_value = cls .decode_fill_value (meta ['fill_value' ], dtype , object_codec )
51
55
meta = dict (
52
56
zarr_format = meta ["zarr_format" ],
@@ -57,8 +61,9 @@ def decode_array_metadata(cls, s: Union[MappingType, str]) -> MappingType[str, A
57
61
fill_value = fill_value ,
58
62
order = meta ["order" ],
59
63
filters = meta ["filters" ],
60
- dimension_separator = meta .get ("dimension_separator" , "." ),
61
64
)
65
+ if dimension_separator :
66
+ meta ['dimension_separator' ] = dimension_separator
62
67
except Exception as e :
63
68
raise MetadataError ("error decoding metadata" ) from e
64
69
else :
0 commit comments