issues: 33112594
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
33112594 | MDU6SXNzdWUzMzExMjU5NA== | 118 | Problems parsing time variable using open_dataset | 2443309 | closed | 0 | 4 | 2014-05-08T18:57:31Z | 2014-05-16T00:37:28Z | 2014-05-16T00:37:28Z | MEMBER | I'm noticing a problem parsing the time variable for at least the ``` bash ncdump -c -t sample_for_xray.nc netcdf sample_for_xray { dimensions: time = UNLIMITED ; // (4 currently) y = 205 ; x = 275 ; variables: double Wind(time, y, x) ; Wind:units = "m/s" ; Wind:long_name = "Wind speed" ; Wind:coordinates = "latitude longitude" ; Wind:dimensions = "2" ; Wind:type_preferred = "double" ; Wind:time_rep = "instantaneous" ; Wind:_FillValue = 9.96920996838687e+36 ; double time(time) ; time:calendar = "noleap" ; time:dimensions = "1" ; time:long_name = "time" ; time:type_preferred = "int" ; time:units = "days since 0001-01-01 0:0:0" ; // global attributes: ... data: time = "1979-09-16 12", "1979-10-17", "1979-11-16 12", "1979-12-17" ; ```
```TypeError Traceback (most recent call last) <ipython-input-46-65c280e7a283> in <module>() 1 ds = xray.open_dataset('sample_for_xray.nc') ----> 2 print ds['time'] /home/jhamman/anaconda/lib/python2.7/site-packages/xray/common.pyc in repr(self) 40 41 def repr(self): ---> 42 return array_repr(self) 43 44 def _iter(self): /home/jhamman/anaconda/lib/python2.7/site-packages/xray/common.pyc in array_repr(arr) 122 summary = ['<xray.%s %s(%s)>'% (type(arr).name, name_str, dim_summary)] 123 if arr.size < 1e5 or arr._in_memory(): --> 124 summary.append(repr(arr.values)) 125 else: 126 summary.append('[%s values with dtype=%s]' % (arr.size, arr.dtype)) /home/jhamman/anaconda/lib/python2.7/site-packages/xray/data_array.pyc in values(self) 147 def values(self): 148 """The variables's data as a numpy.ndarray""" --> 149 return self.variable.values 150 151 @values.setter /home/jhamman/anaconda/lib/python2.7/site-packages/xray/variable.pyc in values(self) 217 def values(self): 218 """The variable's data as a numpy.ndarray""" --> 219 return utils.as_array_or_item(self._data_cached()) 220 221 @values.setter /home/jhamman/anaconda/lib/python2.7/site-packages/xray/utils.pyc in as_array_or_item(values, dtype) 56 # converted into an integer instead :( 57 return values ---> 58 values = as_safe_array(values, dtype=dtype) 59 if values.ndim == 0 and values.dtype.kind == 'O': 60 # unpack 0d object arrays to be consistent with numpy /home/jhamman/anaconda/lib/python2.7/site-packages/xray/utils.pyc in as_safe_array(values, dtype) 40 """Like np.asarray, but convert all datetime64 arrays to ns precision 41 """ ---> 42 values = np.asarray(values, dtype=dtype) 43 if values.dtype.kind == 'M': 44 # np.datetime64 /home/jhamman/anaconda/lib/python2.7/site-packages/numpy/core/numeric.pyc in asarray(a, dtype, order) 458 459 """ --> 460 return array(a, dtype, copy=False, order=order) 461 462 def asanyarray(a, dtype=None, order=None): /home/jhamman/anaconda/lib/python2.7/site-packages/xray/variable.pyc in array(self, dtype) 121 if dtype is None: 122 dtype = self.dtype --> 123 return self.array.values.astype(dtype) 124 125 def getitem(self, key): TypeError: Cannot cast datetime.date object from metadata [D] to [ns] according to the rule 'same_kind' ``` This file is available here: ftp://ftp.hydro.washington.edu/pub/jhamman/sample_for_xray.nc |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/118/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |