SciTools/iris — pull request #1011 by dkillick (2014-02-10 11:03:15+00:00)
Title: Improved error message on unit conversion failure

Currently if unit conversion fails on a time coordinate the error message can be particularly obscure:

```python
>>> cube.coord('time').units
Unit('hours since 1970-01-01 00:00:00', calendar='360_day')
>>> new_unit = iris.unit.Unit('hours since 1970-01-01 00:00:00', calendar='gregorian')
>>> cube.coord('time').convert_units(new_unit)
Traceback (most recent call last):
File "", line 1, in
...
ValueError: Unable to convert from 'hours since 1970-01-01 00:00:00' to 'hours since 1970-01-01 00:00:00'.
```

Changing the error message to print the `repr` of the units rather than the `str` makes it more clear why this unit conversion is failing:

```python
>>> new_unit = iris.unit.Unit('days since 1970-01-01 00:00:00', 'gregorian')
>>> cube.coord('time').convert_units(new_unit)
Traceback (most recent call last):
...
ValueError: Unable to convert from 'Unit('hours since 1970-01-01 00:00:00', calendar='360_day')' to 'Unit('days since 1970-01-01 00:00:00', calendar='gregorian')'.
```