Skip to content

Commit b7d2751

Browse files
Edward Molterbsipocz
authored andcommitted
attempted to fix all pep8 problems
1 parent ae97eb9 commit b7d2751

File tree

3 files changed

+23
-31
lines changed

3 files changed

+23
-31
lines changed

astroquery/solarsystem/pds/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Conf(_config.ConfigNamespace):
1515

1616
# server settings
1717
pds_server = _config.ConfigItem(
18-
["https://pds-rings.seti.org/cgi-bin/tools/viewer3_xxx.pl?",], "Ring Node"
18+
["https://pds-rings.seti.org/cgi-bin/tools/viewer3_xxx.pl?"], "Ring Node"
1919
)
2020

2121
# implement later: other pds tools

astroquery/solarsystem/pds/core.py

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# 1. standard library imports
2-
import numpy as np
2+
33
from collections import OrderedDict
44
import re
55
import warnings
@@ -25,13 +25,13 @@ class RingNodeClass(BaseQuery):
2525
"""
2626
for querying the Planetary Ring Node ephemeris tools
2727
<https://pds-rings.seti.org/tools/>
28-
29-
28+
29+
3030
# basic query for all six targets
3131
for major_body in ['mars', 'jupiter', 'uranus', 'saturn', 'neptune', 'pluto']:
3232
nodequery = RingNode(major_body, '2022-05-03 00:00')
3333
systemtable, bodytable, ringtable = nodequery.ephemeris()
34-
34+
3535
print(' ')
3636
print(' ')
3737
print('~'*40)
@@ -40,15 +40,15 @@ class RingNodeClass(BaseQuery):
4040
print(systemtable)
4141
print(bodytable)
4242
print(ringtable)
43-
44-
43+
44+
4545
"""
4646

4747
TIMEOUT = conf.timeout
4848

4949
def __init__(self, planet=None, obs_time=None):
5050
"""Instantiate Planetary Ring Node query
51-
51+
5252
Parameters
5353
----------
5454
planet : str, required. one of Jupiter, Saturn, Uranus, or Neptune
@@ -64,7 +64,7 @@ def __init__(self, planet=None, obs_time=None):
6464
def __str__(self):
6565
"""
6666
String representation of RingNodeClass object instance'
67-
67+
6868
Examples
6969
--------
7070
>>> from astroquery.solarsystem.pds import RingNode
@@ -89,19 +89,19 @@ def ephemeris_async(
8989
):
9090
"""
9191
send query to server
92-
92+
9393
note this interacts with utils.async_to_sync to be called as ephemeris()
94-
94+
9595
Parameters
9696
----------
97-
self :
97+
self : RingNodeClass instance
9898
observer_coords : three-element list/array/tuple of format (lat (deg), lon (deg east), altitude (m))
99-
99+
100100
Returns
101101
-------
102102
response : `requests.Response`
103103
The response of the HTTP request.
104-
104+
105105
Examples
106106
--------
107107
>>> from astroquery.solarsystem.pds import RingNode
@@ -138,7 +138,7 @@ def ephemeris_async(
138138
else:
139139
try:
140140
Time.strptime(self.obs_time, "%Y-%m-%d %H:%M").jd
141-
except:
141+
except Exception as e:
142142
raise ValueError(
143143
"illegal value for 'obs_time' parameter. must have format 'yyyy-mm-dd hh:mm'"
144144
)
@@ -153,7 +153,7 @@ def ephemeris_async(
153153
latitude, longitude, altitude = [float(j) for j in observer_coords]
154154
assert -90.0 <= latitude <= 90.0
155155
assert -360.0 <= longitude <= 360.0
156-
except:
156+
except Exception as e:
157157
raise ValueError(
158158
f"Illegal observatory coordinates {observer_coords}. must be of format [lat(deg), lon(deg east), alt(m)]"
159159
)
@@ -162,10 +162,6 @@ def ephemeris_async(
162162
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)"
163163
)
164164

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&center=body&center_body=Neptune&center_ansa=Adams+Ring&center_ew=east&center_ra=&center_ra_type=hours&center_dec=&center_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-
169165
# configure request_payload for ephemeris query
170166
# start with successful query and incrementally de-hardcode stuff
171167
# thankfully, adding extra planet-specific keywords here does not break query for other planets
@@ -241,7 +237,7 @@ def ephemeris_async(
241237
def _parse_ringnode(self, src):
242238
"""
243239
Routine for parsing data from ring node
244-
240+
245241
Parameters
246242
----------
247243
self : RingNodeClass instance
@@ -307,7 +303,6 @@ def _parse_ringnode(self, src):
307303
"distance",
308304
),
309305
)
310-
## to do: add units!!
311306

312307
# ring plane data
313308
elif group.startswith("Ring s"):
@@ -340,7 +335,6 @@ def _parse_ringnode(self, src):
340335
systemtable["sub_obs_lon"] = float(l[1].strip(", \n"))
341336
else:
342337
pass
343-
## to do: add units?
344338

345339
# basic info about the planet
346340
elif group.startswith("Sun-planet"):
@@ -364,8 +358,6 @@ def _parse_ringnode(self, src):
364358
else:
365359
pass
366360

367-
## to do: add units?
368-
369361
# --------- below this line, planet-specific info ------------
370362
# Uranus individual rings data
371363
elif group.startswith("Ring "):
@@ -423,21 +415,21 @@ def _parse_result(self, response, verbose=None):
423415
"""
424416
Routine for managing parser calls
425417
note this MUST be named exactly _parse_result so it interacts with async_to_sync properly
426-
418+
427419
Parameters
428420
----------
429421
self : RingNodeClass instance
430422
response : string
431423
raw response from server
432-
424+
433425
Returns
434426
-------
435427
data : `astropy.Table`
436428
"""
437429
self.last_response = response
438430
try:
439431
systemtable, bodytable, ringtable = self._parse_ringnode(response.text)
440-
except:
432+
except Exception as e:
441433
try:
442434
self._last_query.remove_cache_file(self.cache_location)
443435
except OSError:

astroquery/solarsystem/pds/tests/test_ringnode.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
2-
from collections import OrderedDict
32
from astropy.tests.helper import assert_quantity_allclose
3+
import numpy as np
44

55
from ... import pds
66

@@ -22,7 +22,7 @@ def test_ephemeris_query():
2222
).ephemeris(observer_coords=(10.0, -120.355, 1000))
2323

2424
# check system table
25-
systemclose = assert_quantity_allclose(
25+
assert_quantity_allclose(
2626
[
2727
-56.12233,
2828
-56.13586,
@@ -58,7 +58,7 @@ def test_ephemeris_query():
5858
mab = bodytable[bodytable.loc_indices["Mab"]]
5959
assert mab["NAIF ID"] == 726
6060
assert mab["Body"] == "Mab"
61-
mabclose = assert_quantity_allclose(
61+
assert_quantity_allclose(
6262
[
6363
42.011201,
6464
15.801323,

0 commit comments

Comments
 (0)