Pack and unpack MPC designations Overview of tools for asteroid observers on this site
If you run into questions/problems, please contact me. You can click here for the source code (look specifically at unpack.cpp and mpc_fmt.cpp; see desigcgi.c for the code underlying this on-line tool to see how the functions are actually used.)
This should handle all the Byzantine ways in which MPC designations can be packed and unpacked. To provide some specific examples :
<- Packed -> <- Unpacked ->
J95X00A 1995 XA
K07Tf8A 2007 TA418
SK03J020 S/2003 J 2
SJ45Ux90 S/1945 U 599
0041P P/41
3141P e P/3141-E
3141P az P/3141-AZ
DJ65Az9c D/1965 A619-C
XJ65K810 X/1965 K81
PLS2040 2040 P-L
T3S3141 3141 T-3
00433 (433)
G4060 (164060)
n1415 (491415)
~0000 (620000)
~000a (620036)
~AZaz (3140113)
~zzzz (15396335)
U024S Uranus XXIV
N924S Neptune CMXXIV
N089S Neptune LXXXIX
U410S Uranus CDX
_QC0000 2026 CA620
_QC0aEM 2026 CZ6190
_QCzzzz 2026 CL591673
_AH9fZ7 2010 HJ92809
P_WY0Mpc P/2032 YT4130
C_MPCmpc C/2022 PY122525
(The above are drawn from a file of test cases used in a test program to verify that my code correctly packs/unpacks designations.)
MPC cheerfully states that the extension allowing packed provisional designations past cycle 620 = 15500th object in a half-month will not be used after the end of 2035, and that therefore the year in such designations (including the last five lines shown above) will be designated by an uppercase letter. I am less sanguine and am allowing lowercase letters (hence base-62) to allow the extension scheme to work to the end of 2061. With any luck, I'll be dead by then and somebody else can worry about it :
_cRAZaz 2038 RO101424
_xMDZ3v 2059 MX129941
X_rAndom X/2053 AM473865