@@ -69,13 +69,20 @@ def __str__(self):
69
69
# --- pretty stuff above this line, get it working below this line ---
70
70
71
71
def ephemeris_async (self ,
72
+ observer_coords = None ,
73
+ neptune_arcmodel = 3 ,
72
74
get_query_payload = False ,
73
75
get_raw_response = False ,
74
76
cache = True ):
75
77
'''
76
78
send query to server
77
79
78
80
note this interacts with utils.async_to_sync to be called as ephemeris()
81
+
82
+ Parameters
83
+ ----------
84
+ self :
85
+ observer_coords : three-element list/array/tuple of format (lat (deg), lon (deg east), altitude (m))
79
86
80
87
Returns
81
88
-------
@@ -95,14 +102,28 @@ def ephemeris_async(self,
95
102
URL = conf .pds_server
96
103
#URL = 'https://pds-rings.seti.org/cgi-bin/tools/viewer3_xxx.pl?'
97
104
98
- # check for required information
105
+ # check inputs and set defaults for optional inputs
99
106
if self .planet is None :
100
107
raise ValueError ("'planet' parameter not set. Query aborted." )
101
108
if self .obs_time is None :
102
109
self .obs_time = Time .now ().jd
110
+ if observer_coords is None :
111
+ viewpoint = 'observatory'
112
+ latitude , longitude , altitude = '' , '' , ''
113
+ else :
114
+ viewpoint = 'latlon'
115
+ try :
116
+ latitude , longitude , altitude = [float (j ) for j in observer_coords ]
117
+ assert - 90. <= latitude <= 90.
118
+ assert - 360. <= longitude <= 360.
119
+ except :
120
+ raise ValueError (f"Illegal observatory coordinates { observer_coords } . must be of format [lat(deg), lon(deg east), alt(m)]" )
121
+ if neptune_arcmodel not in [1 ,2 ,3 ]:
122
+ raise ValueError (f"Illegal Neptune arc model { neptune_arcmodel } . must be one of 1, 2, or 3 (see https://pds-rings.seti.org/tools/viewer3_nep.shtml for details)" )
103
123
104
- '''
105
- https://pds-rings.seti.org/cgi-bin/tools/viewer3_xxx.pl?abbrev=jup&ephem=000+JUP365+%2B+DE440&time=2021-10-07+07%3A25&fov=10&fov_unit=Jupiter+radii¢er=body¢er_body=Jupiter¢er_ansa=Main+Ring¢er_ew=east¢er_ra=¢er_ra_type=hours¢er_dec=¢er_star=&viewpoint=observatory&observatory=Earth%27s+center&latitude=&longitude=&lon_dir=east&altitude=&moons=516+All+inner+moons+%28J1-J5%2CJ14-J16%29&rings=Main+%26+Gossamer&torus_inc=6.8&torus_rad=422000&extra_ra=&extra_ra_type=hours&extra_dec=&extra_name=&title=&labels=Small+%286+points%29&moonpts=0&blank=No&meridians=Yes&output=HTML
124
+
125
+ '''
126
+ https://pds-rings.seti.org/cgi-bin/tools/viewer3_xxx.pl?abbrev=nep&ephem=000+NEP081+%2B+NEP095+%2B+DE440&time=2020-01-01+00%3A00&fov=10&fov_unit=Neptune+radii¢er=body¢er_body=Neptune¢er_ansa=Adams+Ring¢er_ew=east¢er_ra=¢er_ra_type=hours¢er_dec=¢er_star=&observatory=Earth%27s+center&viewpoint=latlon&latitude=19.827&longitude=-155.472&lon_dir=east&altitude=4216&moons=814+All+inner+moons+%28N1-N8%2CN14%29&rings=Galle%2C+LeVerrier%2C+Arago%2C+Adams&arcmodel=%233+%28820.1121+deg%2Fday%29&extra_ra=&extra_ra_type=hours&extra_dec=&extra_name=&title=&labels=Small+%286+points%29&moonpts=0&blank=No&arcpts=4&meridians=Yes&output=HTML
106
127
'''
107
128
108
129
# configure request_payload for ephemeris query
@@ -112,7 +133,7 @@ def ephemeris_async(self,
112
133
('abbrev' , self .planet [:3 ]),
113
134
('ephem' , conf .planet_defaults [self .planet ]['ephem' ]), # change hardcoding for other planets
114
135
('time' , self .obs_time ),
115
- ('fov' , 10 ), #for now do not care about the diagram. next few hardcoded
136
+ ('fov' , 10 ), #next few are figure options, can be hardcoded and ignored
116
137
('fov_unit' , self .planet .capitalize ()+ ' radii' ),
117
138
('center' , 'body' ),
118
139
('center_body' , self .planet .capitalize ()),
@@ -122,16 +143,16 @@ def ephemeris_async(self,
122
143
('center_ra_type' , 'hours' ),
123
144
('center_dec' , '' ),
124
145
('center_star' , '' ),
125
- ('viewpoint' , 'observatory' ), # de-hardcode later!
126
- ('observatory' , "Earth's center" ), # de-hardcode later!
127
- ('latitude' ,'' ), # de-hardcode later!
128
- ('longitude' ,'' ), # de-hardcode later!
129
- ('lon_dir' ,'' ), # de-hardcode later!
130
- ('altitude' ,'' ), # de-hardcode later!
131
- ('moons' ,conf .planet_defaults [self .planet ]['moons' ]), # change hardcoding for other planets
132
- ('rings' ,conf .planet_defaults [self .planet ]['rings' ]), # check if this works for other planets
133
- ('arcmodel' ,'#3 (820.1121 deg/day)' ), # check if this works for other planets
134
- ('extra_ra' ,'' ), # diagram stuff. next few can be hardcoded
146
+ ('viewpoint' , viewpoint ),
147
+ ('observatory' , "Earth's center" ), # has no effect if viewpoint != observatory so can hardcode. no plans to implement calling observatories by name since ring node only names like 8 observatories
148
+ ('latitude' ,latitude ),
149
+ ('longitude' ,longitude ),
150
+ ('lon_dir' ,'east ' ),
151
+ ('altitude' ,altitude ),
152
+ ('moons' ,conf .planet_defaults [self .planet ]['moons' ]),
153
+ ('rings' ,conf .planet_defaults [self .planet ]['rings' ]),
154
+ ('arcmodel' ,conf . neptune_arcmodels [ neptune_arcmodel ]),
155
+ ('extra_ra' ,'' ), # figure options below this line, can all be hardcoded and ignored
135
156
('extra_ra_type' ,'hours' ),
136
157
('extra_dec' ,'' ),
137
158
('extra_name' ,'' ),
@@ -269,7 +290,7 @@ def _parse_ringnode(self, src):
269
290
names = ('ring' , 'pericenter' , 'ascending node' )
270
291
)
271
292
272
- # Saturn F-ring data - NEEDS TESTING
293
+ # Saturn F-ring data
273
294
elif group .startswith ('F Ring' ):
274
295
lines = group .split ('\n ' )
275
296
for line in lines :
@@ -280,7 +301,7 @@ def _parse_ringnode(self, src):
280
301
ascn = float (l [1 ].strip (', \n ' ))
281
302
ringtable = table .Table ([['F' ], [peri ], [ascn ]], names = ('ring' , 'pericenter' , 'ascending node' ))
282
303
283
- # Neptune ring arcs data - NEEDS TESTING
304
+ # Neptune ring arcs data
284
305
elif group .startswith ('Courage' ):
285
306
lines = group .split ('\n ' )
286
307
for i in range (len (lines )):
@@ -334,7 +355,11 @@ def _parse_result(self, response, verbose = None):
334
355
335
356
# single basic query
336
357
neptune = RingNodeClass ('Neptune' , '2019-10-28 00:00' )
337
- systemtable , bodytable , ringtable = neptune .ephemeris ()
358
+ systemtable , bodytable , ringtable = neptune .ephemeris (neptune_arcmodel = 2 , observer_coords = (10.0 , - 120.355 , 1000 ))
359
+ print (systemtable )
360
+ print (bodytable )
361
+ print (ringtable )
362
+
338
363
339
364
'''
340
365
# basic query for all six targets
0 commit comments