I'm using Iris module to convert from netcdf to grib2:
import iris
cubes = iris.load('SST.nc') # each variable in the netcdf file is a cube
data=cubes[0]
data.coord('lat').coord_system=iris.coord_systems.GeogCS(4326)
data.coord('lon').coord_system=iris.coord_systems.GeogCS(4326)
print (data)
iris.save(data, 'SST_test.grib2') # save a specific variable to grib
But I can't save in grib2! I saw other users can do it with the same iris module, but I don't know where is the problem. I got the following error: "Unable to save GRIB file - "iris_grib" package is not installed."
I've just installed iris 2.2.0 in Python 3.7. The iris_grib module is not available to Python 3.7.