I'm using the python iris module to read in some netCDF data and output specific fields in grib format for further downstream processing. However I generate the following error
.../pythonlib/iris/1.9.1/lib/python2.7/site-packages/Iris-1.9.1-py2.7-linux-x86_64.egg/iris/fileformats/grib/_save_rules.pyc in gribbability_check(cube)
1062 cs1 = cube.coord(dimensions=[1]).coord_system
1063 if cs0 is None or cs1 is None:
-> 1064 raise iris.exceptions.TranslationError("CoordSystem not present")
1065 if cs0 != cs1:
1066 raise iris.exceptions.TranslationError("Inconsistent CoordSystems")
TranslationError: CoordSystem not present
So after having read the following :
Iris Google group thread https://groups.google.com/forum/#!searchin/scitools-iris/grib2/scitools-iris/D2InfYESaUM/yVT7ayXSFV0J
StackOverflow thread Converting NetCDF to GRIB2
iris source code at https://github.com/SciTools/iris/blob/master/lib/iris/fileformats/grib/grib_save_rules.py#L80
I attempted the following
In [26]: radius=iris.fileformats.pp.EARTH_RADIUS
In [27]: u.coord(dimensions=[0]).coord_system=iris.coord_systems.GeogCS(radius)
In [28]: u.coord(dimensions=[1]).coord_system=iris.coord_systems.GeogCS(radius)
In [29]: u.coord(dimensions=[0]).coord_system
Out[29]: GeogCS(6371229.0)
In [30]: u.coord(dimensions=[1]).coord_system
Out[30]: GeogCS(6371229.0)
In [31]: iris.save(u,'prod.grib2')
---------------------------------------------------------------------------
TranslationError Traceback (most recent call last)
<ipython-input-15-a38abe1720ac> in <module>()
----> 1 iris.save(u,'prod.grib2')
i.e. I still generate the same error, a failure in the iris subroutine gribbability_check
Hoping someone can help. I'm using iris 1.9.0 with python 2.7.6. The operation also fails with iris 1.8.0
Cheers