home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 285398877

This data as json

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-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 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
Powered by Datasette · Queries took 160.458ms · About: xarray-datasette