astropy/astropy — pull request #1928 by mhvk (2013-12-23 18:07:30+00:00)
Title: EarthLocation class for Time

Triggered by #1924 and its follow-up, I decided to make `Time` take heights or a simple `EarthLocation` class. I realise that this may well need to be a bit more complicated, but the pulsar timing work provides a case where it is good to have something that works now. As written, the `EarthLocation` class is a subclass from `CartesianPoints`, with the only addition that it can convert from and to geodetic coordinates using the `erfa` routines `gd2gc` and `gc2gd` (the former was already there; the latter is now included in `erfa_time`). Example:
```
In [1]: from astropy.time import Time, TimeDelta; import astropy.units as u
In [2]: t = Time('2010-01-01', scale='utc', lon='-75d', lat='30d', height=300 * u.m)
In [3]: t.location, t.lon, t.lat, t.height
Out[3]:
(,
,
,
)

In [4]: t = Time('2010-01-01', scale='utc', location=(1e4 * u.m, 1e3 * u.m, 1e3 * u.m))
In [5]: t.location, t.lon, t.lat, t.height
Out[5]:
(,
,
,
)
```

@eteq: as you started with a `Location` class as well, could you check whether you think my approach makes sense? I think for now, since the locations are only used internally, a simple approach should be fine, but we should ensure that it doesn't preclude a more complete implementation later on. Also, do you have a suggestion for where this should live?

@taldcroft: do you think the suggested changes to `Time` are OK?

@scottransom: would this fulfill the requirements for PINT?

p.s. This supercedes #1927, but is complementary to #1925

p.s.2 This still needs docstrings for the `EarthLocation` class, as well as test cases and an update to the `Time` documentation. Will do if it is agreed that this is the right approach.