1
1
# 1. standard library imports
2
- import numpy as np
2
+
3
3
from collections import OrderedDict
4
4
import re
5
5
import warnings
@@ -25,13 +25,13 @@ class RingNodeClass(BaseQuery):
25
25
"""
26
26
for querying the Planetary Ring Node ephemeris tools
27
27
<https://pds-rings.seti.org/tools/>
28
-
29
-
28
+
29
+
30
30
# basic query for all six targets
31
31
for major_body in ['mars', 'jupiter', 'uranus', 'saturn', 'neptune', 'pluto']:
32
32
nodequery = RingNode(major_body, '2022-05-03 00:00')
33
33
systemtable, bodytable, ringtable = nodequery.ephemeris()
34
-
34
+
35
35
print(' ')
36
36
print(' ')
37
37
print('~'*40)
@@ -40,15 +40,15 @@ class RingNodeClass(BaseQuery):
40
40
print(systemtable)
41
41
print(bodytable)
42
42
print(ringtable)
43
-
44
-
43
+
44
+
45
45
"""
46
46
47
47
TIMEOUT = conf .timeout
48
48
49
49
def __init__ (self , planet = None , obs_time = None ):
50
50
"""Instantiate Planetary Ring Node query
51
-
51
+
52
52
Parameters
53
53
----------
54
54
planet : str, required. one of Jupiter, Saturn, Uranus, or Neptune
@@ -64,7 +64,7 @@ def __init__(self, planet=None, obs_time=None):
64
64
def __str__ (self ):
65
65
"""
66
66
String representation of RingNodeClass object instance'
67
-
67
+
68
68
Examples
69
69
--------
70
70
>>> from astroquery.solarsystem.pds import RingNode
@@ -89,19 +89,19 @@ def ephemeris_async(
89
89
):
90
90
"""
91
91
send query to server
92
-
92
+
93
93
note this interacts with utils.async_to_sync to be called as ephemeris()
94
-
94
+
95
95
Parameters
96
96
----------
97
- self :
97
+ self : RingNodeClass instance
98
98
observer_coords : three-element list/array/tuple of format (lat (deg), lon (deg east), altitude (m))
99
-
99
+
100
100
Returns
101
101
-------
102
102
response : `requests.Response`
103
103
The response of the HTTP request.
104
-
104
+
105
105
Examples
106
106
--------
107
107
>>> from astroquery.solarsystem.pds import RingNode
@@ -138,7 +138,7 @@ def ephemeris_async(
138
138
else :
139
139
try :
140
140
Time .strptime (self .obs_time , "%Y-%m-%d %H:%M" ).jd
141
- except :
141
+ except Exception as e :
142
142
raise ValueError (
143
143
"illegal value for 'obs_time' parameter. must have format 'yyyy-mm-dd hh:mm'"
144
144
)
@@ -153,7 +153,7 @@ def ephemeris_async(
153
153
latitude , longitude , altitude = [float (j ) for j in observer_coords ]
154
154
assert - 90.0 <= latitude <= 90.0
155
155
assert - 360.0 <= longitude <= 360.0
156
- except :
156
+ except Exception as e :
157
157
raise ValueError (
158
158
f"Illegal observatory coordinates { observer_coords } . must be of format [lat(deg), lon(deg east), alt(m)]"
159
159
)
@@ -162,10 +162,6 @@ def ephemeris_async(
162
162
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)"
163
163
)
164
164
165
- """
166
- 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
167
- """
168
-
169
165
# configure request_payload for ephemeris query
170
166
# start with successful query and incrementally de-hardcode stuff
171
167
# thankfully, adding extra planet-specific keywords here does not break query for other planets
@@ -241,7 +237,7 @@ def ephemeris_async(
241
237
def _parse_ringnode (self , src ):
242
238
"""
243
239
Routine for parsing data from ring node
244
-
240
+
245
241
Parameters
246
242
----------
247
243
self : RingNodeClass instance
@@ -307,7 +303,6 @@ def _parse_ringnode(self, src):
307
303
"distance" ,
308
304
),
309
305
)
310
- ## to do: add units!!
311
306
312
307
# ring plane data
313
308
elif group .startswith ("Ring s" ):
@@ -340,7 +335,6 @@ def _parse_ringnode(self, src):
340
335
systemtable ["sub_obs_lon" ] = float (l [1 ].strip (", \n " ))
341
336
else :
342
337
pass
343
- ## to do: add units?
344
338
345
339
# basic info about the planet
346
340
elif group .startswith ("Sun-planet" ):
@@ -364,8 +358,6 @@ def _parse_ringnode(self, src):
364
358
else :
365
359
pass
366
360
367
- ## to do: add units?
368
-
369
361
# --------- below this line, planet-specific info ------------
370
362
# Uranus individual rings data
371
363
elif group .startswith ("Ring " ):
@@ -423,21 +415,21 @@ def _parse_result(self, response, verbose=None):
423
415
"""
424
416
Routine for managing parser calls
425
417
note this MUST be named exactly _parse_result so it interacts with async_to_sync properly
426
-
418
+
427
419
Parameters
428
420
----------
429
421
self : RingNodeClass instance
430
422
response : string
431
423
raw response from server
432
-
424
+
433
425
Returns
434
426
-------
435
427
data : `astropy.Table`
436
428
"""
437
429
self .last_response = response
438
430
try :
439
431
systemtable , bodytable , ringtable = self ._parse_ringnode (response .text )
440
- except :
432
+ except Exception as e :
441
433
try :
442
434
self ._last_query .remove_cache_file (self .cache_location )
443
435
except OSError :
0 commit comments