brandon-rhodes / pyephem

Scientific-grade astronomy routines for Python
Other
783 stars 121 forks source link

loading asteroid orbital information from MPCORB.DAT #184

Closed nkelhos closed 3 years ago

nkelhos commented 3 years ago

I've got a line from MPCORB.DAT that describes an asteroid's orbit, but ephem.readdb() only seems to parse XEphem-formatted lines. My code:

import ephem
a = '00015    5.2   0.15 K20CH  60.84584   98.61793  292.93525   11.75338  0.1863457  0.22921812   2.6442555  0 MPO530953  2394  79 1851-2020 0.55 M-v 38h MPCW       0000     (15) Eunomia            20200107\n'  
asteroid = ephem.readdb( a )  

I was investigating the differences between XEphem lines in Soft03Distant.txt and MPCORB.DAT, which are here: https://minorplanetcenter.net/iau/Ephemerides/Distant/Soft03Distant.txt https://minorplanetcenter.net/iau/MPCORB.html Comparing the lines for 5335 Damocles from the two files, I can see:

MPCORB.DAT    : "05335   13.3   0.15 K20CH 265.69253  191.22509  314.00567   61.58664  0.8659244  0.02417652  11.8451387  2 MPO 87240    47   2 1991-1992 0.65 M-v 38h MPCW       4005   (5335) Damocles           19920822"
Soft03Distant : "5335 Damocles,e,61.6856,314.0540,191.2734,11.83056,0.0242212,0.86639890,250.9379,04/27.0/2019,2000,H13.3,0.15"

The MPCORB.DAT and XEphem lines have many similar columns, albeit in a different order. Most of the numbers are also off by a little bit, and there are a few extra notational columns ("H13.3").

My questions:

a) Is there a way to read the line from MPCORB.DAT into pyephem? Or should I just construct a XEphem-formatted line by rearranging the columns of my MPCORB.DAT line, fuzzing the notational columns, and checking against another source (JPL Horizons or skyfield)?

b) Are the minor differences in the line's values (e.g. 11.8451387 vs 11.83056) just due to being fit at different times, i.e. one was fit at a later time, with more observations? Or is there a less trivial cause (i.e. calculated in different epochs/coordinate systems, etc)?

brandon-rhodes commented 3 years ago

a) So far as I know, the libastro library that PyEphem wraps does not understand the MPCORB.DAT file but only its own native comma-separated XEphem format.

b) That’s an interesting question, and, no, I don’t know how the Minor Planet Center produces those files or on what schedule, that might explain the discrepancy. Are you able to look at the files’ directories and compare their dates and times? You might try contracting the MPC directly; if you do, please comment back here, I am interested to know the source of the different numbers.

In the meantime, are there any further questions you would like to follow up with? If not then we can close the issue ­— unless you think there’s somewhere in the PyEphem documentation that the lack of support for MPCORB.DAT should be mentioned explicitly, which would have saved you the trouble of asking, and might save future users having to ask the same question?

nkelhos commented 3 years ago

are there any further questions you would like to follow up with?

I think that's probably good for now. I'll try to rearrange the columns and check it against an outside source to see if its accurate.

unless you think there’s somewhere in the PyEphem documentation that the lack of support for MPCORB.DAT should be mentioned explicitly

My project is pretty niche, so the question might not come up very often.

Thanks for your help.