SciTools/iris — pull request #194 by ajdawson (2012-11-10 20:35:33+00:00)
Title: BF - fix broadcasting of area weights

The function ``iris.analysis.cartography.area_weights`` was raising a ValueError about being unable to broadcast two arrays. This was because the code that broadcasts the weights array `ll_weights` to the full shape of the cube assumed that the lat/lon (or lon/lat) grid occupied the rightmost dimensions of the cube. This is a simple fix, just add singleton dimensions to the right of ``ll_weights`` as required and then do the broadcast.

There was also the possibility of an unhandled IndexError coming from ``_get_lat_lon_coords`` if either or both of latitude and longitude coords could not be found. This now raises a more helpful exception as in ``iris.analysis.cartography.project``.