1
1
# 1. standard library imports
2
-
3
2
import re
4
- import warnings
5
3
6
4
# 2. third party imports
7
5
from astropy .time import Time
8
6
from astropy import table
9
- from astropy .io import ascii
10
7
import astropy .units as u
11
8
from astropy .coordinates import EarthLocation , Angle
12
9
from bs4 import BeautifulSoup
@@ -282,14 +279,15 @@ def _parse_result(self, response, verbose=None):
282
279
283
280
# minor body table part 2
284
281
elif group .startswith ("Sub-" ):
285
- group = " \n " . join ( group . split ( " \n " )[ 1 :]) # fixing two-row header
286
- group = "NAIF" + group [ 4 :]
282
+
283
+ group = "\n " . join ( group . split ( " \n " )[ 2 :]) # removing two-row header entirely
287
284
bodytable2_names = ("NAIF ID" , "Body" , "sub_obs_lon" , "sub_obs_lat" , "sub_sun_lon" , "sub_sun_lat" , "phase" , "distance" )
288
285
bodytable2_units = [None , None , u .deg , u .deg , u .deg , u .deg , u .deg , u .km * 1e6 ]
289
286
bodytable2 = table .QTable .read (group , format = "ascii.fixed_width" ,
290
287
col_starts = (0 , 4 , 18 , 28 , 37 , 49 , 57 , 71 ),
291
288
col_ends = (4 , 18 , 28 , 37 , 49 , 57 , 71 , 90 ),
292
- names = bodytable2_names )
289
+ names = bodytable2_names ,
290
+ data_start = 0 )
293
291
# units=(bodytable_units)) # this much cleaner way of adding units is supported in later versions but not in 3.7
294
292
for name , unit in zip (bodytable2_names , bodytable2_units ):
295
293
bodytable2 [name ].unit = unit
@@ -370,11 +368,14 @@ def _parse_result(self, response, verbose=None):
370
368
peri = float (re .sub ("[a-zA-Z]+" , "" , l [1 ]).strip (", \n ()" ))
371
369
elif "F Ring ascending node" in l [0 ]:
372
370
ascn = float (l [1 ].strip (", \n " ))
371
+ ringtable_names = ("ring" , "pericenter" , "ascending node" )
372
+ ringtable_units = [None , u .deg , u .deg ]
373
373
ringtable = table .QTable (
374
374
[["F" ], [peri ], [ascn ]],
375
- names = ("ring" , "pericenter" , "ascending node" ),
376
- units = (None , u .deg , u .deg ),
377
- )
375
+ names = ringtable_names )
376
+ # units=(ringtable_units) # this much cleaner way of adding units is supported in later versions but not in 3.7
377
+ for name , unit in zip (ringtable_names , ringtable_units ):
378
+ ringtable [name ].unit = unit
378
379
379
380
# Neptune ring arcs data
380
381
elif group .startswith ("Courage" ):
@@ -387,11 +388,14 @@ def _parse_result(self, response, verbose=None):
387
388
for s in re .sub ("[a-zA-Z]+" , "" , l [1 ]).strip (", \n ()" ).split ()
388
389
]
389
390
if i == 0 :
391
+ ringtable_names = ("ring" , "min_angle" , "max_angle" )
392
+ ringtable_units = [None , u .deg , u .deg ]
390
393
ringtable = table .QTable (
391
394
[[ring ], [min_angle ], [max_angle ]],
392
- names = ("ring" , "min_angle" , "max_angle" ),
393
- units = (None , u .deg , u .deg ),
394
- )
395
+ names = ringtable_names )
396
+ for name , unit in zip (ringtable_names , ringtable_units ):
397
+ ringtable [name ].unit = unit
398
+ # units=(ringtable_units) # this much cleaner way of adding units is supported in later versions but not in 3.7
395
399
else :
396
400
ringtable .add_row ([ring , min_angle * u .deg , max_angle * u .deg ])
397
401
0 commit comments