Too many datasets returned ?
In the first example, the file (simple.zip) contains 2 variables.
cfgrib returns these variables in 2 different datasets and I wonder why.
If I use xarray.open_mfdataset with cfgrib as engine, one dataset with both variables is returned. So it was possible.

The second file (complex.zip) contains many variables of different types, so it is normal to get many datasets. However, the first variable (Relative humidity r) generates one dataset for the first time step and a second one for steps 2 dans 3.
Why not one dataset for steps 1, 2, 3 ?
hello @abakleriche,
I think it's because 'dataType' is different for 0 steps (an) and 6/12 steps (fc) :
$ grib_ls -w shortName=r complex.grib2
complex.grib2
edition centre date dataType gridType stepRange typeOfLevel level shortName packingType
2 egrr 20180618 an regular_ll 0 isobaricInhPa 1000 r grid_jpeg
2 egrr 20180618 an regular_ll 0 isobaricInhPa 925 r grid_jpeg
2 egrr 20180618 an regular_ll 0 isobaricInhPa 900 r grid_jpeg
2 egrr 20180618 an regular_ll 0 isobaricInhPa 850 r grid_jpeg
2 egrr 20180618 an regular_ll 0 isobaricInhPa 700 r grid_jpeg
2 egrr 20180618 an regular_ll 0 isobaricInhPa 600 r grid_jpeg
2 egrr 20180618 an regular_ll 0 isobaricInhPa 500 r grid_jpeg
2 egrr 20180618 an regular_ll 0 isobaricInhPa 400 r grid_jpeg
2 egrr 20180618 an regular_ll 0 isobaricInhPa 300 r grid_jpeg
2 egrr 20180618 an regular_ll 0 isobaricInhPa 250 r grid_jpeg
2 egrr 20180618 an regular_ll 0 isobaricInhPa 200 r grid_jpeg
2 egrr 20180618 fc regular_ll 6 isobaricInhPa 1000 r grid_jpeg
2 egrr 20180618 fc regular_ll 6 isobaricInhPa 925 r grid_jpeg
2 egrr 20180618 fc regular_ll 6 isobaricInhPa 900 r grid_jpeg
2 egrr 20180618 fc regular_ll 6 isobaricInhPa 850 r grid_jpeg
2 egrr 20180618 fc regular_ll 6 isobaricInhPa 700 r grid_jpeg
2 egrr 20180618 fc regular_ll 6 isobaricInhPa 600 r grid_jpeg
2 egrr 20180618 fc regular_ll 6 isobaricInhPa 500 r grid_jpeg
2 egrr 20180618 fc regular_ll 6 isobaricInhPa 400 r grid_jpeg
2 egrr 20180618 fc regular_ll 6 isobaricInhPa 300 r grid_jpeg
2 egrr 20180618 fc regular_ll 6 isobaricInhPa 250 r grid_jpeg
2 egrr 20180618 fc regular_ll 6 isobaricInhPa 200 r grid_jpeg
2 egrr 20180618 fc regular_ll 12 isobaricInhPa 1000 r grid_jpeg
2 egrr 20180618 fc regular_ll 12 isobaricInhPa 925 r grid_jpeg
2 egrr 20180618 fc regular_ll 12 isobaricInhPa 900 r grid_jpeg
2 egrr 20180618 fc regular_ll 12 isobaricInhPa 850 r grid_jpeg
2 egrr 20180618 fc regular_ll 12 isobaricInhPa 700 r grid_jpeg
2 egrr 20180618 fc regular_ll 12 isobaricInhPa 600 r grid_jpeg
2 egrr 20180618 fc regular_ll 12 isobaricInhPa 500 r grid_jpeg
2 egrr 20180618 fc regular_ll 12 isobaricInhPa 400 r grid_jpeg
2 egrr 20180618 fc regular_ll 12 isobaricInhPa 300 r grid_jpeg
2 egrr 20180618 fc regular_ll 12 isobaricInhPa 250 r grid_jpeg
2 egrr 20180618 fc regular_ll 12 isobaricInhPa 200 r grid_jpeg
2 egrr 20180618 an regular_ll 0 heightAboveGround 0 r grid_jpeg
2 egrr 20180618 fc regular_ll 6 heightAboveGround 0 r grid_jpeg
2 egrr 20180618 fc regular_ll 12 heightAboveGround 0 r grid_jpeg
36 of 195 messages in complex.grib2
36 of 195 total messages in 1 files
Hope this helps, Christophe