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/6560#issuecomment-1303038334,https://api.github.com/repos/pydata/xarray/issues/6560,1303038334,IC_kwDOAMm_X85Nqsl-,90036937,2022-11-04T06:42:18Z,2022-11-04T06:43:01Z,NONE,"First of all, thank you for your help @dcherian @max-sixty . I finally reproduced this problem.
I put the `ds.isel(time=[0], isoBaricInhPa=1).z[:, ::10, :][:, ::-1, :]` to
`ds.isel(time=[0], isoBaricInhPa=1).z[:, ::10, ::10][:, ::-1, :]` can make a minimal example.
```
import numpy as np
import xarray as xr
ds = xr.Dataset(
{
""z"": (
(""time"", ""isoBaricInhPa"", ""latitude"", ""longitude""),
np.ones((1, 5, 721, 1440)),
)
},
coords={""latitude"": np.linspace(-90, 90, 721)},
).to_netcdf(""test.nc"")
ds = xr.open_dataset('test.nc')
a = ds.isel(time=[0], isoBaricInhPa=1).z[:, ::10, ::10][:, ::-1, :]
print(a.sizes)
print(a.shape)
print(a)
```
```
Frozen({'time': 1, 'latitude': 73, 'longitude': 144})
(1, 73, 144)
array([[[1., 1., ..., 1., 1.],
[1., 1., ..., 1., 1.],
...,
[1., 1., ..., 1., 1.],
[1., 1., ..., 1., 1.]]])
Coordinates:
* latitude (latitude) float64 90.0 87.5 85.0 82.5 ... -82.5 -85.0 -87.5 -90.0
Dimensions without coordinates: time, longitude
```
","{""total_count"": 1, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 1}",,1222609313
https://github.com/pydata/xarray/issues/6560#issuecomment-1118866758,https://api.github.com/repos/pydata/xarray/issues/6560,1118866758,IC_kwDOAMm_X85CsI1G,5635139,2022-05-05T17:34:51Z,2022-05-05T17:34:51Z,MEMBER,@dcherian thanks a lot for looking into this. @jesieleo thanks for your patience in us finding the bug.,"{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1222609313
https://github.com/pydata/xarray/issues/6560#issuecomment-1118690026,https://api.github.com/repos/pydata/xarray/issues/6560,1118690026,IC_kwDOAMm_X85Crdrq,2448579,2022-05-05T15:21:22Z,2022-05-05T15:21:40Z,MEMBER,"OK it has to do with the lazy backend. Calling `data_example.load()` fixes things. @jesieleo in the mean time, if your data is small use `load_dataset` or `load` to fix it.
Though I still can't make a minimal example. The example below works fine.
``` python
import numpy as np
import xarray as xr
ds = xr.Dataset(
{
""z"": (
(""time"", ""isoBaricInhPa"", ""latitude"", ""longitude""),
np.ones((1, 5, 721, 1440)),
)
},
coords={""latitude"": np.linspace(-90, 90, 721)},
).to_netcdf(""test.nc"")
ds = xr.open_dataset('test.nc')
ds.isel(time=[0], isoBaricInhPa=1).z[:, ::10, :][:, ::-1, :]
```","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1222609313
https://github.com/pydata/xarray/issues/6560#issuecomment-1118682989,https://api.github.com/repos/pydata/xarray/issues/6560,1118682989,IC_kwDOAMm_X85Crb9t,2448579,2022-05-05T15:16:33Z,2022-05-05T15:16:52Z,MEMBER,"OK turns out my attempts at a minimal example didn't work.
There's some bug here (on xarray main)
1. the size of `latitude` is different in `.sizes, .shape, .data.shape` and
2. latitude really should be 73 elements. I don't see why a subsetting happens when slicing with `::-`
-----
@jesieleo here's how I tried to create a ""minimal example""
``` python
import xarray as xr
import numpy as np
ds = xr.Dataset(
{
""z"": (
(""time"", ""isoBaricInhPa"", ""latitude"", ""longitude""),
np.ones((1, 5, 721, 1440)), # use numpy.ones to create array of same shape.
)
},
coords={""latitude"": np.linspace(-90, 90, 721)},
)
ds.isel(isoBaricInhPa=1).z[:, ::10, :][:, ::-1, :]
```
Though this doesn't replicate it!
","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1222609313
https://github.com/pydata/xarray/issues/6560#issuecomment-1118482764,https://api.github.com/repos/pydata/xarray/issues/6560,1118482764,IC_kwDOAMm_X85CqrFM,90036937,2022-05-05T12:20:59Z,2022-05-05T12:20:59Z,NONE,"> Don't bundle data — build a new example from a basic array and demonstrate the bug.
Since I don't know how the grib file is generated, I can't reproduce it. But the data I use is the ECWMF official website data converted by engine='cfgrib', this problem may be caused by the 'cfgrib' engine, although it is not very big wrong, but it's a hidden danger.
I'm not competent enough, sorry to bother you.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1222609313
https://github.com/pydata/xarray/issues/6560#issuecomment-1117678722,https://api.github.com/repos/pydata/xarray/issues/6560,1117678722,IC_kwDOAMm_X85CnmyC,5635139,2022-05-04T18:40:41Z,2022-05-04T18:40:41Z,MEMBER,"> But no, this is not sufficient — can you show your problem on an array like `xr.DataArray(np.arange(12).reshape(2,3,4))`, only adding extra as necessary? Please have another read of the links above showing how to minimize the examples.
Don't bundle data — build a new example from a basic array and demonstrate the bug.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1222609313
https://github.com/pydata/xarray/issues/6560#issuecomment-1116993532,https://api.github.com/repos/pydata/xarray/issues/6560,1116993532,IC_kwDOAMm_X85Ck_f8,90036937,2022-05-04T07:09:32Z,2022-05-04T07:09:32Z,NONE,"> What is `data3`? We need an example that I can paste into a blank notebook and will show the problem.
I packed them in one `.zip` this time ,the second-dimensional coordinates of variable `a` do not correspond to the data","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1222609313
https://github.com/pydata/xarray/issues/6560#issuecomment-1116363332,https://api.github.com/repos/pydata/xarray/issues/6560,1116363332,IC_kwDOAMm_X85CilpE,5635139,2022-05-03T17:31:55Z,2022-05-03T17:31:55Z,MEMBER,What is `data3`? We need an example that I can paste into a blank notebook and will show the problem. ,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1222609313
https://github.com/pydata/xarray/issues/6560#issuecomment-1115771909,https://api.github.com/repos/pydata/xarray/issues/6560,1115771909,IC_kwDOAMm_X85CgVQF,90036937,2022-05-03T06:15:50Z,2022-05-03T06:17:44Z,NONE,"> But no, this is not sufficient — can you show your problem on an array like `xr.DataArray(np.arange(12).reshape(2,3,4))`, only adding extra as necessary? Please have another read of the links above showing how to minimize the examples.
Ok ,thanks. I try to simplify the problem on an array
`a = data3.sel(time='1979-1',isobaricInhPa=200).z[:, ::10,::10][:, ::-1,:]` ,my question is that the coordinates DO NOT correspond to the data, there is 73 on coordinates latitude but only the there is 72 only on real data latitude.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1222609313
https://github.com/pydata/xarray/issues/6560#issuecomment-1115423953,https://api.github.com/repos/pydata/xarray/issues/6560,1115423953,IC_kwDOAMm_X85CfATR,5635139,2022-05-02T22:16:06Z,2022-05-02T22:16:06Z,MEMBER,"OK — I would like to make your experience GitHub a good one! It's a magical place.
> I have added a zip dile with a .ipynb file , don't know if it is ok?
But no, this is not sufficient — can you show your problem on an array like `xr.DataArray(np.arange(12).reshape(2,3,4))`, only adding extra as necessary? Please have another read of the links above showing how to minimize the examples.","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1222609313
https://github.com/pydata/xarray/issues/6560#issuecomment-1114655218,https://api.github.com/repos/pydata/xarray/issues/6560,1114655218,IC_kwDOAMm_X85CcEny,90036937,2022-05-02T09:19:24Z,2022-05-02T09:57:55Z,NONE,"Sorry, this is the first time I use Github to report a problem, I don't understand it very well, it seems that I need to learn more.
I have added a zip dile with a .ipynb file , don't know if it is ok?
------------------ 原始邮件 ------------------
发件人: ""Maximilian ***@***.***>;
发送时间: 2022年5月2日(星期一) 下午4:32
收件人: ***@***.***>;
抄送: ***@***.***>; ***@***.***>;
主题: Re: [pydata/xarray] error when using .sel() and [:, ::10, ::10][:, ::-1, :] (Issue #6560)
@jesieleo — I'm probably being unclear, and I'm sure you're well-intentioned, but this & the previous issues aren't constructive for either of us so far.
In the politest possible way: please make an issue that is complete and ""copy & pastes into an IPython prompt or Binder notebook, returning the result."". You cannot reference data that is only on your computer. This will require work from your end to take the example you have there, and reduce it to the bare minimum.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>","{""total_count"": 1, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 1}",,1222609313
https://github.com/pydata/xarray/issues/6560#issuecomment-1114620018,https://api.github.com/repos/pydata/xarray/issues/6560,1114620018,IC_kwDOAMm_X85Cb8By,5635139,2022-05-02T08:32:25Z,2022-05-02T08:32:25Z,MEMBER,"@jesieleo — I'm probably being unclear, and I'm sure you're well-intentioned, but this & the previous issues aren't constructive for either of us so far.
In the politest possible way: please make an issue that is complete and ""copy & pastes into an IPython prompt or [Binder notebook](https://mybinder.org/v2/gh/pydata/xarray/main?urlpath=lab/tree/doc/examples/blank_template.ipynb), returning the result."". You cannot reference data that is only on your computer. This will require work from your end to take the example you have there, and reduce it to the bare minimum.","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1222609313