Open MigoMueller opened 5 years ago
Thanks @MigoMueller for the issue. I've tuned down the tone a bit, but you're also of course welcome to open a pull request to fix these shortcoming.
Thanks @bsipocz! Here's a workaround that works for me. Error handling would probably need to be improved for production code:
if len(des)==5 and not des.isnumeric() and des[1:].isnumeric():
#Packed permanent designation, see https://www.minorplanetcenter.net/iau/info/PackedDes.html
number = int(des[1:])
first = ord(des[0])
if des[0].islower():
first -= 61
elif des[0].isupper():
first -= 55
else:
# if first character isn't alphanumeric (shouldn't happen, really)
assert False # more robust error treatment needed, probably
number += first*10000
des = str(number)
I'll try to include that in the code at the right place. If I manage, I'll open a pull request. In the meantime, I hope my workaround is useful for someone.
Many asteroid catalogs contain either packed numbers or designations (or both): https://www.minorplanetcenter.net/iau/info/PackedDes.html
jplhorizons does support packed asteroid designations (which is good), but not packed asteroid numbers. Sample code to reproduce the problem:
The Horizons web interface does support compressed numbers and correctly resolves q3791 to 523791 (2015 HT171).
jplhorizons does support packed designations. E.g., replace 'q3791' in the code above with 'K10F92H' (resolves to 2010 FH92)