home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 157564974

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/662#issuecomment-157564974 https://api.github.com/repos/pydata/xarray/issues/662 157564974 MDEyOklzc3VlQ29tbWVudDE1NzU2NDk3NA== 7799184 2015-11-18T01:09:00Z 2015-11-18T01:09:00Z CONTRIBUTOR

@maximilianr I have managed to reproduce this with a different file with different number of dimensions (time, latitude, longitude). So I believe the below example should give same problem if you run on some other file and change the variable / dimension names accordingly:

``` ncvar = 'hs' dset_sliced1 = xray.Dataset() dset_sliced2 = xray.Dataset() dset = xray.open_dataset(filename, decode_times=False) slice_dict1 = {u'latitude': [-30], u'longitude': [0], u'time': [2.83996800e+08, 2.84007600e+08]} dset_sliced1[ncvar] = dset[ncvar].sel(method='nearest', slice_dict1) slice_dict2 = {u'latitude': [-30], u'longitude': [0], u'time': [2.84018400e+08, 2.84029200e+08]} dset_sliced2[ncvar] = dset[ncvar].sel(method='nearest', slice_dict2)

dset_sliced1.to_netcdf('test.nc') # This fails xray.concat([dset_sliced1, dset_sliced2], dim='time') # This also fails, same error

Traceback: ----> 1 xray.concat([dset_sliced1, dset_sliced2], dim='time') # This also fails

/source/xray/xray/core/combine.pyc in concat(objs, dim, data_vars, coords, compat, positions, indexers, mode, concat_over) 113 raise TypeError('can only concatenate xray Dataset and DataArray ' 114 'objects') --> 115 return f(objs, dim, data_vars, coords, compat, positions) 116 117

/source/xray/xray/core/combine.pyc in _dataset_concat(datasets, dim, data_vars, coords, compat, positions) 265 for k in concat_over: 266 vars = ensure_common_dims([ds.variables[k] for ds in datasets]) --> 267 combined = Variable.concat(vars, dim, positions) 268 insert_result_variable(k, combined) 269

/source/xray/xray/core/variable.pyc in concat(cls, variables, dim, positions, shortcut) 711 utils.remove_incompatible_items(attrs, var.attrs) 712 --> 713 return cls(dims, data, attrs) 714 715 def _data_equals(self, other):

/source/xray/xray/core/variable.pyc in init(self, dims, data, attrs, encoding, fastpath) 194 """ 195 self._data = _as_compatible_data(data, fastpath=fastpath) --> 196 self._dims = self._parse_dimensions(dims) 197 self._attrs = None 198 self._encoding = None

/source/xray/xray/core/variable.pyc in _parse_dimensions(self, dims) 302 raise ValueError('dimensions %s must have the same length as the ' 303 'number of data dimensions, ndim=%s' --> 304 % (dims, self.ndim)) 305 return dims 306

ValueError: dimensions (u'time', u'latitude', u'longitude') must have the same length as the number of data dimensions, ndim=2 ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  117478779
Powered by Datasette · Queries took 0.52ms · About: xarray-datasette