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/6909#issuecomment-1212987160,https://api.github.com/repos/pydata/xarray/issues/6909,1212987160,IC_kwDOAMm_X85ITLcY,21034385,2022-08-12T10:58:15Z,2022-08-12T16:07:36Z,NONE,"Thanks for your help, Kai.
I have a follow-up question:
What about when I have multiple timesteps...
```
import xarray as xr
import glob
file_list = glob.glob(target_dir + '*.grib2')
ds = xr.open_mfdataset(file_list, engine='cfgrib', combine=""nested"", concat_dim=""generalVerticalLayer"")
```
It does load the data, but it does not get the dimensions right. Note that I attached a new dataset, which in the end should have the dimensions lon, lat, vertical and time.
Thanks for your help!
[icon-d2_germany_regular-lat-lon_model-level_u.zip](https://github.com/pydata/xarray/files/9315758/icon-d2_germany_regular-lat-lon_model-level_u.zip)
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1336946890
https://github.com/pydata/xarray/issues/6909#issuecomment-1213062603,https://api.github.com/repos/pydata/xarray/issues/6909,1213062603,IC_kwDOAMm_X85ITd3L,5821660,2022-08-12T12:31:04Z,2022-08-12T12:31:04Z,MEMBER,"This would be not as easy.
1.
If you want to stick with a single line of code you would need to feed a nested list:
`[[t0_f0, t0_f1, ...], [t1_f0, t1_f1, ...], [...]]`.
`
ds = xr.open_mfdataset(file_list, engine='cfgrib', combine=""nested"", concat_dim=[""time"", ""generalVerticalLayer""], coords=""minimal"", compat=""override"")
`
But note that it will take some coordinates from the first timestep only (eg. valid_time).
This might work without `coords=""minimal"", compat=""override""`, if you provide equivalent layers for each timestep.
2.
You can break this into pieces:
```python
d0 = xr.open_mfdataset(file_list[0], engine='cfgrib', combine=""nested"", concat_dim=""generalVerticalLayer"")
d1 = xr.open_mfdataset(file_list[1], engine='cfgrib', combine=""nested"", concat_dim=""generalVerticalLayer"")
ds = xr.concat([ds1, ds2], dim=""time"")
```
I'm not sure if there is an incantation to get it work with a oneliner, but others might know.","{""total_count"": 2, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 1, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1336946890
https://github.com/pydata/xarray/issues/6909#issuecomment-1212900207,https://api.github.com/repos/pydata/xarray/issues/6909,1212900207,IC_kwDOAMm_X85IS2Nv,5821660,2022-08-12T09:13:10Z,2022-08-12T09:13:10Z,MEMBER,"`ds = xr.open_mfdataset(file_list, engine='cfgrib', combine=""nested"", concat_dim=""generalVerticalLayer"")`","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1336946890