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-1289726681,https://api.github.com/repos/pydata/xarray/issues/7207,1289726681,IC_kwDOAMm_X85M36rZ,4753005,2022-10-24T22:45:36Z,2022-10-24T22:45:36Z,NONE,"Figured it out. Somehow I got my hands on a piece of data where the timestamps are ever-so-slightly non-monotonic. 2 of the 50k data points are out of order. That makes this a duplicate of #5012 and pandas [#42331](https://github.com/pandas-dev/pandas/issues/42331). Closing this, since those are still open. I would never have figured out what the problem was from the error message 😢, but that's a pandas issue. Sorry for the confusion. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1421180629 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) 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) 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)) 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 https://github.com/pydata/xarray/issues/7207#issuecomment-1289560937,https://api.github.com/repos/pydata/xarray/issues/7207,1289560937,IC_kwDOAMm_X85M3SNp,4753005,2022-10-24T20:17:32Z,2022-10-24T20:17:32Z,NONE,"Update: I was mistaken about the nature of the issue. I can load someone else's data with a datetime64[ns] dimension and select from it just fine. Meanwhile, I cannot select from my DataArray, even when I have replaced the datetime64[ns] dimension `time` with float64 values. ``` >> spgs = xr.open_dataarray(""mydata.nc"") >> print(spgs) [538364505 values with dtype=float32] Coordinates: * frequency (frequency) float32 0.0 0.1526 0.3052 ... 312.2 312.3 312.5 * time (time) float64 6.438 9.714 12.99 ... 1.729e+05 1.729e+05 * channel (channel) object 'lmws' 'spws' 'rips' 'spin' 'dgws' x (channel, time) float64 ... y (channel, time) float64 ... Attributes: units: uV fs: 625.0008026193788 >> spgs.sel(time=slice(20, 30)) KeyError: 20 ``` [Error traceback](https://github.com/pydata/xarray/files/9855056/error.txt) ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1421180629