Skip to content

Commit 5d42c1f

Browse files
authored
Merge pull request #3026 from jurezakrajsek/main
Update MPC query to parse 3 digit precision motion columns
2 parents 1be9420 + 2425d04 commit 5d42c1f

File tree

7 files changed

+241
-15
lines changed

7 files changed

+241
-15
lines changed

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ mpc
1919
^^^
2020

2121
- Parse star catalog information when querying observations database [#2957]
22+
- Parse ephemeris with sky motion with three digit precision [#3026]
23+
- Raise EmptyResponseError when empty ephemeris reponse is returned [#3026]
2224

2325
linelists.cdms
2426
^^^^^^^^^^^^^^

astroquery/mpc/core.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
from ..utils import async_to_sync, class_or_instance
1919
from ..exceptions import InvalidQueryError, EmptyResponseError
2020

21-
2221
__all__ = ['MPCClass']
2322

2423

@@ -1052,7 +1051,6 @@ def _parse_result(self, result, **kwargs):
10521051
raise InvalidQueryError(content)
10531052
table_end = content.find('</pre>')
10541053
text_table = content[table_start + 5:table_end]
1055-
10561054
SKY = 'raty=a' in result.request.body
10571055
HELIOCENTRIC = 'raty=s' in result.request.body
10581056
GEOCENTRIC = 'raty=G' in result.request.body
@@ -1061,12 +1059,20 @@ def _parse_result(self, result, **kwargs):
10611059
# find column headings
10621060
if SKY:
10631061
# slurp to newline after "h m s"
1064-
i = text_table.index('\n', text_table.index('h m s')) + 1
1062+
# raise EmptyResponseError if no ephemeris lines are found in the query response
1063+
try:
1064+
i = text_table.index('\n', text_table.index('h m s')) + 1
1065+
except ValueError:
1066+
raise EmptyResponseError(content)
10651067
columns = text_table[:i]
10661068
data_start = columns.count('\n') - 1
10671069
else:
10681070
# slurp to newline after "JD_TT"
1069-
i = text_table.index('\n', text_table.index('JD_TT')) + 1
1071+
# raise EmptyResponseError if no ephemeris lines are found in the query response
1072+
try:
1073+
i = text_table.index('\n', text_table.index('JD_TT')) + 1
1074+
except ValueError:
1075+
raise EmptyResponseError(content)
10701076
columns = text_table[:i]
10711077
data_start = columns.count('\n') - 1
10721078

@@ -1088,24 +1094,24 @@ def _parse_result(self, result, **kwargs):
10881094
elif 's=s' in result.request.body: # sky Motion
10891095
names += ('dRA cos(Dec)', 'dDec')
10901096
units += ('arcsec/h', 'arcsec/h')
1091-
col_starts += (73, 81)
1092-
col_ends += (80, 89)
1097+
col_starts += (73, 82)
1098+
col_ends += (81, 91)
10931099

10941100
if 'Moon' in columns:
10951101
# table includes Alt, Az, Sun and Moon geometry
10961102
names += ('Azimuth', 'Altitude', 'Sun altitude', 'Moon phase',
10971103
'Moon distance', 'Moon altitude')
10981104
col_starts += tuple((col_ends[-1] + offset for offset in
1099-
(2, 9, 14, 20, 27, 33)))
1105+
(1, 8, 13, 19, 26, 32)))
11001106
col_ends += tuple((col_ends[-1] + offset for offset in
1101-
(8, 13, 19, 26, 32, 37)))
1107+
(7, 12, 18, 25, 31, 36)))
11021108
units += ('deg', 'deg', 'deg', None, 'deg', 'deg')
11031109
if 'Uncertainty' in columns:
11041110
names += ('Uncertainty 3sig', 'Unc. P.A.')
11051111
col_starts += tuple((col_ends[-1] + offset for offset in
1106-
(2, 11)))
1112+
(1, 10)))
11071113
col_ends += tuple((col_ends[-1] + offset for offset in
1108-
(10, 16)))
1114+
(9, 15)))
11091115
units += ('arcsec', 'deg')
11101116
if ">Map</a>" in first_row and self._unc_links:
11111117
names += ('Unc. map', 'Unc. offsets')
@@ -1171,7 +1177,6 @@ def _parse_result(self, result, **kwargs):
11711177
else:
11721178
# convert from MPES string to Time
11731179
tab['JD'] = Time(tab['JD'], format='jd', scale='tt')
1174-
11751180
return tab
11761181

11771182
elif self.query_type == 'observations':
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2+
<html>
3+
<head>
4+
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
5+
<title>Minor Planet Ephemeris Service: Query Results</title>
6+
</head>
7+
<body>
8+
<h1>Minor Planet Ephemeris Service: Query Results</h1>
9+
Below are the results of your request from the Minor Planet Center's
10+
Minor Planet Ephemeris Service.
11+
<p>
12+
Newly designated objects may take up to 1 day to show up in this service.
13+
</p>
14+
<p>
15+
Orbits and ephemerides of unnumbered NEOs are up-to-date. Other orbits are in
16+
the process of being refreshed.
17+
</p>
18+
<p>
19+
The current system is not completely reliable in the case of objects
20+
with very-close approaches with the Earth.
21+
<br></br> We are working on a completely new system,
22+
but for the time being we encourage the users to double check
23+
the results with other ephemeris generators when the object is very close to
24+
Earth.
25+
</p>
26+
Ephemerides are for
27+
the geocenter.
28+
<p><hr><p>
29+
<p>
30+
<b>2024 AA</b>
31+
<p> Number of variant orbits available: 11</p>
32+
<p>Perturbed ephemeris below is based on
33+
1-day-arc
34+
unperturbed elements from
35+
<i>MPO</i> 793554.
36+
Last observed on 2024 Jan. 2.
37+
<p><a href="https://www.minorplanetcenter.net/iau/info/FurtherObs.html">Further observations?</a> Useful for orbit improvement.
38+
<p><pre>
39+
K24A00A [H=27.41]
40+
Date UT R.A. (J2000) Decl. Delta r El. Ph. V Sky Motion Uncertainty info
41+
h m s "/min "/min 3-sig/" P.A.
42+
2024 06 15 000000 23 28 41.6 -05 17 07 1.451 1.819 93.3 33.9 30.9 +0.17 +0.006 169 063.5 / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460476.50000&Ext=VAR2">Map</a> / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460476.50000&Ext=VAR2&Form=Y&OC=500">Offsets</a>
43+
2024 06 16 000000 23 28 56.7 -05 17 05 1.447 1.829 94.2 33.6 30.9 +0.15 -0.003 172 063.5 / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460477.50000&Ext=VAR2">Map</a> / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460477.50000&Ext=VAR2&Form=Y&OC=500">Offsets</a>
44+
2024 06 17 000000 23 29 09.8 -05 17 16 1.444 1.838 95.1 33.4 30.9 +0.13 -0.013 175 063.6 / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460478.50000&Ext=VAR2">Map</a> / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460478.50000&Ext=VAR2&Form=Y&OC=500">Offsets</a>
45+
2024 06 18 000000 23 29 20.8 -05 17 41 1.440 1.848 96.1 33.1 30.9 +0.10 -0.022 178 063.6 / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460479.50000&Ext=VAR2">Map</a> / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460479.50000&Ext=VAR2&Form=Y&OC=500">Offsets</a>
46+
2024 06 19 000000 23 29 29.9 -05 18 19 1.437 1.858 97.0 32.9 30.9 +0.083 -0.031 181 063.6 / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460480.50000&Ext=VAR2">Map</a> / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460480.50000&Ext=VAR2&Form=Y&OC=500">Offsets</a>
47+
2024 06 20 000000 23 29 36.9 -05 19 11 1.433 1.867 97.9 32.6 30.9 +0.062 -0.041 184 063.7 / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460481.50000&Ext=VAR2">Map</a> / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460481.50000&Ext=VAR2&Form=Y&OC=500">Offsets</a>
48+
2024 06 21 000000 23 29 41.8 -05 20 16 1.429 1.877 98.8 32.3 30.9 +0.040 -0.050 187 063.7 / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460482.50000&Ext=VAR2">Map</a> / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460482.50000&Ext=VAR2&Form=Y&OC=500">Offsets</a>
49+
2024 06 22 000000 23 29 44.6 -05 21 35 1.425 1.886 99.8 32.1 30.9 +0.019 -0.059 190 063.7 / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460483.50000&Ext=VAR2">Map</a> / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460483.50000&Ext=VAR2&Form=Y&OC=500">Offsets</a>
50+
2024 06 23 000000 23 29 45.4 -05 23 07 1.422 1.896 100.8 31.8 30.9 -0.003 -0.069 193 063.8 / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460484.50000&Ext=VAR2">Map</a> / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460484.50000&Ext=VAR2&Form=Y&OC=500">Offsets</a>
51+
2024 06 24 000000 23 29 44.0 -05 24 54 1.418 1.905 101.7 31.5 30.9 -0.025 -0.079 196 063.8 / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460485.50000&Ext=VAR2">Map</a> / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460485.50000&Ext=VAR2&Form=Y&OC=500">Offsets</a>
52+
2024 06 25 000000 23 29 40.5 -05 26 54 1.414 1.914 102.7 31.2 30.9 -0.048 -0.088 199 063.8 / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460486.50000&Ext=VAR2">Map</a> / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460486.50000&Ext=VAR2&Form=Y&OC=500">Offsets</a>
53+
2024 06 26 000000 23 29 34.8 -05 29 08 1.410 1.924 103.7 30.9 30.9 -0.070 -0.098 202 063.9 / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460487.50000&Ext=VAR2">Map</a> / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460487.50000&Ext=VAR2&Form=Y&OC=500">Offsets</a>
54+
2024 06 27 000000 23 29 27.0 -05 31 37 1.406 1.933 104.7 30.6 30.9 -0.093 -0.11 205 063.9 / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460488.50000&Ext=VAR2">Map</a> / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460488.50000&Ext=VAR2&Form=Y&OC=500">Offsets</a>
55+
2024 06 28 000000 23 29 16.9 -05 34 20 1.403 1.942 105.7 30.3 30.9 -0.12 -0.12 208 064.0 / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460489.50000&Ext=VAR2">Map</a> / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460489.50000&Ext=VAR2&Form=Y&OC=500">Offsets</a>
56+
2024 06 29 000000 23 29 04.7 -05 37 17 1.399 1.952 106.7 29.9 30.9 -0.14 -0.13 211 064.0 / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460490.50000&Ext=VAR2">Map</a> / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460490.50000&Ext=VAR2&Form=Y&OC=500">Offsets</a>
57+
2024 06 30 000000 23 28 50.2 -05 40 28 1.395 1.961 107.8 29.6 30.9 -0.16 -0.14 214 064.0 / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460491.50000&Ext=VAR2">Map</a> / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460491.50000&Ext=VAR2&Form=Y&OC=500">Offsets</a>
58+
2024 07 01 000000 23 28 33.5 -05 43 54 1.391 1.970 108.8 29.2 30.9 -0.18 -0.15 217 064.1 / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460492.50000&Ext=VAR2">Map</a> / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460492.50000&Ext=VAR2&Form=Y&OC=500">Offsets</a>
59+
2024 07 02 000000 23 28 14.5 -05 47 34 1.387 1.979 109.8 28.9 30.9 -0.21 -0.16 220 064.1 / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460493.50000&Ext=VAR2">Map</a> / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460493.50000&Ext=VAR2&Form=Y&OC=500">Offsets</a>
60+
2024 07 03 000000 23 27 53.3 -05 51 29 1.384 1.988 110.9 28.5 30.9 -0.23 -0.17 223 064.2 / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460494.50000&Ext=VAR2">Map</a> / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460494.50000&Ext=VAR2&Form=Y&OC=500">Offsets</a>
61+
2024 07 04 000000 23 27 29.7 -05 55 38 1.380 1.997 112.0 28.2 30.9 -0.26 -0.18 226 064.2 / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460495.50000&Ext=VAR2">Map</a> / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460495.50000&Ext=VAR2&Form=Y&OC=500">Offsets</a>
62+
2024 07 05 000000 23 27 03.9 -06 00 02 1.376 2.006 113.0 27.8 30.9 -0.28 -0.19 229 064.2 / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460496.50000&Ext=VAR2">Map</a> / <a href="https://cgi.minorplanetcenter.net/cgi-bin/uncertaintymap.cgi?Obj=K24A00A&JD=2460496.50000&Ext=VAR2&Form=Y&OC=500">Offsets</a>
63+
</pre>
64+
<p><hr><p>
65+
These calculations have been performed on the
66+
<a href="http://www.minorplanetcenter.net/iau/Ack/TamkinFoundation.html">Tamkin
67+
Foundation Computing Network</a>.
68+
<p><hr>
69+
<p>
70+
<a href="http://validator.w3.org/check?uri=referer"><img border="0"
71+
src="http://www.w3.org/Icons/valid-html401"
72+
alt="Valid HTML 4.01!" height="31" width="88"></a>
73+
</p>
74+
</body>
75+
</html>

0 commit comments

Comments
 (0)