UNPKG

@observerly/astrometry

Version:

observerly's lightweight, zero-dependency, type safe astrometry library written in Typescript for calculating the position of celestial objects in the sky.

93 lines (92 loc) 3.94 kB
import { AU_IN_METERS as i, c as p } from "./constants.js"; import { convertEclipticToEquatorial as E } from "./coordinates.js"; import { getEccentricityOfOrbit as L, L as C, B as m, R as A } from "./earth.js"; import { g as a } from "./epoch-nmyjNjKp.js"; import { getFOrbitalParameter as O } from "./orbit.js"; import { e as f, c as e } from "./utilities-BM-rBPno.js"; // @license Copyright © 2021-2023 observerly function l(n, c) { return c.reduce((o, t) => o + t.A * Math.cos(t.B + t.C * n), 0); } function b(n, c) { let o = 0; for (let t = 0; t < c.length; t++) { const r = l(n, c[t]); o += r * n ** t; } return f(o / 1e8); } function B(n, c) { let o = 0; for (let t = 0; t < c.length; t++) { const r = l(n, c[t]); o += r * n ** t; } return f(o / 1e8); } function _(n, c) { let o = 0; for (let t = 0; t < c.length; t++) { const r = l(n, c[t]); o += r * n ** t; } return o / 1e8 * i; } const x = 365.242189, D = (n) => { const o = (a(n) - 2451545) / 36525; let t = (357.52911 + 35999.05029 * o - 1537e-7 * o ** 2) % 360; return t < 0 && (t += 360), t; }, J = (n) => { const o = (a(n) - 2451545) / 36525, t = D(n); return (1.914602 - 4817e-6 * o ** 2 - 14e-6 * o ** 3) * Math.sin(e(t)) + (0.019993 - 101e-6 * o ** 2) * Math.sin(e(2 * t)) + 289e-6 * Math.sin(e(3 * t)); }, q = (n) => { const o = (a(n) - 2451545) / 36525; let t = (280.46646 + 36000.76983 * o + 3032e-7 * o ** 2) % 360; return t < 0 && (t += 360), t; }, u = (n) => { const c = D(n), o = J(n); return (c + o) % 360; }, N = (n) => { const c = q(n), o = J(n); return (c + o) % 360; }, U = (n) => { let o = u(n) + 282.938346 % 360; return o < 0 && (o += 360), o; }; function v(n) { const o = (a(n) - 2451545) / 36525, t = o / 10, [r, R, M] = [b(t, C) % 360, B(t, m) % 360, _(t, A)]; let s = r + 180; const h = M / i, g = s - 1.397 * o - 31e-5 * o ** 2, S = 108778e-10 * (Math.cos(e(g)) - Math.sin(e(g))); s -= 250833e-10, s < 0 && (s += 360); const T = 3548.193 + 118.568 * Math.sin(e(87.5287 + 359993.7286 * t)) + 2.476 * Math.sin(e(85.0561 + 719987.4571 * t)) + 1.376 * Math.sin(e(27.8502 + 44526711152e-4 * t)) + 0.119 * Math.sin(e(73.1375 + 450368.8567 * t)) + 0.114 * Math.sin(e(337.2264 + 329644.6719 * t)) + 0.086 * Math.sin(e(222.54 + 659289.3436 * t)) + 0.078 * Math.sin(e(162.8136 + 92246597915e-4 * t)) + 0.054 * Math.sin(e(82.5823 + 10799811857e-4 * t)) + 0.052 * Math.sin(e(171.5189 + 225184.4282 * t)) + 0.034 * Math.sin(e(30.3214 + 40926773866e-4 * t)) + 0.033 * Math.sin(e(119.8105 + 337181.0415 * t)) + 0.023 * Math.sin(e(247.5418 + 299295.6151 * t)) + 0.023 * Math.sin(e(325.1526 + 315559.556 * t)) + 0.021 * Math.sin(e(155.1241 + 675553.2846 * t)) + 7.311 * Math.sin(e(333.4515 + 359993.7286 * t)) + 0.305 * Math.sin(e(330.9814 + 719987.4571 * t)) + 0.0107 * Math.sin(e(328.517 + 10799811857e-4 * t)) + 0.309 * t * Math.sin(e(241.4518 + 359993.7286 * t)) + 0.021 * t * Math.sin(e(205.0482 + 719987.4571 * t)) + 4e-3 * t ** 2 * Math.sin(e(297.861 + 44526711152e-4 * t)) + 0.01 * t ** 3 * Math.sin(e(154.7066 + 359993.7286 * t)); return s -= 20.4898 / 3600 / h, s -= -5775518e-9 * h * T / 3600, { λ: s % 360, β: S - R, R: M }; } const Y = (n) => E(n, v(n)), j = (n) => { const c = u(n); return 0.533128 * O(c, 0.016708); }, y = (n) => { const c = L(n), o = u(n); return 1.000001018 * (1 - c ** 2) / (1 + c * Math.cos(e(o))) * i; }, k = (n) => { const c = a(n), o = y(n); return c - o / p / 86400; }; export { x as SOLAR_TROPICAL_YEAR, k as getHeliocentricJulianDate, j as getSolarAngularDiameter, y as getSolarDistance, v as getSolarEclipticCoordinate, U as getSolarEclipticLongitude, J as getSolarEquationOfCenter, Y as getSolarEquatorialCoordinate, D as getSolarMeanAnomaly, q as getSolarMeanGeometricLongitude, u as getSolarTrueAnomaly, N as getSolarTrueGeometricLongitude }; //# sourceMappingURL=sun.js.map