I need to generate a cube that has the horizontal grid of one cube and the vertical grid of another (to make a cube for pressure on rho levels from a temperature cube and a u wind cube). The documentation is lacking context and I can't find anything useful by googling. I image doing something like copying the temperature cube, fidding with the sigma and delta in the cube and then running factory.update on the cube, but I can't quite work out the syntax.
A HybridHeightFactory is attached to a cube, and produces an "altitude" coordinate on request.
It needs to be linked to a suitable surface-altitude coordinate to work
-- which means it's not so simple to move it to a cube with a different horizontal grid.
So I think "factory.update" is not a great route, it is simpler to just make + attach a new one.
The plan will go something like...
orog = hgrid_cube.coord('surface_altitude')
sigma = vgrid_cube.coord('sigma')
delta = vgrid_cube.coord('level_height')
factory = iris.aux_factory.HybridHeightFactory(delta=delta, sigma=sigma, orography=orog)
new_cube = ...
new_cube.add_aux_coord(orog, (2, 3)) # or whatever dimensions
new_cube.add_aux_coord(sigma, (0,)) # or whatever dimensions
new_cube.add_aux_coord(delta, (0,)) # or whatever dimensions
new_cube.add_aux_factory(factory)
Note: in making "new_cube" from the old data, you may need to remove the existing aux factory too.