13
13
from bs4 import BeautifulSoup
14
14
15
15
# 3. local imports - use relative imports
16
- # commonly required local imports shown below as example
17
16
# all Query classes should inherit from BaseQuery.
18
17
from ...query import BaseQuery
19
18
from ...utils import async_to_sync
25
24
@async_to_sync
26
25
class RingNodeClass (BaseQuery ):
27
26
"""
28
- for querying the Planetary Ring Node ephemeris tools
27
+ a class for querying the Planetary Ring Node ephemeris tools
29
28
<https://pds-rings.seti.org/tools/>
30
-
31
29
"""
32
30
33
31
TIMEOUT = conf .timeout
34
32
35
- def __init__ (self , planet = None , obs_time = None ):
36
- """Instantiate Planetary Ring Node query
37
-
38
- Parameters
39
- ----------
40
-
41
- """
42
-
33
+ def __init__ (self ):
34
+ '''
35
+ Instantiate Planetary Ring Node query
36
+ '''
43
37
super ().__init__ ()
44
38
45
39
def __str__ (self ):
46
40
"""
47
- String representation of RingNodeClass object instance
41
+ String representation of `~ RingNodeClass` object instance
48
42
49
43
Examples
50
44
--------
@@ -68,46 +62,61 @@ def ephemeris_async(
68
62
cache = True ,
69
63
):
70
64
"""
71
- send query to server
72
-
73
- note this interacts with utils.async_to_sync to be called as ephemeris()
65
+ send query to Planetary Ring Node server
74
66
75
67
Parameters
76
68
----------
77
- self : RingNodeClass instance
69
+ self : `~ RingNodeClass` instance
78
70
planet : str, required. one of Mars, Jupiter, Saturn, Uranus, Neptune, or Pluto
79
- obs_time : astropy.Time object, or str in format YYYY-MM-DD hh:mm, optional.
80
- If str is provided then UTC is assumed. If no obs_time is provided,
81
- the current time is used.
71
+ obs_time : `~ astropy.Time` object, or str in format YYYY-MM-DD hh:mm, optional.
72
+ If str is provided then UTC is assumed.
73
+ If no obs_time is provided, the current time is used.
82
74
location : array-like, or `~astropy.coordinates.EarthLocation`, optional
83
75
Observer's location as a
84
76
3-element array of Earth longitude, latitude, altitude, or
85
- a `~astropy.coordinates.EarthLocation`. Longitude and
77
+ `~astropy.coordinates.EarthLocation`. Longitude and
86
78
latitude should be anything that initializes an
87
79
`~astropy.coordinates.Angle` object, and altitude should
88
80
initialize an `~astropy.units.Quantity` object (with units
89
- of length). If ``None``, then the geocenter (code 500) is
90
- used.
81
+ of length). If ``None``, then the geocenter is used.
91
82
neptune_arcmodel : float, optional. which ephemeris to assume for Neptune's ring arcs
92
83
must be one of 1, 2, or 3 (see https://pds-rings.seti.org/tools/viewer3_nep.shtml for details)
93
84
has no effect if planet != 'Neptune'
85
+ get_query_payload : boolean, optional
86
+ When set to `True` the method returns the HTTP request parameters as
87
+ a dict, default: False
88
+ get_raw_response : boolean, optional
89
+ Return raw data as obtained by the Planetary Ring Node without parsing the data
90
+ into a table, default: False
91
+
94
92
95
93
Returns
96
94
-------
97
95
response : `requests.Response`
98
96
The response of the HTTP request.
99
97
98
+
100
99
Examples
101
100
--------
102
101
>>> from astroquery.solarsystem.pds import RingNode
103
- >>> nodeobj = RingNode()
104
- >>> eph = obj.ephemeris(planet='Uranus',
105
- ... obs_time='2017-01-01 00:00') # doctest: +SKIP
106
- >>> print(eph) # doctest: +SKIP
107
- table here...
102
+ >>> systemtable, bodytable, ringtable = RingNode().ephemeris(planet='Uranus',
103
+ ... obs_time='2024-05-08 22:39',
104
+ ... location = (-23.029 * u.deg, -67.755 * u.deg, 5000 * u.m)) # doctest: +SKIP
105
+ >>> print(ringtable) # doctest: +SKIP
106
+ ring pericenter ascending node
107
+ deg deg
108
+ ------- ---------- --------------
109
+ Six 293.129 52.0
110
+ Five 109.438 81.1
111
+ Four 242.882 66.9
112
+ Alpha 184.498 253.9
113
+ Beta 287.66 299.2
114
+ Eta 0.0 0.0
115
+ Gamma 50.224 0.0
116
+ Delta 0.0 0.0
117
+ Lambda 0.0 0.0
118
+ Epsilon 298.022 0.0
108
119
"""
109
- planet = planet
110
- obs_time = obs_time
111
120
112
121
URL = conf .pds_server
113
122
# URL = 'https://pds-rings.seti.org/cgi-bin/tools/viewer3_xxx.pl?'
@@ -126,7 +135,7 @@ def ephemeris_async(
126
135
"pluto" ,
127
136
]:
128
137
raise ValueError (
129
- "illegal value for 'planet' parameter (must be 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune', or 'Pluto'"
138
+ "illegal value for 'planet' parameter (must be 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune', or 'Pluto') "
130
139
)
131
140
132
141
if obs_time is None :
@@ -181,7 +190,6 @@ def ephemeris_async(
181
190
)
182
191
183
192
# configure request_payload for ephemeris query
184
- # start with successful query and incrementally de-hardcode stuff
185
193
# thankfully, adding extra planet-specific keywords here does not break query for other planets
186
194
request_payload = OrderedDict (
187
195
[
@@ -262,7 +270,9 @@ def _parse_ringnode(self, src):
262
270
263
271
Returns
264
272
-------
265
- data : `astropy.Table`
273
+ systemtable : dict
274
+ bodytable : `astropy.Table`
275
+ ringtable : `astropy.Table`
266
276
"""
267
277
268
278
self .raw_response = src
@@ -448,7 +458,6 @@ def _parse_ringnode(self, src):
448
458
def _parse_result (self , response , verbose = None ):
449
459
"""
450
460
Routine for managing parser calls
451
- note this MUST be named exactly _parse_result so it interacts with async_to_sync properly
452
461
453
462
Parameters
454
463
----------
@@ -458,7 +467,9 @@ def _parse_result(self, response, verbose=None):
458
467
459
468
Returns
460
469
-------
461
- data : `astropy.Table`
470
+ systemtable : dict
471
+ bodytable : `astropy.Table`
472
+ ringtable : `astropy.Table`
462
473
"""
463
474
self .last_response = response
464
475
try :
@@ -475,7 +486,7 @@ def _parse_result(self, response, verbose=None):
475
486
systemtable ,
476
487
bodytable ,
477
488
ringtable ,
478
- ) # astropy table, astropy table, astropy table
489
+ )
479
490
480
491
481
492
RingNode = RingNodeClass ()
0 commit comments