SciTools/cartopy — pull request #373 by cpelley (2013-12-20 17:20:17+00:00)
Title: BUG: Broken cartopy img_transform masks

Putting this PR up here as I have not managed to finish the fixes for the bugs I found before Christmas.

Relates to changes made in https://github.com/SciTools/cartopy/pull/370
(specifically commit https://github.com/SciTools/cartopy/commit/02e764c511b72abfc50a6273c688b9bf65ec9316)

**Two bugs:**
**1.** Mask array operations which are unsuitable for the case when `dat.mask = False`
`TypeError: 'numpy.bool_' object does not support item assignment`

Should instead be indexing the array itself and assigning a np.ma.masked value to these indexes.
i.e. `dat[index] = np.ma.masked` to mask these indexes.

**2.** The rectangle specified is unsuitable for the general case for determining which target points fall outside the source domain.

```Python
outside_source_domain = ((target_in_source_x < source_x_coords.min()) |
(target_in_source_x > source_x_coords.max()) |
(target_in_source_y < source_y_coords.min()) |
(target_in_source_y > source_y_coords.max()))
```

This issue reveals itself when running one of the iris tests which has data on the range [0, 360] rather than [-180, 180].

These bugs currently don't allow iris to work with cartopy master.