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/1304#issuecomment-347906958,https://api.github.com/repos/pydata/xarray/issues/1304,347906958,MDEyOklzc3VlQ29tbWVudDM0NzkwNjk1OA==,1217238,2017-11-29T16:02:03Z,2017-11-29T16:02:03Z,MEMBER,This was fixed by https://github.com/pydata/xarray/pull/1508,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,213082731
https://github.com/pydata/xarray/issues/1304#issuecomment-285745464,https://api.github.com/repos/pydata/xarray/issues/1304,285745464,MDEyOklzc3VlQ29tbWVudDI4NTc0NTQ2NA==,1217238,2017-03-10T18:22:26Z,2017-03-10T18:22:26Z,MEMBER,"Yes, `from_ncdataset` would be better.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,213082731
https://github.com/pydata/xarray/issues/1304#issuecomment-285730870,https://api.github.com/repos/pydata/xarray/issues/1304,285730870,MDEyOklzc3VlQ29tbWVudDI4NTczMDg3MA==,1217238,2017-03-10T17:25:36Z,2017-03-10T17:26:12Z,MEMBER,"This does seem like a reasonable thing to do in the advanced API. I would suggest adding another constructor in the form of a `classmethod`, maybe `NetCDF4DataStore.from_dataset`?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,213082731
https://github.com/pydata/xarray/issues/1304#issuecomment-285398877,https://api.github.com/repos/pydata/xarray/issues/1304,285398877,MDEyOklzc3VlQ29tbWVudDI4NTM5ODg3Nw==,10050469,2017-03-09T16:16:58Z,2017-03-09T16:16:58Z,MEMBER,"I also needed something like this but @shoyer decided [against this change](https://github.com/pydata/xarray/pull/1060#issuecomment-256109866) until there is a cleaner datastore API.
A (very) dirty workaround it to subclass ``xarray.backends.NetCDF4DataStore`` and redefine ``__init__`` to accept netcdf datasets as argument:
```
class _NetCDF4DataStore(NetCDF4DataStore):
""""""Just another way to init xarray's datastore.""""""
def __init__(self, filename, mode='r', format='NETCDF4', group=None,
writer=None, clobber=True, diskless=False, persist=False,
ds=None):
import netCDF4 as nc4
if format is None:
format = 'NETCDF4'
if ds is None:
ds = nc4.Dataset(filename, mode=mode, clobber=clobber,
diskless=diskless, persist=persist,
format=format)
with close_on_error(ds):
self.ds = _nc4_group(ds, group, mode)
self.format = format
self.is_remote = False
self._filename = filename
super(NetCDF4DataStore, self).__init__(writer)
nc = netCDF4.Dataset(filename)
ds = xr.open_dataset(_NetCDF4DataStore(filename, ds=nc))
```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,213082731