astropy/astropy — pull request #2846 by bsipocz (2014-08-10 22:15:36+00:00)
Title: Coordinates accept space separated <6 values

This PR adds back the support for space separated sky coordinate values using the sign as separator when <6 values are given. This was once supported, and I couldn't find whether it was deliberately taken out or just by accident in #2586. If the former please close the PR.
It also adds the support for the format when seconds are missing, but the minute value is a float.
I had to make changed to the ``_AngleParser`` class, but left the PLY generated stuff in ``angle_parsetab.py`` untouched as everything seemed to be working.

The use case motivation behind this was querying a region for objects in Simbad. It give back a list with the coordinates space separated, and sometimes with less than 6 values:

cc @eteq, @taldcroft
```
In [2]: astropy.__version__
Out[2]: u'1.0.dev9597'

In [3]: from astroquery.simbad import Simbad
WARNING: ConfigurationDefaultMissingWarning: Could not determine version of package astroquery Cannot install default profile. If you are importing from source, this is expected. [astroquery._astropy_init]
WARNING: AstropyDeprecationWarning: ConfigurationItem has been deprecated in astropy 0.4. Use ConfigItem objects as members of ConfigNamespace subclasses instead. See ConfigNamespace for an example. [astropy.config.configuration]

In [4]: import astropy.units as u

In [5]: obj_list = Simbad.query_region(coordinates='08:51:18 +11 48 00')
WARNING: AstropyDeprecationWarning: The format function is deprecated and may be removed in a future version.
Use to_string instead. [astropy.utils.misc]
WARNING: AstropyDeprecationWarning: The format function is deprecated and may be removed in a future version.
Use to_string instead. [astropy.utils.misc]

In [6]: ra=obj_list['RA']

In [7]: dec=obj_list['DEC']

In [8]: from astropy.coordinates import *

In [9]: Angle(dec, unit=u.deg).deg
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
in ()
----> 1 Angle(dec, unit=u.deg).deg

/Users/bsipocz/munka/devel/astropy/astropy/coordinates/angles.py in __new__(cls, angle, unit, dtype, copy)
116 not (isinstance(angle, np.ndarray) and
117 angle.dtype.kind not in 'SUVO')):
--> 118 angle = [Angle(x, unit) for x in angle]
119 if unit is None:
120 unit = angle[0].unit

/Users/bsipocz/munka/devel/astropy/astropy/coordinates/angles.py in __new__(cls, angle, unit, dtype, copy)
107
108 if isinstance(angle, six.string_types):
--> 109 angle, new_unit = util.parse_angle(angle, unit)
110 if new_unit is not None and unit is None:
111 unit = new_unit

/Users/bsipocz/munka/devel/astropy/astropy/coordinates/angle_utilities.py in parse_angle(angle, unit, debug)
345 string.
346 """
--> 347 return _AngleParser().parse(angle, unit, debug=debug)
348
349

/Users/bsipocz/munka/devel/astropy/astropy/coordinates/angle_utilities.py in parse(self, angle, unit, debug)
261 else:
262 raise ValueError(
--> 263 "Syntax error parsing angle {0!r}".format(angle))
264
265 if unit is None and found_unit is None:

ValueError: Syntax error parsing angle '+11 48.0'
```
```
In [15]: print obj_list[0:3]
MAIN_ID RA DEC RA_PREC ... COO_ERR_ANGLE COO_QUAL COO_WAVELENGTH COO_BIBCODE
"h:m:s" "d:m:s" ... deg
----------------------- ------------- ------------- ------- ... ------------- -------- -------------- -------------------
M 67 08 51 18 +11 48.0 4 ... 0 E 2005ApJ...619..824X
2MASS J08511918+1147546 08 51 19.1817 +11 47 54.708 8 ... 90 B O 2006A&A...448.1235D
** BPM 480BE 08 51 19.19 +11 47 54.8 6 ... 0 D O 2001AJ....122.3466M

```