SciTools/iris — pull request #1497 by lbdreyer (2014-12-11 12:12:34+00:00)
Title: Allow a points only intersection on coordinates with bounds

Intersections treat coords with and without bounds differently. This sometimes trips up users if they don't know whether their data has bounds or not (especially with netCDF).

This change allow you to always perform a points only intersection whether or not it has bounds by setting points_only to True. If it has bounds, these are retained.
See below for use examples:

>>> cube=iris.load(file)
>>>
>>> new_cube = cube.intersection(longitude=(30, 50))
>>> print new_cube.coord('longitude')
DimCoord(array([ 27.5, 32.5, 37.5, 42.5, 47.5, 52.5]), bounds=array([[ 25., 30.],
[ 30., 35.],
[ 35., 40.],
[ 40., 45.],
[ 45., 50.],
[ 50., 55.]]), standard_name='longitude', units=Unit('degrees'), coord_system=GeogCS(6371229.0))

>>> new_cube = cube.intersection(longitude=(30, 50, True, True, True))
>>> print new_cube.coord('longitude')
DimCoord(array([ 32.5, 37.5, 42.5, 47.5]), bounds=array([[ 30., 35.],
[ 35., 40.],
[ 40., 45.],
[ 45., 50.]]), standard_name='longitude', units=Unit('degrees'), coord_system=GeogCS(6371229.0))

Problems:
- if doing points only intersection on cube with bounds, it does (points = wrap_lons(coord.points, minimum, modulus)) twice. First time to get the indices of the cells we want in the intersection, second time in case there were split cells.
- is there a better way to call it than using "points_only"

No tests are included as I wanted feedback on whether I should make any changes