Hi,
I am running into issues trying to convert a cube of air_temperature on pressure levels to potential temperature by using the pressure coordinate (the documentation for derived variables uses a separate pressure cube).
I am starting with a cube 'temperature':
<iris 'Cube' of air_temperature / (K) (p: 37; latitude: 5; longitude: 5)>
In order to get the units right, I tried doing:
pressure = temperature.coord('pressure')
pref = iris.coords.AuxCoord(p0, long_name='reference_pressure', units='hPa')
pref.convert_units(pressure.units)
theta = temperature * (pref/pressure)**0.28571429
This gives the error
/apps/python-libs-1.3/lib/iris/coords.pyc in __div__(self, other)
670
671 def __div__(self, other):
--> 672 return self.__binary_operator__(other, Coord._MODE_DIV)
673
674 def __truediv__(self, other):
/apps/python-libs-1.3/lib/iris/coords.pyc in __binary_operator__(self, other, mode_constant)
627 if isinstance(other, Coord):
628 raise iris.exceptions.NotYetImplementedError(
--> 629 'coord %s coord' % Coord._MODE_SYMBOL[mode_constant])
630
631 elif isinstance(other, (int, float, np.number)):
NotYetImplementedError: coord / coord
If I just use the pressure data (i.e. pref.points / temperature.coord('pressure').points) then I get a broadcasting error. I can get around this by manually rebroadcasting this, but I know that multiplying the temperature by its pressure coordinate does automatically broadcast correctly (i.e. temperature * pressure works fine, even though temperature * pressure.points does not).
In summary, is there a way of using a DimCoord like a cube, in order to easily use cube coordinates to calculate other quantities?