home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1289576610

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/7207#issuecomment-1289576610 https://api.github.com/repos/pydata/xarray/issues/7207 1289576610 IC_kwDOAMm_X85M3WCi 4753005 2022-10-24T20:30:44Z 2022-10-24T20:30:44Z NONE

Okay, it gets even weirder. This does not work: ```

dat = np.arange(spgs.time.values.size).astype('float') foo = xr.DataArray(dat, dims=("time",), coords={"time": spgs.time.values}) print(foo)

<xarray.DataArray (time: 52549)> array([0.0000e+00, 1.0000e+00, 2.0000e+00, ..., 5.2546e+04, 5.2547e+04, 5.2548e+04]) Coordinates: * time (time) float64 6.438 9.714 12.99 ... 1.729e+05 1.729e+05 1.729e+05

foo.sel(time=slice(20, 30)) # KeyError This does: foo = xr.DataArray(dat, dims=("time",), coords={"time": dat}) print(foo)

<xarray.DataArray (time: 52549)> array([0.0000e+00, 1.0000e+00, 2.0000e+00, ..., 5.2546e+04, 5.2547e+04, 5.2548e+04]) Coordinates: * time (time) float64 0.0 1.0 2.0 3.0 ... 5.255e+04 5.255e+04 5.255e+04

foo.sel(time=slice(20, 30))

<xarray.DataArray (time: 11)> array([20., 21., 22., 23., 24., 25., 26., 27., 28., 29., 30.]) Coordinates: * time (time) float64 20.0 21.0 22.0 23.0 24.0 ... 27.0 28.0 29.0 30.0 ``` I am baffled.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  1421180629
Powered by Datasette · Queries took 0.703ms · About: xarray-datasette