@@ -270,21 +270,29 @@ def _parse_result(self, response, verbose=None):
270
270
# minor body table part 1
271
271
elif group .startswith ("Body" ):
272
272
group = "NAIF " + group # fixing lack of header for NAIF ID
273
+ bodytable_names = ("NAIF ID" , "Body" , "RA" , "Dec" , "RA (deg)" , "Dec (deg)" , "dRA" , "dDec" )
274
+ bodytable_units = [None , None , None , None , u .deg , u .deg , u .arcsec , u .arcsec ]
273
275
bodytable = table .QTable .read (group , format = "ascii.fixed_width" ,
274
276
col_starts = (0 , 4 , 18 , 35 , 54 , 68 , 80 , 91 ),
275
277
col_ends = (4 , 18 , 35 , 54 , 68 , 80 , 91 , 102 ),
276
- names = ("NAIF ID" , "Body" , "RA" , "Dec" , "RA (deg)" , "Dec (deg)" , "dRA" , "dDec" ),
277
- units = ([None , None , None , None , u .deg , u .deg , u .arcsec , u .arcsec ]))
278
+ names = bodytable_names )
279
+ # units=(bodytable_units)) # this much cleaner way of adding units is supported in later versions but not in 3.7
280
+ for name , unit in zip (bodytable_names , bodytable_units ):
281
+ bodytable [name ].unit = unit
278
282
279
283
# minor body table part 2
280
284
elif group .startswith ("Sub-" ):
281
285
group = "\n " .join (group .split ("\n " )[1 :]) # fixing two-row header
282
286
group = "NAIF" + group [4 :]
287
+ bodytable2_names = ("NAIF ID" , "Body" , "sub_obs_lon" , "sub_obs_lat" , "sub_sun_lon" , "sub_sun_lat" , "phase" , "distance" )
288
+ bodytable2_units = [None , None , u .deg , u .deg , u .deg , u .deg , u .deg , u .km * 1e6 ]
283
289
bodytable2 = table .QTable .read (group , format = "ascii.fixed_width" ,
284
290
col_starts = (0 , 4 , 18 , 28 , 37 , 49 , 57 , 71 ),
285
291
col_ends = (4 , 18 , 28 , 37 , 49 , 57 , 71 , 90 ),
286
- names = ("NAIF ID" , "Body" , "sub_obs_lon" , "sub_obs_lat" , "sub_sun_lon" , "sub_sun_lat" , "phase" , "distance" ),
287
- units = ([None , None , u .deg , u .deg , u .deg , u .deg , u .deg , u .km * 1e6 ]))
292
+ names = bodytable2_names )
293
+ # units=(bodytable_units)) # this much cleaner way of adding units is supported in later versions but not in 3.7
294
+ for name , unit in zip (bodytable2_names , bodytable2_units ):
295
+ bodytable2 [name ].unit = unit
288
296
289
297
# ring plane data
290
298
elif group .startswith ("Ring s" ):
@@ -293,7 +301,7 @@ def _parse_result(self, response, verbose=None):
293
301
l = line .split (":" )
294
302
if "Ring sub-solar latitude" in l [0 ]:
295
303
[sub_sun_lat , sub_sun_lat_min , sub_sun_lat_max ] = [
296
- float (s .strip (", \n ()" )) for s in re .split ("\(|to" , l [1 ])
304
+ float (s .strip (", \n ()" )) for s in re .split (r "\(|to" , l [1 ])
297
305
]
298
306
systemtable = {
299
307
"sub_sun_lat" : sub_sun_lat * u .deg ,
@@ -343,11 +351,15 @@ def _parse_result(self, response, verbose=None):
343
351
# --------- below this line, planet-specific info ------------
344
352
# Uranus individual rings data
345
353
elif group .startswith ("Ring " ):
354
+ ringtable_names = ("ring" , "pericenter" , "ascending node" )
355
+ ringtable_units = [None , u .deg , u .deg ]
346
356
ringtable = table .QTable .read (" " + group , format = "ascii.fixed_width" ,
347
357
col_starts = (5 , 18 , 29 ),
348
358
col_ends = (18 , 29 , 36 ),
349
- names = ("ring" , "pericenter" , "ascending node" ),
350
- units = ([None , u .deg , u .deg ]))
359
+ names = ringtable_names )
360
+ # units=(ringtable_units)) # this much cleaner way of adding units is supported in later versions but not in 3.7
361
+ for name , unit in zip (ringtable_names , ringtable_units ):
362
+ ringtable [name ].unit = unit
351
363
352
364
# Saturn F-ring data
353
365
elif group .startswith ("F Ring" ):
0 commit comments