home / github

Menu
  • Search all tables
  • GraphQL API

issues

Table actions
  • GraphQL API for issues

1 row where type = "issue" and user = 6049169 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
332077435 MDU6SXNzdWUzMzIwNzc0MzU= 2232 resample monthly to seasonal docstring example is wrong edoddridge 6049169 closed 0     3 2018-06-13T16:45:48Z 2018-07-05T19:01:17Z 2018-07-05T19:01:17Z CONTRIBUTOR      

The doc string for resample contains an example for calculating a seasonal average from monthly values:

https://github.com/pydata/xarray/blob/9c8005937556211a8bf28a946744da3768846c5a/xarray/core/common.py#L620-L637

But running the code in the docstring gives different output:

```python

da = xr.DataArray(np.linspace(0, 11, num=12), coords=[pd.date_range('15/12/1999', periods=12, freq=pd.DateOffset(months=1))], dims='time') da <xarray.DataArray (time: 12)> array([ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11.]) Coordinates: * time (time) datetime64[ns] 1999-12-15 2000-01-15 2000-02-15 ...

da.resample(time="Q-DEC").mean() <xarray.DataArray (time: 5)> array([ 0. , 2. , 5. , 8. , 10.5]) Coordinates: * time (time) datetime64[ns] 1999-12-31 2000-03-31 2000-06-30 ... ```

Problem description

The difference is undesirable. Furthermore, the user is probably after seasonal averages computed for DJF, MAM, JJA, and SON, which is not what the example code produces. The example produces averages for JFM, AMJ, JAS, and OND.

Changing to

da.resample(time="Q-NOV").mean() produces three month averages that align with the expected seasons.

Output of xr.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.6.4.final.0 python-bits: 64 OS: Darwin OS-release: 17.5.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: en_GB.UTF-8 LOCALE: en_GB.UTF-8 xarray: 0.10.2 pandas: 0.22.0 numpy: 1.14.2 scipy: 1.0.1 netCDF4: 1.3.1 h5netcdf: None h5py: 2.7.1 Nio: None zarr: None bottleneck: 1.2.1 cyordereddict: None dask: 0.17.2 distributed: 1.21.5 matplotlib: 2.2.2 cartopy: 0.16.0 seaborn: 0.8.1 setuptools: 38.4.0 pip: 10.0.1 conda: None pytest: 3.3.2 IPython: 6.2.1 sphinx: 1.7.2
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2232/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 560.808ms · About: xarray-datasette