Reading grib meteo format

There are lots of the data for weather
on different sites in the data with grib extensions
and pictures like maps looking
very similar to GMT maps
Is it standart way to read such files
in gmt.
I am not able to attach sample of such file,
it is very huge
to look samples is possible,
for example, here!/dataset/insitu-gridded-observations-europe?tab=form

Hi @CraneBoba!

There are numerous ways around it. One way is to convert GRIB to NetCDF using grib_to_netcdf ( which is part of the ECCodes suite. Then you can use the NetCDF directly with GMT.

Another (and my preferred) way is to use XArray with the cfgrib ( extension. Once you have an XArray, you can immediately plot the variables using pygmt. One of the advantages of XArray is that it is very easy to rework the data.

For example:

import xarray as xr
import pygmt

fid_grib = 'your_grib.grib'
ds = []
list_keys = ['pv']

for shortName in ['z', 'lnsp', 't', 'q', 'u', 'v', 'w']:
    print('Reading parameter {}'.format(shortName))
    ds += [ xr.open_dataset(fid_grib,
                          backend_kwargs={'read_keys': list_keys,
                                              {'typeOfLevel': 'hybrid',
                                               'shortName': shortName}})]
ds = xr.merge(ds)

var = ds["variable_x"].sel(...)
fig = pygmt.Figure()
[your code here...]
fig.grdimage(var, n='b', Q=True)

Good luck!

GMT can read GRIB files directly inasmuch as GDAL can do it. But low experience in the matter here.

Thanks a lot. I shall try to use it.

I think grib files can be read in QGIS as well (since it uses GDAL).

Again, grib files can be read directly by GMT.