home / github

Menu
  • GraphQL API
  • Search all tables

issues

Table actions
  • GraphQL API for issues

1 row where repo = 13221727 and user = 30007270 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date), closed_at (date)

type 1

  • issue 1

state 1

  • closed 1

repo 1

  • xarray · 1 ✖
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
383844989 MDU6SXNzdWUzODM4NDQ5ODk= 2566 Unexpected warning when taking mean of all-NaN slice in chunked DataArray chuaxr 30007270 closed 0     2 2018-11-23T14:33:00Z 2020-10-24T04:17:32Z 2020-10-24T04:17:32Z NONE      

Problem description

When taking the mean of a DataArray with an all-NaN axis, I get the following warning: ``` data = np.array([[np.nan,0],[np.nan,1]]) xc = xr.DataArray(data).chunk() xc.mean('dim_0').compute()

/nbhome/xrc/anaconda2/envs/py361/lib/python3.6/site-packages/dask/array/numpy_compat.py:28: RuntimeWarning: invalid value encountered in true_divide x = np.divide(x1, x2, out)

<xarray.DataArray (dim_1: 2)> array([ nan, 0.5]) Dimensions without coordinates: dim_1 ``` This confused me because the warning suggests a 0/0 division and/or issues with typecasting. Furthermore, the warning is different when the data is not chunked:

```python

x = xr.DataArray(data) x.mean('dim_0')

/nbhome/xrc/anaconda2/envs/py361/lib/python3.6/site-packages/xarray/core/nanops.py:161: RuntimeWarning: Mean of empty slice return np.nanmean(a, axis=axis, dtype=dtype)

<xarray.DataArray (dim_1: 2)> array([ nan, 0.5]) Dimensions without coordinates: dim_1

Also, using pure dask does not raise this warning. xd = da.from_array(data,chunks=(1,1))

xd.mean(axis=0).compute()

array([ nan, 0.5]) ```

Expected Output

Either the warning from a non-chunked DataArray or no warning would be preferred.

Output of xr.show_versions()

commit: None python: 3.6.6.final.0 python-bits: 64 OS: Linux OS-release: 2.6.32-696.30.1.el6.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US LOCALE: en_US.ISO8859-1 xarray: 0.11.0 pandas: 0.23.4 numpy: 1.13.1 scipy: 0.19.1 netCDF4: 1.3.1 h5netcdf: 0.5.0 h5py: 2.7.1 Nio: None zarr: None cftime: 1.0.2.1 PseudonetCDF: None rasterio: None iris: None bottleneck: 1.2.0 cyordereddict: None dask: 0.20.1 distributed: 1.24.0 matplotlib: 3.0.1 cartopy: 0.16.0 seaborn: 0.8.1 setuptools: 35.0.2 pip: 18.1 conda: None pytest: 3.0.7 IPython: 6.5.0 sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2566/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issues] (
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [number] INTEGER,
   [title] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [state] TEXT,
   [locked] INTEGER,
   [assignee] INTEGER REFERENCES [users]([id]),
   [milestone] INTEGER REFERENCES [milestones]([id]),
   [comments] INTEGER,
   [created_at] TEXT,
   [updated_at] TEXT,
   [closed_at] TEXT,
   [author_association] TEXT,
   [active_lock_reason] TEXT,
   [draft] INTEGER,
   [pull_request] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [state_reason] TEXT,
   [repo] INTEGER REFERENCES [repos]([id]),
   [type] TEXT
);
CREATE INDEX [idx_issues_repo]
    ON [issues] ([repo]);
CREATE INDEX [idx_issues_milestone]
    ON [issues] ([milestone]);
CREATE INDEX [idx_issues_assignee]
    ON [issues] ([assignee]);
CREATE INDEX [idx_issues_user]
    ON [issues] ([user]);
Powered by Datasette · Queries took 30.051ms · About: xarray-datasette