issues: 1498255931
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1498255931 | I_kwDOAMm_X85ZTZI7 | 7381 | Document cftime arithmetic limitations | 5659125 | open | 0 | 3 | 2022-12-15T11:24:04Z | 2023-07-17T09:34:12Z | NONE | What is your issue?Hey all, i have quick use case where i am unsure if that's related to xarray. I just want to do simple arithmetics with a cftime time axis, e.g.
UFuncTypeError Traceback (most recent call last) Input In [72], in <cell line: 1>() ----> 1 time[1:] + 0.5 * time.diff('time') File /work/ch0636/g300046/conda_envs/pyremo-dev/lib/python3.9/site-packages/xarray/core/_typed_ops.py:206, in DataArrayOpsMixin.add(self, other) 205 def add(self, other): --> 206 return self._binary_op(other, operator.add) File /work/ch0636/g300046/conda_envs/pyremo-dev/lib/python3.9/site-packages/xarray/core/dataarray.py:3530, in DataArray._binary_op(self, other, f, reflexive) 3526 other_variable = getattr(other, "variable", other) 3527 other_coords = getattr(other, "coords", None) 3529 variable = ( -> 3530 f(self.variable, other_variable) 3531 if not reflexive 3532 else f(other_variable, self.variable) 3533 ) 3534 coords, indexes = self.coords._merge_raw(other_coords, reflexive) 3535 name = self._result_name(other) File /work/ch0636/g300046/conda_envs/pyremo-dev/lib/python3.9/site-packages/xarray/core/_typed_ops.py:396, in VariableOpsMixin.add(self, other) 395 def add(self, other): --> 396 return self._binary_op(other, operator.add) File /work/ch0636/g300046/conda_envs/pyremo-dev/lib/python3.9/site-packages/xarray/core/variable.py:2519, in Variable._binary_op(self, other, f, reflexive) 2516 attrs = self._attrs if keep_attrs else None 2517 with np.errstate(all="ignore"): 2518 new_data = ( -> 2519 f(self_data, other_data) if not reflexive else f(other_data, self_data) 2520 ) 2521 result = Variable(dims, new_data, attrs=attrs) 2522 return result UFuncTypeError: ufunc 'add' cannot use operands with types dtype('O') and dtype('<m8[ns]')
i get the expected result. I am not sure what to expect from xarray and if this might be an issue of cftime (e.g., implement differentiation with |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/7381/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
13221727 | issue |