Skip to content

Use the MPC ObsCodes list for observatory locations - #22

Merged
ijiraq merged 1 commit into
OSSOS:masterfrom
ijiraq:cursor/mpc-obscodes
Oct 6, 2026
Merged

ijiraq merged 1 commit into
OSSOS:masterfrom
ijiraq:cursor/mpc-obscodes

Conversation

@ijiraq

@ijiraq ijiraq commented Oct 6, 2026

Copy link
Copy Markdown
Member

Fixes #20.

observatories.dat is now the current MPC list (https://minorplanetcenter.net/iau/lists/ObsCodes.html, 2729 codes), and the reader parses its fixed-column layout (east longitude, rho cos φ', rho sin φ'). As in the MPC list, space observatories are the entries with no longitude/parallax constants. The OBSCODE_ORBITAL threshold is gone, which removes:

  • the >2000 "spacecraft" range that collided with ground codes K00 and up (e.g. T14/CFHT, W84/DECam);
  • the pseudo-HST orbit model (codes 2001/2002/4000);
  • the os393.hst / pn70.hst hack, which read a file from the working directory and crashed if it was missing.

Other changes:

  • Alphanumeric codes map to integers with the scheme the old file already used (A=10 … Z=35, a=36 … z=61): I11 → 1811, T14 → 2914. The same mapping is in C (obscode_from_string, used for MPC lines and free-format input files) and Python (mp_ephem.ephem.obscode_to_int, used by predict / predict_helio), so obs_code='T14' works.
  • A space observatory with no position on the observation (positions come from the MPC two-line records) falls back to the geocenter, with a single warning per code. is_visible treats these as always visible instead of exiting.
  • OBSCODE_SSBARY moves from 0 to -2 because MPC code 000 is Greenwich.
  • The site table is allocated dynamically (the old MAX_SITES was 400).
  • Custom ORBIT_OBSERVATORIES files in the old colon format now stop with a clear error instead of being misread. Users with custom files will need to switch to the MPC layout, and old integer codes such as 1811 should be written as I11.

Validation:

  • Maunakea (568) geocentric vector matches the old reader to 0.01 km.
  • The C ground/space split agrees with a column check of all 2729 entries (31 space observatories).
  • New tests: T14 gives the same o3o08 orbit as 568 (before this change T14 was silently turned into 500), code mapping, and predicting for code 250 without a position.

Made with Cursor

…BITAL spacecraft model.

Space observatories are the entries without parallax constants; alphanumeric
codes map to integers as I11 -> 1811. Fixes OSSOS#20.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ijiraq
ijiraq merged commit 654e552 into OSSOS:master Oct 6, 2026
2 checks passed
@ijiraq
ijiraq deleted the cursor/mpc-obscodes branch October 6, 2026 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Observatory location codes have grown but ephem_earth has hardcoded limits.

1 participant