html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue
https://github.com/pydata/xarray/issues/2586#issuecomment-455374760,https://api.github.com/repos/pydata/xarray/issues/2586,455374760,MDEyOklzc3VlQ29tbWVudDQ1NTM3NDc2MA==,703554,2019-01-17T23:49:07Z,2019-01-17T23:49:07Z,CONTRIBUTOR,"> IMO, zarr needs some kind of ""resolver"" mechanism that takes a string and decides what kind of store it represents. For example, if the path ends with `.zip`, then it should know it's zip store, if it starts with `gs://`, it should know it's a google cloud store, etc.
Some very limited support for this is there already, e.g., if string ends with '.zip' then a zip store will be used, but there's no support for dispatching to cloud stores via a URL-like protocol. There's an open issue for that: https://github.com/zarr-developers/zarr/issues/214","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,386515973
https://github.com/pydata/xarray/issues/2586#issuecomment-455109538,https://api.github.com/repos/pydata/xarray/issues/2586,455109538,MDEyOklzc3VlQ29tbWVudDQ1NTEwOTUzOA==,1197350,2019-01-17T09:50:14Z,2019-01-17T09:50:14Z,MEMBER,"IMO, zarr needs some kind of ""resolver"" mechanism that takes a string and decides what kind of store it represents. For example, if the path ends with `.zip`, then it should know it's zip store, if it starts with `gs://`, it should know it's a google cloud store, etc.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,386515973
https://github.com/pydata/xarray/issues/2586#issuecomment-455017640,https://api.github.com/repos/pydata/xarray/issues/2586,455017640,MDEyOklzc3VlQ29tbWVudDQ1NTAxNzY0MA==,5191106,2019-01-17T02:20:28Z,2019-01-17T02:20:28Z,NONE,"Hmm, I can't reproduce my issue anymore, it now works by default. I have no idea what fixed it. I suppose that means this issue can be closed :)
@jakirkham, your suggestion does not work: ds.to_zarr only seems to accept zarr datastores or a path (in that case the data is stored in a zarr.DirectoryStore)
(when I try it, I get the following error:)
```-------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in
----> 1 ds.to_zarr(zarr.group(zarr.ZipStore(""test.zarr"")))
~/.local/lib/python3.7/site-packages/xarray/core/dataset.py in to_zarr(self, store, mode, synchronizer, group, encoding, compute)
1257 from ..backends.api import to_zarr
1258 return to_zarr(self, store=store, mode=mode, synchronizer=synchronizer,
-> 1259 group=group, encoding=encoding, compute=compute)
1260
1261 def __unicode__(self):
~/.local/lib/python3.7/site-packages/xarray/backends/api.py in to_zarr(dataset, store, mode, synchronizer, group, encoding, compute)
879 store = backends.ZarrStore.open_group(store=store, mode=mode,
880 synchronizer=synchronizer,
--> 881 group=group)
882
883 writer = ArrayWriter()
~/.local/lib/python3.7/site-packages/xarray/backends/zarr.py in open_group(cls, store, mode, synchronizer, group)
236 ""#installation"" % min_zarr)
237 zarr_group = zarr.open_group(store=store, mode=mode,
--> 238 synchronizer=synchronizer, path=group)
239 return cls(zarr_group)
240
~/.local/lib/python3.7/site-packages/zarr/hierarchy.py in open_group(store, mode, cache_attrs, synchronizer, path)
1134
1135 return Group(store, read_only=read_only, cache_attrs=cache_attrs,
-> 1136 synchronizer=synchronizer, path=path)
~/.local/lib/python3.7/site-packages/zarr/hierarchy.py in __init__(self, store, path, read_only, chunk_store, cache_attrs, synchronizer)
114 err_group_not_found(path)
115 else:
--> 116 meta = decode_group_metadata(meta_bytes)
117 self._meta = meta
118
~/.local/lib/python3.7/site-packages/zarr/meta.py in decode_group_metadata(s)
98 def decode_group_metadata(s):
99 s = _ensure_str(s)
--> 100 meta = json.loads(s)
101 zarr_format = meta.get('zarr_format', None)
102 if zarr_format != ZARR_FORMAT:
/usr/lib/python3.7/json/__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
339 else:
340 if not isinstance(s, (bytes, bytearray)):
--> 341 raise TypeError(f'the JSON object must be str, bytes or bytearray, '
342 f'not {s.__class__.__name__}')
343 s = s.decode(detect_encoding(s), 'surrogatepass')
TypeError: the JSON object must be str, bytes or bytearray, not Array```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,386515973
https://github.com/pydata/xarray/issues/2586#issuecomment-453807790,https://api.github.com/repos/pydata/xarray/issues/2586,453807790,MDEyOklzc3VlQ29tbWVudDQ1MzgwNzc5MA==,3019665,2019-01-13T07:11:23Z,2019-01-13T07:11:23Z,NONE,"I'm not really familiar with XArray's internals, but issue ( https://github.com/pydata/xarray/issues/2660 ) looks relevant.
What happens if you do?
```python
ds.to_zarr(zarr.group(zarr.ZipStore(""test.zarr"")))
print(xr.open_zarr(zarr.group(zarr.ZipStore(""test.zarr""))))
```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,386515973
https://github.com/pydata/xarray/issues/2586#issuecomment-453800341,https://api.github.com/repos/pydata/xarray/issues/2586,453800341,MDEyOklzc3VlQ29tbWVudDQ1MzgwMDM0MQ==,2443309,2019-01-13T04:04:05Z,2019-01-13T04:04:05Z,MEMBER,"@eeopd - thanks for opening this issue. This seems like a reasonable request though I'm wondering if this is actually more a zarr problem than an xarray one. I say that because xarray's zarr backend doesn't modify the group kwarg at all, it just passes it though to `zarr.open_group(..., path=group)`. I wonder if you would get the same error with a pure zarr workflow.
cc @rabernat, @jakirkham, @alimanfoo ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,386515973