home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

3 rows where issue = 334778045 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 2

  • aidanheerdegen 2
  • spencerkclark 1

author_association 2

  • CONTRIBUTOR 2
  • MEMBER 1

issue 1

  • Implement shift for CFTimeIndex · 3 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
399421816 https://github.com/pydata/xarray/issues/2244#issuecomment-399421816 https://api.github.com/repos/pydata/xarray/issues/2244 MDEyOklzc3VlQ29tbWVudDM5OTQyMTgxNg== aidanheerdegen 6063709 2018-06-22T12:11:44Z 2018-06-22T12:11:44Z CONTRIBUTOR

Great! Thanks @spencerkclark

I agree this is an excellent work around.

One of the most frustrating aspect of using an otherwise brilliant tool like xarray (and other python packages) is knowing what NOT to try and do. It is otherwise almost magical in the things it does well, so there is something of an expectation that it can and should do everything. If this work-around was part of the official documentation (until shift is implemented) that would be very useful.

I am often in the position of recommending software solutions to scientists who need to analyse their data, and the date issue with xarray (which CFTime has mostly alleviated) always made me hesitant to recommend it whole-heartedly. So thanks for your part in adding this to xarray.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Implement shift for CFTimeIndex  334778045
399406545 https://github.com/pydata/xarray/issues/2244#issuecomment-399406545 https://api.github.com/repos/pydata/xarray/issues/2244 MDEyOklzc3VlQ29tbWVudDM5OTQwNjU0NQ== spencerkclark 6628425 2018-06-22T11:05:18Z 2018-06-22T11:05:18Z MEMBER

@aidanheerdegen thanks, I agree an implementation of shift would be nice. In the meantime, if the offset can be written as a fixed amount of time (like 365 days as opposed to something like one month), a slightly simpler way than looping over the elements of the index is to add a datetime.timedelta object to it, e.g.:

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

In [2]: import xarray as xr

In [3]: from cftime import num2date

In [4]: from datetime import timedelta

In [5]: xr.set_options(enable_cftimeindex=True) Out[5]: <xarray.core.options.set_options at 0x110885a10>

In [6]: times = num2date(np.arange(730), calendar='noleap', units='days since 0001-01-01')

In [7]: da = xr.DataArray(np.arange(730), coords=[times], dims=['time'])

In [8]: da.time.get_index('time') Out[8]: CFTimeIndex([0001-01-01 00:00:00, 0001-01-02 00:00:00, 0001-01-03 00:00:00, 0001-01-04 00:00:00, 0001-01-05 00:00:00, 0001-01-06 00:00:00, 0001-01-07 00:00:00, 0001-01-08 00:00:00, 0001-01-09 00:00:00, 0001-01-10 00:00:00, ... 0002-12-22 00:00:00, 0002-12-23 00:00:00, 0002-12-24 00:00:00, 0002-12-25 00:00:00, 0002-12-26 00:00:00, 0002-12-27 00:00:00, 0002-12-28 00:00:00, 0002-12-29 00:00:00, 0002-12-30 00:00:00, 0002-12-31 00:00:00], dtype='object', name=u'time', length=730)

In [9]: da.time.get_index('time') + timedelta(days=365) Out[9]: Index([0002-01-01 00:00:00, 0002-01-02 00:00:00, 0002-01-03 00:00:00, 0002-01-04 00:00:00, 0002-01-05 00:00:00, 0002-01-06 00:00:00, 0002-01-07 00:00:00, 0002-01-08 00:00:00, 0002-01-09 00:00:00, 0002-01-10 00:00:00, ... 0003-12-22 00:00:00, 0003-12-23 00:00:00, 0003-12-24 00:00:00, 0003-12-25 00:00:00, 0003-12-26 00:00:00, 0003-12-27 00:00:00, 0003-12-28 00:00:00, 0003-12-29 00:00:00, 0003-12-30 00:00:00, 0003-12-31 00:00:00], dtype='object', length=730) Note, however, that currently the index type is not preserved under this sort of arithmetic (which we might consider a separate issue). This can be alleviated by casting the result as a `CFTimeIndex`: In [10]: xr.CFTimeIndex(da.time.get_index('time') + timedelta(days=365)) Out[10]: CFTimeIndex([0002-01-01 00:00:00, 0002-01-02 00:00:00, 0002-01-03 00:00:00, 0002-01-04 00:00:00, 0002-01-05 00:00:00, 0002-01-06 00:00:00, 0002-01-07 00:00:00, 0002-01-08 00:00:00, 0002-01-09 00:00:00, 0002-01-10 00:00:00, ... 0003-12-22 00:00:00, 0003-12-23 00:00:00, 0003-12-24 00:00:00, 0003-12-25 00:00:00, 0003-12-26 00:00:00, 0003-12-27 00:00:00, 0003-12-28 00:00:00, 0003-12-29 00:00:00, 0003-12-30 00:00:00, 0003-12-31 00:00:00], dtype='object', length=730) ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Implement shift for CFTimeIndex  334778045
399352855 https://github.com/pydata/xarray/issues/2244#issuecomment-399352855 https://api.github.com/repos/pydata/xarray/issues/2244 MDEyOklzc3VlQ29tbWVudDM5OTM1Mjg1NQ== aidanheerdegen 6063709 2018-06-22T07:44:03Z 2018-06-22T07:44:03Z CONTRIBUTOR

Submitted issue brought up in this thread

https://github.com/pydata/xarray/issues/2191#issuecomment-399337976

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Implement shift for CFTimeIndex  334778045

Advanced export

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

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 760.334ms · About: xarray-datasette