home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

3 rows where issue = 462010865 and user = 6628425 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 1

  • spencerkclark · 3 ✖

issue 1

  • How to select using `.where()` on a timestamp `coordinate` for forecast data with 5 dimensions · 3 ✖

author_association 1

  • MEMBER 3
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
508992414 https://github.com/pydata/xarray/issues/3053#issuecomment-508992414 https://api.github.com/repos/pydata/xarray/issues/3053 MDEyOklzc3VlQ29tbWVudDUwODk5MjQxNA== spencerkclark 6628425 2019-07-07T11:36:04Z 2019-07-07T11:36:04Z MEMBER

Glad I could help! Feel free to close this issue if you don't have any further questions on this topic (you'll still be able to refer to it later).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  How to select using `.where()` on a timestamp `coordinate` for forecast data with 5 dimensions 462010865
506747197 https://github.com/pydata/xarray/issues/3053#issuecomment-506747197 https://api.github.com/repos/pydata/xarray/issues/3053 MDEyOklzc3VlQ29tbWVudDUwNjc0NzE5Nw== spencerkclark 6628425 2019-06-28T14:07:40Z 2019-06-28T14:07:40Z MEMBER

Sure thing -- that's a valid concern. Perhaps it makes sense then to retain the MultiIndex that gets created through stacking: stacked = ds.stack(time=('initialisation_date', 'forecast_horizon')) Then you can select via the MultiIndex levels, e.g. ```

stacked.sel(forecast_horizon=np.timedelta64(28, 'D')) <xarray.Dataset> Dimensions: (initialisation_date: 12, lat: 36, lon: 45, number: 51) Coordinates: * lon (lon) float64 33.5 33.7 33.9 34.1 ... 41.85 42.05 42.25 * lat (lat) float64 -5.175 -5.176 -5.177 ... -5.201 -5.202 * number (number) int64 0 1 2 3 4 5 6 7 ... 44 45 46 47 48 49 50 valid_time (initialisation_date) datetime64[ns] 2018-02-28 ... 2019-01-28 * initialisation_date (initialisation_date) datetime64[ns] 2018-01-31 ... 2018-12-31 Data variables: precip (number, lat, lon, initialisation_date) float64 0.4954 ... 0.5873 Or, if you prefer to select using the `'valid_time'` coordinate, you can do: stacked.swap_dims({'time': 'valid_time'}).sel(valid_time='2018-04') <xarray.Dataset> Dimensions: (lat: 36, lon: 45, number: 51, valid_time: 7) Coordinates: * lon (lon) float64 33.5 33.7 33.9 34.1 ... 41.65 41.85 42.05 42.25 * lat (lat) float64 -5.175 -5.176 -5.177 -5.177 ... -5.2 -5.201 -5.202 * number (number) int64 0 1 2 3 4 5 6 7 8 ... 42 43 44 45 46 47 48 49 50 * valid_time (valid_time) datetime64[ns] 2018-04-02 2018-04-03 ... 2018-04-30 time (valid_time) object (Timestamp('2018-01-31 00:00:00', freq='M'), Timedelta('61 days 00:00:00')) ... (Timestamp('2018-03-31 00:00:00', freq='M'), Timedelta('30 days 00:00:00')) Data variables: precip (number, lat, lon, valid_time) float64 -1.084 0.8517 ... 1.784 ```

{
    "total_count": 1,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 1,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  How to select using `.where()` on a timestamp `coordinate` for forecast data with 5 dimensions 462010865
506725234 https://github.com/pydata/xarray/issues/3053#issuecomment-506725234 https://api.github.com/repos/pydata/xarray/issues/3053 MDEyOklzc3VlQ29tbWVudDUwNjcyNTIzNA== spencerkclark 6628425 2019-06-28T13:01:03Z 2019-06-28T13:01:58Z MEMBER

Thanks for the easy to copy and paste example. In the 'valid_time' DataArray, should the dimension named 'step' instead be named 'forecast_horizon'?

Under that assumption, I think the simplest approach is to stack the 'initialisation_date' and 'forecast_horizon' dimensions, and assign the stacked version of 'valid_time' as the coordinate: python stacked = ds.stack(time=('initialisation_date', 'forecast_horizon')) stacked['time'] = stacked.valid_time stacked = stacked.drop('valid_time') Then you can select times as normal, e.g. stacked.sel(time='2018-04') returns: <xarray.Dataset> Dimensions: (lat: 36, lon: 45, number: 51, time: 7) Coordinates: * lon (lon) float64 33.5 33.7 33.9 34.1 34.3 ... 41.65 41.85 42.05 42.25 * lat (lat) float64 -5.175 -5.176 -5.177 -5.177 ... -5.2 -5.201 -5.202 * number (number) int64 0 1 2 3 4 5 6 7 8 9 ... 42 43 44 45 46 47 48 49 50 * time (time) datetime64[ns] 2018-04-02 2018-04-03 ... 2018-04-30 Data variables: precip (number, lat, lon, time) float64 0.2684 0.8408 ... 1.7 -0.383

{
    "total_count": 1,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 1,
    "rocket": 0,
    "eyes": 0
}
  How to select using `.where()` on a timestamp `coordinate` for forecast data with 5 dimensions 462010865

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 31.827ms · About: xarray-datasette