🔭 review: post-merge integration — sbdb_lookup into CONFIG.proxy, era-aware BC dates in lib formatters (fable)
Merged suite: 21/21 gates in-browser incl. NEO real-orbit (err 1.16%), Jupiter@1000BC Δ0.004 AU, 2b-proof. Deep-time readout now '1000 BC-01-15'. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
0883cc50b8
commit
b42473a055
@ -6,6 +6,7 @@ export const CONFIG = {
|
||||
proxy: {
|
||||
horizons: 'proxy/horizons',
|
||||
sbdb: 'proxy/sbdb',
|
||||
sbdbLookup: 'proxy/sbdb_lookup',
|
||||
cad: 'proxy/cad',
|
||||
},
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ export function parseSbdbElements(j) {
|
||||
export default function create(ctx) {
|
||||
const { THREE, scene, CONFIG, lib, ui, scale, ephem, worldGroup, toLocal, makeLabel } = ctx;
|
||||
const LD_AU = 384400 / lib.AU_KM; // one lunar distance in AU
|
||||
const SBDB_LOOKUP = 'proxy/sbdb_lookup'; // sibling of CONFIG.proxy.* (I don't own config.js)
|
||||
const SBDB_LOOKUP = CONFIG.proxy.sbdbLookup;
|
||||
const N = 256; // orbit samples per NEO
|
||||
|
||||
const glyph = makeReticle();
|
||||
|
||||
@ -55,15 +55,18 @@ export function worldToEcl(w, out = {}) {
|
||||
|
||||
// ---- formatters ----
|
||||
const pad = (n, w = 2) => String(n).padStart(w, '0');
|
||||
// Astronomical year → human era label: 0 = "1 BC", −999 = "1000 BC" (deep time,
|
||||
// wave 2 VESSEL — a raw getUTCFullYear() would render 1000 BC as "-0999").
|
||||
const eraYear = (y) => (y <= 0 ? `${1 - y} BC` : String(y).padStart(4, '0'));
|
||||
// "2026-07-15 00:00:00 UTC" from unix-ms.
|
||||
export function formatUTC(ms) {
|
||||
const d = new Date(ms);
|
||||
return `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())} ` +
|
||||
return `${eraYear(d.getUTCFullYear())}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())} ` +
|
||||
`${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())} UTC`;
|
||||
}
|
||||
export function formatUTCDate(ms) {
|
||||
const d = new Date(ms);
|
||||
return `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}`;
|
||||
return `${eraYear(d.getUTCFullYear())}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}`;
|
||||
}
|
||||
export function fmtAU(au) {
|
||||
const a = Math.abs(au);
|
||||
|
||||
@ -221,7 +221,7 @@
|
||||
// robust absolute tolerance (least sensitive to EMB≈Earth + two-body drift).
|
||||
let best = null;
|
||||
for (const r of rows) { const dist = +r[ix('dist')]; if (!best || dist > best.dist) best = { des: r[ix('des')], jd: +r[ix('jd')], dist }; }
|
||||
const j = await (await fetch(`proxy/sbdb_lookup?sstr=${encodeURIComponent(best.des)}&full-prec=true`)).json();
|
||||
const j = await (await fetch(`${CONFIG.proxy.sbdbLookup}?sstr=${encodeURIComponent(best.des)}&full-prec=true`)).json();
|
||||
const el = parseSbdbElements(j);
|
||||
if (!el) throw new Error(`no elliptical elements for ${best.des}`);
|
||||
const neo = ephem.smallBodyEcl(el, best.jd, {});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user