home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 506725234

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/3053#issuecomment-506725234 https://api.github.com/repos/pydata/xarray/issues/3053 506725234 MDEyOklzc3VlQ29tbWVudDUwNjcyNTIzNA== 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
}
  462010865
Powered by Datasette · Queries took 83.509ms · About: xarray-datasette