@@ -40,26 +40,60 @@ In order to query information for a specific Solar System body, a
40
40
>>> print (obj)
41
41
JPLHorizons instance "Ceres"; location=568, epochs=[2458133.33546], id_type=None
42
42
43
- ``id `` refers to the target identifier and is mandatory; the exact
44
- string will be used in the query to the Horizons system.
45
-
46
- ``location `` means either the observer's location (e.g., Horizons ephemerides
47
- query) or the body relative to which orbital elements are provided (e.g.,
48
- Horizons orbital elements or vectors query); the same codes as `used by Horizons
49
- <https://ssd.jpl.nasa.gov/horizons/manual.html#center> `_ are used here, which
50
- includes `MPC Observatory codes `_. The default is ``location=None ``, which uses
51
- a geocentric location for ephemerides queries and the Sun as central body for
52
- orbital elements and state vector queries. User-defined topocentric locations
53
- for ephemerides queries can be provided, too, in the form of a dictionary. The
54
- dictionary has to be formatted as follows: {``'lon' ``: longitude in degrees
55
- (East positive, West negative), ``'lat' ``: latitude in degrees (North positive,
56
- South negative), ``'elevation' ``: elevation in km above the reference
57
- ellipsoid}. In addition, ``'body' `` can be set to the Horizons body ID of the
58
- central body if different from Earth; by default, it is assumed that this
59
- location is on Earth if it has not been specifically set. The following example
60
- uses the coordinates of the `Statue of Liberty
43
+ ``id `` refers to the target object and is mandatory. ````str `` and ``int `` values
44
+ are valid for all query types. ``Mapping `` (e.g. ``dict ``) values are valid for
45
+ observer (``ephemerides ``) and vectors queries only. ``str `` or ``int `` values will be
46
+ passed directly to Horizons. See the description of the ``id_type `` argument below
47
+ for how Horizons interprets these values. See the paragraph below the description
48
+ of the ``location `` argument for valid ``dict `` formatting.
49
+
50
+ ``location `` refers to the coordinate center for the ephemeris, which has
51
+ slightly different physical interpretations depending on the query type:
52
+ * observer (``ephemerides ``) queries: observer location
53
+ * vectors queries: coordinate origin for vectors
54
+ * elements queries: relative body for orbital elements
55
+ ``str `` and ``int `` values are valid for all query types. ``Mapping ``
56
+ (e.g. ``dict ``) values are valid for observer (``ephemerides ``) and vectors queries only. ``str `` or ``int ``
57
+ arguments will be passed directly to Horizons. See `this section of the Horizons
58
+ manual<https://ssd.jpl.nasa.gov/horizons/manual.html#center> `_ for how Horizons
59
+ interprets coordinate center codes; also note that, unlike ``id ``, these include
60
+ (most) `MPC Observatory codes<https://en.wikipedia.org/wiki/List_of_observatory_codes> `_.
61
+ See below for valid ``dict `` formatting. The default is ``location=None ``,
62
+ which uses Earth body center for observer queries and Sun body center for orbital
63
+ elements and vectors queries.
64
+
65
+ ``dict ``-like arguments to ``id `` or ``location `` define a topocentric location
66
+ relative to a major body. Note that this is not possible for elements queries,
67
+ and will only work for bodies with defined rotation models (Horizons does not
68
+ have rotation models for many small or recently-discovered natural satellites).
69
+ The dictionary has to be formatted as follows: {``'lon' ``: longitude in degrees,
70
+ ``'lat' ``: latitude in degrees (North positive, South negative), ``'elevation' ``:
71
+ elevation in km above the reference ellipsoid, ``body ``: Horizons ID of center body,
72
+ optional; default Earth}.
73
+
74
+ Horizons always interprets longitude values as eastward. However, there are two
75
+ major gotchas in this:
76
+ 1. For most prograde rotators, which is to say most major bodies, Horizons
77
+ interprets west-longitude as positive and east-longitude as negative. However, values
78
+ must still be entered in east-longitude, which means they must be negative; Horizons
79
+ will raise an error if given any positive longitude value for such bodies. Instead enter
80
+ the west-longitude - 360. For instance, a site on Mars (id code 499) at 30 degrees
81
+ longitude, 30 degrees latitude, 0 km elevation should be specified as
82
+ ``{'body': 499, 'elevation': 0, 'lon': -330, 'lat': 30} ``.
83
+ 2. This does not apply to the Earth, Moon, and Sun. Although they are prograde,
84
+ Horizons interprets east-longitude as positive and west-longitude as negative for these
85
+ bodies.
86
+
87
+ Here is a complete list of retrograde major bodies in Horizons: Venus (299), Arial (701),
88
+ Umbriel (702), Titania (703), Oberon (704), Miranda (705), Cordelia (706), Ophelia (707),
89
+ Bianca (708), Cressida (709), Desdemona (710), Juliet (711), Portia (712), Rosalind (713),
90
+ Belinda (714), Puck (715), Uranus (799), Triton (801). All other major bodies are prograde.
91
+
92
+ Two examples of usage for specified topocentric coordinates follow.
93
+
94
+ 1. This observer (``ephemerides ``) query uses the coordinates of the `Statue of Liberty
61
95
<https://www.google.com/maps/place/Statue+of+Liberty+National+Monument/@40.6892534,-74.0466891,17z/data=!3m1!4b1!4m5!3m4!1s0x89c25090129c363d:0x40c6a5770d25022b!8m2!3d40.6892494!4d-74.0445004> `_
62
- as the observer's location:
96
+ as the observer's location, and Ceres as the target :
63
97
64
98
.. doctest-remote-data ::
65
99
@@ -72,6 +106,24 @@ as the observer's location:
72
106
>>> print (obj)
73
107
JPLHorizons instance "Ceres"; location={'lon': -74.0466891, 'lat': 40.6892534, 'elevation': 0.093}, epochs=[2458133.33546], id_type=None
74
108
109
+ 2. Specifying topocentric coordinates for both location and observer is often
110
+ useful when performing geometric calculations for artificial satellites without
111
+ completely-specified ephemeris data. For instance, published reduced data for the
112
+ lunar satellite Chang'e-2 include orbital height and lat/lon. Although there is no published
113
+ ephemeris for Chang'e-2, Horizons (combined with the fact that Chang'e-2 looked nadir),
114
+ can be used to compute vectors from Chang'e-2 to specific points on the lunar surface.
115
+ Here is an example of using ``jplhorizons `` to find the distance from Chang'e-2
116
+ at a particular point in time to the center of the crater Double:
117
+
118
+ .. doctest-remote-data ::
119
+
120
+ >>> ce_2 = {' lon' : 23.522 , ' lat' : 0.637 , ' elevation' : 181.2 , ' body' : 301 }
121
+ >>> double = {' lon' : 23.47 , ' lat' : 0.67 , ' elevation' : 0 , ' body' : 301 }
122
+ >>> obj = Horizons(id = double, location = ce_2, epochs = 2454483.84247 )
123
+ >>> vecs = obj.vectors()
124
+ >>> distance_km = (vecs[' x' ] ** 2 + vecs[' y' ] ** 2 + vecs[' z' ] ** 2 ) ** 0.5 * 1.496e8
125
+ >>> print (round (distance_km.value.data[0 ], 3 ))
126
+ 181.213
75
127
76
128
``epochs `` is either a scalar or list of Julian dates (floats or strings) in the
77
129
case of discrete epochs, or, in the case of a range of epochs, a dictionary that
0 commit comments