home / github

Menu
  • GraphQL API
  • Search all tables

issues

Table actions
  • GraphQL API for issues

2 rows where comments = 3, repo = 13221727 and user = 5802846 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 2

  • issue 1
  • pull 1

state 2

  • closed 1
  • open 1

repo 1

  • xarray · 2 ✖
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
535686852 MDExOlB1bGxSZXF1ZXN0MzUxMzU0OTI4 3607 Strided rolling niowniow 5802846 open 0     3 2019-12-10T12:05:54Z 2023-03-09T20:37:56Z   CONTRIBUTOR   0 pydata/xarray/pulls/3607

This PR adds a stride parameter to the rolling function of DataArray and Dataset . It basically extends the stride functionality being available for core.rolling.DataArrayRolling.construct and core.rolling.DatasetRolling.construct to the other methods of DataArrayRolling and DatasetRolling.

Note: it makes the arguments of DataArrayRolling and DatasetRolling inconsistent with the respective rolling arguments of pandas Series and DataFrame (They do not support stride). Moreover, it does not solve the issue addressed in this pandas issue (Efficient stride computation).

  • [x] Tests added
  • [x] Passes black . && mypy . && flake8
  • [x] Fully documented, including whats-new.rst for all changes and api.rst for new API
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3607/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
976207971 MDU6SXNzdWU5NzYyMDc5NzE= 5727 Setting item with loc and boolean mask fails niowniow 5802846 closed 0     3 2021-08-21T19:41:56Z 2022-03-17T17:11:43Z 2022-03-17T17:11:43Z CONTRIBUTOR      

What happened: When setting a DataArray with loc, xarray converts bool masks to the coord data type. Therefore loc does not use a boolean mask but tries to match the indexes of the coord.

Minimal Complete Verifiable Example:

```python import numpy as np import xarray as xr

x = np.arange(10).astype(np.float64) fx = np.arange(10).astype(np.float64) da = xr.DataArray(fx,dims=['x'],coords={'x':x}) mask = np.zeros((10,)) mask[1::2] = 1 mask = mask.astype(bool) da.loc[{'x':~mask}] = np.arange(5)+10 ```

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/matthmey/miniconda3/envs/analytics/lib/python3.7/site-packages/xarray/core/dataarray.py", line 214, in __setitem__ self.data_array[pos_indexers] = value File "/home/matthmey/miniconda3/envs/analytics/lib/python3.7/site-packages/xarray/core/dataarray.py", line 767, in __setitem__ self.variable[key] = value File "/home/matthmey/miniconda3/envs/analytics/lib/python3.7/site-packages/xarray/core/variable.py", line 854, in __setitem__ indexable[index_tuple] = value File "/home/matthmey/miniconda3/envs/analytics/lib/python3.7/site-packages/xarray/core/indexing.py", line 1164, in __setitem__ array[key] = value ValueError: shape mismatch: value array of shape (5,) could not be broadcast to indexing result of shape (10,)

Anything else we need to know?: <del>Could be fixed by replacing the line, but maybe this is not the cleanest solution.</del> I tried fixing it with the following, which works for the above code but fails for other cases. if label.dtype != np.bool: label = maybe_cast_to_coords_dtype(label, coord.dtype)

Environment:

Output of <tt>xr.show_versions()</tt> INSTALLED VERSIONS ------------------ commit: None python: 3.7.0 (default, Oct 9 2018, 10:31:47) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 5.4.0-80-lowlatency machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: ('en_US', 'UTF-8') libhdf5: None libnetcdf: None xarray: 0.19.0 pandas: 1.0.1 numpy: 1.18.1 scipy: 1.4.1 netCDF4: None pydap: None h5netcdf: None h5py: None Nio: None zarr: 2.5.0 cftime: None nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2.14.0 distributed: None matplotlib: 3.1.3 cartopy: None seaborn: None numbagg: None pint: None setuptools: 46.1.3.post20200330 pip: 20.0.2 conda: None pytest: None IPython: 7.13.0 sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/5727/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 74.346ms · About: xarray-datasette