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/432#issuecomment-234598308,https://api.github.com/repos/pydata/xarray/issues/432,234598308,MDEyOklzc3VlQ29tbWVudDIzNDU5ODMwOA==,4806877,2016-07-22T17:00:29Z,2016-07-22T17:16:16Z,CONTRIBUTOR,"Ok. That makes sense. I added a function to common and submitted a pull request: #917
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,88075523
https://github.com/pydata/xarray/issues/432#issuecomment-234540415,https://api.github.com/repos/pydata/xarray/issues/432,234540415,MDEyOklzc3VlQ29tbWVudDIzNDU0MDQxNQ==,4806877,2016-07-22T13:14:43Z,2016-07-22T13:14:43Z,CONTRIBUTOR,"I agree.
.3. Couldn't this make the `dict` blow up for large datasets? Maybe there could be a flag that lets the user decide whether to leave the data in its current form (could use `self.data` in case it is a dask array)
6. The trouble with `xarray.DataArray` is that it doesn't require a name but it can have one. Is that something that we would want to preserve? If not, then maybe it would look more like this.
```
tolist=True
d = {'coords': {}, 'attrs': dict(self.attrs), 'dims': self.dims}
def func(x, tolist):
if tolist:
return x.tolist()
return x
for k in self.coords:
d['coords'].update({k: {'data': func(self[k].data, tolist),
'dims': list(self[k].dims),
'attrs': dict(self[k].attrs)}})
if hasattr(self, 'data_vars'):
d.update({'data_vars': {}})
for k in self.data_vars:
d['data_vars'].update({k: {'data': func(self[k].data, tolist),
'dims': list(self[k].dims),
'attrs': dict(self[k].attrs)}})
else:
d.update({'data': func(self.data, tolist)})
```
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,88075523
https://github.com/pydata/xarray/issues/432#issuecomment-234082452,https://api.github.com/repos/pydata/xarray/issues/432,234082452,MDEyOklzc3VlQ29tbWVudDIzNDA4MjQ1Mg==,4806877,2016-07-20T21:03:33Z,2016-07-20T21:03:33Z,CONTRIBUTOR,"Is this still of interest? I was thinking it would look something like this:
```
d = {'coordinates': {}, 'variables': {}, 'attributes': {}}
d['attributes'].update(dict(self.attrs))
for k in self.coords:
d['coordinates'].update({k: {'data': self[k].data,
'dimensions': list(self[k].dims),
'attributes': dict(self[k].attrs)}})
if hasattr(self, 'data_vars'):
for k in self.data_vars:
d['variables'].update({k: {'data': self[k].data,
'dimensions': list(self[k].dims),
'attributes': dict(self[k].attrs)}})
else:
d['variables'].update({'data': self.data,
'dimensions': list(self.dims),
'attributes': dict(self.attrs)})
```
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,88075523