home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

2 rows where issue = 219321876 and user = 358378 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

user 1

  • andreas-h · 2 ✖

issue 1

  • Saving to netCDF with 0D dimension doesn't work · 2 ✖

author_association 1

  • CONTRIBUTOR 2
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
292929325 https://github.com/pydata/xarray/issues/1352#issuecomment-292929325 https://api.github.com/repos/pydata/xarray/issues/1352 MDEyOklzc3VlQ29tbWVudDI5MjkyOTMyNQ== andreas-h 358378 2017-04-10T12:02:09Z 2017-04-10T12:02:09Z CONTRIBUTOR

Thanks, @darothen ! However, I believe I shouldn't have to, but xarray should do the right thing automatically.

Maybe I want to use the dataset after saving for something else, which would mean I'd have to do something like d_.drop(['category', 'species']).to_netcdf(...), which I don't like too much ...

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Saving to netCDF with 0D dimension doesn't work 219321876
292873315 https://github.com/pydata/xarray/issues/1352#issuecomment-292873315 https://api.github.com/repos/pydata/xarray/issues/1352 MDEyOklzc3VlQ29tbWVudDI5Mjg3MzMxNQ== andreas-h 358378 2017-04-10T07:42:02Z 2017-04-10T07:42:02Z CONTRIBUTOR

Sure :smile:

I first open a DataArray:

grid_eu_coarse_noborder = xr.open_dataarray('tno-macc3_eu-no-nld-no-border_area.nc')
grid_eu_coarse_noborder

<xarray.DataArray 'TNO-MACC3_EU' (species: 12, category: 15, lon: 720, lat: 672)>
[87091200 values with dtype=float64]
Coordinates:
  * lat       (lat) float64 30.03 30.09 30.16 30.22 30.28 30.34 30.41 30.47 ...
  * category  (category) object 'pow' 'res' 'inc' 'pei' 'exf' 'sol' 'tra1' ...
  * species   (species) object 'CH4' 'CO' 'NH3' 'NMVOC' 'NOX' 'BC_1' ...
  * lon       (lon) float64 -29.94 -29.81 -29.69 -29.56 -29.44 -29.31 -29.19 ...

from which I select using .loc[] and convert to Dataset:

grid_eu_coarse_noborder.loc['NOX', 'pow'].to_dataset()

<xarray.Dataset>
Dimensions:       (lat: 672, lon: 720)
Coordinates:
  * lat           (lat) float64 30.03 30.09 30.16 30.22 30.28 30.34 30.41 ...
    category      <U3 'pow'
    species       <U3 'NOX'
  * lon           (lon) float64 -29.94 -29.81 -29.69 -29.56 -29.44 -29.31 ...
Data variables:
    TNO-MACC3_EU  (lon, lat) float64 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ...

which then cannot be saved:

grid_eu_coarse_noborder.loc['NOX', 'pow'].to_dataset().to_netcdf('test.nc')


---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
/home/eb/software/LAMOSpy/0.2-intel-2016a-Python-3.5.1/lib/python3.5/site-packages/xarray-0.9.1-py3.5.egg/xarray/core/utils.py in __len__(self)
    395         try:
--> 396             return self.shape[0]
    397         except IndexError:

IndexError: tuple index out of range

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
<ipython-input-8-fb260f3bec4b> in <module>()
----> 1 grid_eu_coarse_noborder.loc['NOX', 'pow'].to_dataset().to_netcdf('test.nc')

/home/eb/software/LAMOSpy/0.2-intel-2016a-Python-3.5.1/lib/python3.5/site-packages/xarray-0.9.1-py3.5.egg/xarray/core/dataset.py in to_netcdf(self, path, mode, format, group, engine, encoding, unlimited_dims)
    951         return to_netcdf(self, path, mode, format=format, group=group,
    952                          engine=engine, encoding=encoding,
--> 953                          unlimited_dims=unlimited_dims)
    954 
    955     def __unicode__(self):

/home/eb/software/LAMOSpy/0.2-intel-2016a-Python-3.5.1/lib/python3.5/site-packages/xarray-0.9.1-py3.5.egg/xarray/backends/api.py in to_netcdf(dataset, path, mode, format, group, engine, writer, encoding, unlimited_dims)
    567     try:
    568         dataset.dump_to_store(store, sync=sync, encoding=encoding,
--> 569                               unlimited_dims=unlimited_dims)
    570         if isinstance(path, BytesIO):
    571             return path.getvalue()

/home/eb/software/LAMOSpy/0.2-intel-2016a-Python-3.5.1/lib/python3.5/site-packages/xarray-0.9.1-py3.5.egg/xarray/core/dataset.py in dump_to_store(self, store, encoder, sync, encoding, unlimited_dims)
    891 
    892         store.store(variables, attrs, check_encoding,
--> 893                     unlimited_dims=unlimited_dims)
    894         if sync:
    895             store.sync()

/home/eb/software/LAMOSpy/0.2-intel-2016a-Python-3.5.1/lib/python3.5/site-packages/xarray-0.9.1-py3.5.egg/xarray/backends/common.py in store(self, variables, attributes, *args, **kwargs)
    233         cf_variables, cf_attrs = cf_encoder(variables, attributes)
    234         AbstractWritableDataStore.store(self, cf_variables, cf_attrs,
--> 235                                         *args, **kwargs)
    236 
    237

/home/eb/software/LAMOSpy/0.2-intel-2016a-Python-3.5.1/lib/python3.5/site-packages/xarray-0.9.1-py3.5.egg/xarray/backends/common.py in store(self, variables, attributes, check_encoding_set, unlimited_dims)
    202         self.set_attributes(attributes)
    203         self.set_variables(variables, check_encoding_set,
--> 204                            unlimited_dims=unlimited_dims)
    205 
    206     def set_attributes(self, attributes):

/home/eb/software/LAMOSpy/0.2-intel-2016a-Python-3.5.1/lib/python3.5/site-packages/xarray-0.9.1-py3.5.egg/xarray/backends/common.py in set_variables(self, variables, check_encoding_set, unlimited_dims)
    214             check = vn in check_encoding_set
    215             target, source = self.prepare_variable(
--> 216                 name, v, check, unlimited_dims=unlimited_dims)
    217             self.writer.add(source, target)
    218

/home/eb/software/LAMOSpy/0.2-intel-2016a-Python-3.5.1/lib/python3.5/site-packages/xarray-0.9.1-py3.5.egg/xarray/backends/netCDF4_.py in prepare_variable(self, name, variable, check_encoding, unlimited_dims)
    272 
    273         if self.format == 'NETCDF4':
--> 274             variable, datatype = _nc4_values_and_dtype(variable)
    275         else:
    276             variable = encode_nc3_variable(variable)

/home/eb/software/LAMOSpy/0.2-intel-2016a-Python-3.5.1/lib/python3.5/site-packages/xarray-0.9.1-py3.5.egg/xarray/backends/netCDF4_.py in _nc4_values_and_dtype(var)
     78     if var.dtype.kind == 'U':
     79         # this entire clause should not be necessary with netCDF4>=1.0.9
---> 80         if len(var) > 0:
     81             var = var.astype('O')
     82         dtype = str

/home/eb/software/LAMOSpy/0.2-intel-2016a-Python-3.5.1/lib/python3.5/site-packages/xarray-0.9.1-py3.5.egg/xarray/core/utils.py in __len__(self)
    396             return self.shape[0]
    397         except IndexError:
--> 398             raise TypeError('len() of unsized object')
    399 
    400

TypeError: len() of unsized object
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Saving to netCDF with 0D dimension doesn't work 219321876

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 213.446ms · About: xarray-datasette