home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 157886730

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
157886730 MDU6SXNzdWUxNTc4ODY3MzA= 864 TypeError: invalid type promotion when reading multi-file dataset 743508 closed 0     3 2016-06-01T11:44:49Z 2019-01-27T21:54:49Z 2019-01-27T21:54:49Z CONTRIBUTOR      

I'm trying to select data from a collection of weather files. Xarray opens the multifile dataset perfectly, but when I try the following selection:

``` python

cfsr_new = xr.open_mfdataset('*.grb2.nc')

lon_sel = np.array(cfsr_new.lon[np.array([3, 4, 8])]) lat_sel = np.array(cfsr_new.lat[np.array([2, 3, 4])]) time_sel = cfsr_new.time[100:200]

selection = cfsr_new.sel(lon=lon_sel, lat=lat_sel, time=time_sel) selection.to_array()

```

I get:

```

TypeError Traceback (most recent call last) <ipython-input-38-3f04c6458da2> in <module>() ----> 1 selection.to_array()

/Users/<user>/anaconda/lib/python3.5/site-packages/xarray/core/dataset.py in to_array(self, dim, name) 1847 data_vars = [self.variables[k] for k in self.data_vars] 1848 broadcast_vars = broadcast_variables(*data_vars) -> 1849 data = ops.stack([b.data for b in broadcast_vars], axis=0) 1850 1851 coords = dict(self.coords)

/Users/<user>//anaconda/lib/python3.5/site-packages/xarray/core/ops.py in f(args, kwargs) 65 else: 66 module = eager_module ---> 67 return getattr(module, name)(args, kwargs) 68 else: 69 def f(data, *args, kwargs):

/Users/<user>//anaconda/lib/python3.5/site-packages/dask/array/core.py in stack(seq, axis) 1754 1755 if all(a._dtype is not None for a in seq): -> 1756 dt = reduce(np.promote_types, [a._dtype for a in seq]) 1757 else: 1758 dt = None

/Users/<user>//anaconda/lib/python3.5/site-packages/toolz/functoolz.py in call(self, args, kwargs) 217 def call(self, args, kwargs): 218 try: --> 219 return self._partial(*args, kwargs) 220 except TypeError: 221 # If there was a genuine TypeError

TypeError: invalid type promotion

```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/864/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 1 row from issues_id in issues_labels
  • 3 rows from issue in issue_comments
Powered by Datasette · Queries took 152.88ms · About: xarray-datasette