home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 309098246

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
309098246 MDU6SXNzdWUzMDkwOTgyNDY= 2017 np.minimum.accumulate(da) doesn't work 7441788 open 0     7 2018-03-27T19:15:06Z 2021-07-04T03:20:18Z   CONTRIBUTOR      

Code Sample, a copy-pastable example if possible

``` In [1]: import numpy as np

In [2]: import xarray as xr

In [3]: np.minimum.accumulate(np.array([3,2,4,1])) Out[3]: array([3, 2, 2, 1], dtype=int32)

In [4]: np.minimum.accumulate(xr.DataArray([3,2,4,1]))

NotImplementedError Traceback (most recent call last) <ipython-input-7-7205433fb365> in <module>() ----> 1 np.minimum.accumulate(xr.DataArray([3,2,4,1])) ~\Anaconda3\lib\site-packages\xarray\core\arithmetic.py in array_ufunc(self, ufunc, method, inputs, *kwargs) 49 'alternative, consider explicitly converting xarray objects ' 50 'to NumPy arrays (e.g., with .values).' ---> 51 .format(method, ufunc)) 52 53 if any(isinstance(o, SupportsArithmetic) for o in out): NotImplementedError: accumulate method for ufunc <ufunc 'minimum'> is not implemented on xarray objects, which currently only support the call method. As an alternative, consider explicitly converting xarray objects to NumPy arrays (e.g., with .values). ```

Problem description

I would expect this to work, like xr.apply_ufunc(np.minimum.accumulate, xr.DataArray([3,2,4,1])):

Expected Output

Out[4]: <xarray.DataArray (dim_0: 4)> array([3, 2, 2, 1]) Dimensions without coordinates: dim_0

Output of xr.show_versions()

``` commit: None python: 3.6.4.final.0 python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 62 Stepping 4, GenuineIntel byteorder: little LC_ALL: None LANG: None LOCALE: None.None xarray: 0.10.2 pandas: 0.22.0 numpy: 1.14.2 scipy: 1.0.0 netCDF4: None h5netcdf: 0.5.0 h5py: 2.7.1 Nio: None zarr: None bottleneck: 1.2.1 cyordereddict: None dask: 0.17.1 distributed: 1.21.3 matplotlib: 2.2.2 cartopy: None seaborn: 0.8.1 setuptools: 39.0.1 pip: 9.0.2 conda: 4.3.34 pytest: 3.4.2 IPython: 6.2.1 sphinx: 1.7.1 ```

Originally posted posted to https://groups.google.com/forum/#!topic/xarray/LiwxrJcJBwY.

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

Links from other tables

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