@@ -37,7 +37,7 @@ def __init__(self, planet=None, obs_time=None):
37
37
38
38
Parameters
39
39
----------
40
-
40
+
41
41
"""
42
42
43
43
super ().__init__ ()
@@ -53,7 +53,7 @@ def __str__(self):
53
53
>>> print(nodeobj) # doctest: +SKIP
54
54
PDSRingNode instance
55
55
"""
56
- return ' PDSRingNode instance'
56
+ return " PDSRingNode instance"
57
57
58
58
# --- pretty stuff above this line, get it working below this line ---
59
59
@@ -76,8 +76,8 @@ def ephemeris_async(
76
76
----------
77
77
self : RingNodeClass instance
78
78
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,
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
81
the current time is used.
82
82
location : array-like, or `~astropy.coordinates.EarthLocation`, optional
83
83
Observer's location as a
@@ -141,7 +141,7 @@ def ephemeris_async(
141
141
)
142
142
elif type (obs_time ) == Time :
143
143
try :
144
- obs_time = obs_time .utc .to_value (' iso' , subfmt = ' date_hm' )
144
+ obs_time = obs_time .utc .to_value (" iso" , subfmt = " date_hm" )
145
145
except Exception as e :
146
146
raise ValueError (
147
147
"illegal value for 'obs_time' parameter. could not parse astropy.time.core.Time object into format 'yyyy-mm-dd hh:mm' (UTC)"
@@ -154,25 +154,27 @@ def ephemeris_async(
154
154
else :
155
155
viewpoint = "latlon"
156
156
if type (location ) != EarthLocation :
157
- if hasattr (location , ' __iter__' ):
157
+ if hasattr (location , " __iter__" ):
158
158
if len (location ) != 3 :
159
159
raise ValueError (
160
160
"location arrays require three values:"
161
- " longitude, latitude, and altitude" )
161
+ " longitude, latitude, and altitude"
162
+ )
162
163
else :
163
164
raise TypeError (
164
- "location must be array-like or astropy EarthLocation" )
165
-
165
+ "location must be array-like or astropy EarthLocation"
166
+ )
167
+
166
168
if isinstance (location , EarthLocation ):
167
169
loc = location .geodetic
168
170
longitude = loc [0 ].deg
169
171
latitude = loc [1 ].deg
170
172
altitude = loc [2 ].to (u .m ).value
171
- elif hasattr (location , ' __iter__' ):
172
- longitude = Angle (location [0 ]).deg
173
- latitude = Angle (location [1 ]).deg
174
- altitude = u .Quantity (location [2 ]).to ('m' ).value
175
-
173
+ elif hasattr (location , " __iter__" ):
174
+ latitude = Angle (location [0 ]).deg
175
+ longitude = Angle (location [1 ]).deg
176
+ altitude = u .Quantity (location [2 ]).to ("m" ).value
177
+
176
178
if int (neptune_arcmodel ) not in [1 , 2 , 3 ]:
177
179
raise ValueError (
178
180
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)"
@@ -183,12 +185,9 @@ def ephemeris_async(
183
185
# thankfully, adding extra planet-specific keywords here does not break query for other planets
184
186
request_payload = OrderedDict (
185
187
[
186
- ("abbrev" , planet [:3 ]),
187
- (
188
- "ephem" ,
189
- conf .planet_defaults [planet ]["ephem" ],
190
- ), # change hardcoding for other planets
191
- ("time" , obs_time ), #UTC. this should be enforced when checking inputs
188
+ ("abbrev" , planet .lower ()[:3 ]),
189
+ ("ephem" , conf .planet_defaults [planet ]["ephem" ],),
190
+ ("time" , obs_time ), # UTC. this should be enforced when checking inputs
192
191
(
193
192
"fov" ,
194
193
10 ,
@@ -297,17 +296,10 @@ def _parse_ringnode(self, src):
297
296
"dRA" ,
298
297
"dDec" ,
299
298
),
300
- )
301
- units_list = [None ,
302
- None ,
303
- None ,
304
- None ,
305
- u .deg ,
306
- u .deg ,
307
- u .arcsec ,
308
- u .arcsec ]
309
- bodytable = table .QTable (bodytable , units = units_list )
310
- #for i in range(len(bodytable.colnames)):
299
+ )
300
+ units_list = [None , None , None , None , u .deg , u .deg , u .arcsec , u .arcsec ]
301
+ bodytable = table .QTable (bodytable , units = units_list )
302
+ # for i in range(len(bodytable.colnames)):
311
303
# bodytable[bodytable.colnames[i]].unit = units_list[i]
312
304
# minor body table part 2
313
305
elif group .startswith ("Sub-" ):
@@ -327,18 +319,11 @@ def _parse_ringnode(self, src):
327
319
"sub_sun_lat" ,
328
320
"phase" ,
329
321
"distance" ,
330
- ))
331
- units_list = [
332
- None ,
333
- None ,
334
- u .deg ,
335
- u .deg ,
336
- u .deg ,
337
- u .deg ,
338
- u .deg ,
339
- u .km * 1e6 ]
340
- bodytable2 = table .QTable (bodytable2 , units = units_list )
341
- #for i in range(len(bodytable2.colnames)):
322
+ ),
323
+ )
324
+ units_list = [None , None , u .deg , u .deg , u .deg , u .deg , u .deg , u .km * 1e6 ]
325
+ bodytable2 = table .QTable (bodytable2 , units = units_list )
326
+ # for i in range(len(bodytable2.colnames)):
342
327
# bodytable2[bodytable2.colnames[i]].unit = units_list[i]
343
328
344
329
# ring plane data
@@ -359,15 +344,15 @@ def _parse_ringnode(self, src):
359
344
}
360
345
361
346
elif "Ring plane opening angle" in l [0 ]:
362
- systemtable ["opening_angle" ] = float (
363
- re .sub ("[a-zA-Z]+" , "" , l [1 ]).strip (", \n ()" )
364
- ) * u . deg
347
+ systemtable ["opening_angle" ] = (
348
+ float ( re .sub ("[a-zA-Z]+" , "" , l [1 ]).strip (", \n ()" )) * u . deg
349
+ )
365
350
elif "Ring center phase angle" in l [0 ]:
366
351
systemtable ["phase_angle" ] = float (l [1 ].strip (", \n " )) * u .deg
367
352
elif "Sub-solar longitude" in l [0 ]:
368
- systemtable ["sub_sun_lon" ] = float (
369
- re .sub ("[a-zA-Z]+" , "" , l [1 ]).strip (", \n ()" )
370
- ) * u . deg
353
+ systemtable ["sub_sun_lon" ] = (
354
+ float ( re .sub ("[a-zA-Z]+" , "" , l [1 ]).strip (", \n ()" )) * u . deg
355
+ )
371
356
elif "Sub-observer longitude" in l [0 ]:
372
357
systemtable ["sub_obs_lon" ] = float (l [1 ].strip (", \n " )) * u .deg
373
358
else :
@@ -379,10 +364,10 @@ def _parse_ringnode(self, src):
379
364
for line in lines :
380
365
l = line .split (":" )
381
366
if "Sun-planet distance (AU)" in l [0 ]:
382
- #systemtable["d_sun_AU"] = float(l[1].strip(", \n"))
367
+ # systemtable["d_sun_AU"] = float(l[1].strip(", \n"))
383
368
pass
384
369
elif "Observer-planet distance (AU)" in l [0 ]:
385
- #systemtable["d_obs_AU"] = float(l[1].strip(", \n"))
370
+ # systemtable["d_obs_AU"] = float(l[1].strip(", \n"))
386
371
pass
387
372
elif "Sun-planet distance (km)" in l [0 ]:
388
373
systemtable ["d_sun" ] = (
@@ -405,11 +390,12 @@ def _parse_ringnode(self, src):
405
390
format = "fixed_width" ,
406
391
col_starts = (5 , 18 , 29 ),
407
392
col_ends = (18 , 29 , 36 ),
408
- names = ("ring" , "pericenter" , "ascending node" ))
409
-
410
- units_list = [None , u .deg , u .deg ]
411
- ringtable = table .QTable (ringtable , units = units_list )
412
-
393
+ names = ("ring" , "pericenter" , "ascending node" ),
394
+ )
395
+
396
+ units_list = [None , u .deg , u .deg ]
397
+ ringtable = table .QTable (ringtable , units = units_list )
398
+
413
399
# Saturn F-ring data
414
400
elif group .startswith ("F Ring" ):
415
401
lines = group .split ("\n " )
@@ -422,7 +408,7 @@ def _parse_ringnode(self, src):
422
408
ringtable = table .Table (
423
409
[["F" ], [peri ], [ascn ]],
424
410
names = ("ring" , "pericenter" , "ascending node" ),
425
- units = (None , u .deg , u .deg )
411
+ units = (None , u .deg , u .deg ),
426
412
)
427
413
428
414
# Neptune ring arcs data
@@ -439,24 +425,23 @@ def _parse_ringnode(self, src):
439
425
ringtable = table .Table (
440
426
[[ring ], [min_angle ], [max_angle ]],
441
427
names = ("ring" , "min_angle" , "max_angle" ),
442
- units = (None , u .deg , u .deg )
428
+ units = (None , u .deg , u .deg ),
443
429
)
444
430
else :
445
431
ringtable .add_row ([ring , min_angle , max_angle ])
446
432
447
433
else :
448
434
pass
449
435
450
- #
451
- ## do some cleanup from the parsing job
452
- #
436
+ # do some cleanup from the parsing job
453
437
ringtable .add_index ("ring" )
454
-
455
- bodytable = table .join (bodytable , bodytable2 ) # concatenate minor body table
438
+
439
+ bodytable = table .join (bodytable , bodytable2 ) # concatenate minor body table
456
440
bodytable .add_index ("Body" )
457
-
458
- systemtable ["obs_time" ] = Time (obs_time , format = 'iso' , scale = 'utc' ) # add obs time to systemtable
459
-
441
+
442
+ systemtable ["obs_time" ] = Time (
443
+ obs_time , format = "iso" , scale = "utc"
444
+ ) # add obs time to systemtable
460
445
461
446
return systemtable , bodytable , ringtable
462
447
0 commit comments