Closed PedroVenancio closed 3 years ago
MDAL uses GDAL for GRIB and netCDF. When opening with GDAL as raster the GRIB file, I see the same variables as in the grib mesh above. So I think, GDAL does not see the same variable in GRIB and netCDF for these files.
Hi @vcloarec
So do you think this could be a GDAL issue?
@PedroVenancio, not sure it is an issue of GDAL, I don't know enought GDAL, I could only say that dataset groups are not read in the same way between netCDF and GRIB.
Here the dataset group names extracted from the GRIB file only with GDAL (filtered from result of gdalinfo command):
GRIB_COMMENT=10 metre u wind component [m/s]
GRIB_COMMENT=10 metre v wind component [m/s]
GRIB_COMMENT=2 metre dewpoint temperature [C]
GRIB_COMMENT=2 metre temperature [C]
GRIB_COMMENT=Boundary layer height [m]
GRIB_COMMENT=K index [C]
GRIB_COMMENT=Mean sea level pressure [Pa]
GRIB_COMMENT=Pressure [Pa]
GRIB_COMMENT=Total cloud cover (0 - 1) [-]
GRIB_COMMENT=Total precipitation [m]
GRIB_COMMENT=undefined [-]
GRIB_COMMENT=Wave Spectra (2) [-]
As the difference comes from GDAL, we can't fix this issue in MDAL (except if we make MDAL independent of GDAL for reading GRIB files, this is another story...).
@vcloarec The strange thing is that this seems to only happen with ERA5 grib files from ECMWF.
I've tested some grib files from numerical prediction models, from https://openskiron.org/en/ and https://opengribs.org/en/gribs, and they work just fine.
So, can this be an issue with this specific grib file format? But as far as I can understand, NetCDF files from ERA5 are created directly from grib ones:
// global attributes:
:Conventions = "CF-1.6";
:history = "2021-05-17 10:55:28 GMT by grib_to_netcdf-2.16.0: /opt/ecmwf/eccodes/bin/grib_to_netcdf -S param -o /cache/data7/adaptor.mars.internal-1621248846.4072957-30688-9-e7584d00-6068-4887-a018-2bfcf59865d9.nc /cache/tmp/e7584d00-6068-4887-a018-2bfcf59865d9-adaptor.mars.internal-1621248846.4078848-30688-1-tmp.grib";
@PedroVenancio Maybe the tool "grib_to_netcdf" used to create the NetCDF file works better than GDAL for reading the dataset group name of grib file for certain cases... And, yes it could be a GDAL issue only for specific files.
except if we make MDAL independent of GDAL for reading GRIB files, this is another story...
you don't want to do that, believe me. GRIB is one of the worse format ever
Thanks for take a look @rouault !
This issue should be fixed with https://github.com/OSGeo/gdal/pull/3875
I'm using ERA5 hourly data and it seems QGIS does not deal correctly with data in GRIB format.
Take a look at these two files, both from Copernicus Climate Data Store. They represent the same data, but one is in GRIB and another in NetCDF:
https://cld.pt/dl/download/7860c0a0-da5f-4f23-91bb-6267da814fc2/ERA5.zip
The variables contained in both are: 10m u-component of wind, 10m v-component of wind, 2m dewpoint temperature, 2m temperature, Boundary layer height, Convective available potential energy, Convective inhibition, Convective rain rate, Instantaneous 10m wind gust, K index, Mean sea level pressure, Total cloud cover, Total precipitation.
NetCDF shows those variables without problems:
GRIB shows only part of them and two more that does not correspond to the variables (Wave Spectra / undefined):
I can confirm that the data is there in GRIB file:
Tested on QGIS 3.16 and 3.18 on Windows.