@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.
4 lines (3 loc) • 3.93 kB
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./constants.cjs"),A=require("./coordinates.cjs"),i=require("./earth.cjs"),c=require("./epoch-BuLOjzKu.cjs"),L=require("./orbit.cjs"),o=require("./utilities-HBcnbrPA.cjs");// @license Copyright © 2021-2023 observerly
function u(t,r){return r.reduce((n,e)=>n+e.A*Math.cos(e.B+e.C*t),0)}function C(t,r){let n=0;for(let e=0;e<r.length;e++){const a=u(t,r[e]);n+=a*t**e}return o.convertRadiansToDegrees(n/1e8)}function q(t,r){let n=0;for(let e=0;e<r.length;e++){const a=u(t,r[e]);n+=a*t**e}return o.convertRadiansToDegrees(n/1e8)}function O(t,r){let n=0;for(let e=0;e<r.length;e++){const a=u(t,r[e]);n+=a*t**e}return n/1e8*g.AU_IN_METERS}const _=365.242189,D=t=>{const n=(c.getJulianDate(t)-2451545)/36525;let e=(357.52911+35999.05029*n-1537e-7*n**2)%360;return e<0&&(e+=360),e},T=t=>{const n=(c.getJulianDate(t)-2451545)/36525,e=D(t);return(1.914602-.004817*n**2-14e-6*n**3)*Math.sin(o.convertDegreesToRadians(e))+(.019993-101e-6*n**2)*Math.sin(o.convertDegreesToRadians(2*e))+289e-6*Math.sin(o.convertDegreesToRadians(3*e))},h=t=>{const n=(c.getJulianDate(t)-2451545)/36525;let e=(280.46646+36000.76983*n+3032e-7*n**2)%360;return e<0&&(e+=360),e},l=t=>{const r=D(t),n=T(t);return(r+n)%360},p=t=>{const r=h(t),n=T(t);return(r+n)%360},b=t=>{let n=l(t)+282.938346%360;return n<0&&(n+=360),n};function v(t){const n=(c.getJulianDate(t)-2451545)/36525,e=n/10,[a,E,R]=[C(e,i.L)%360,q(e,i.B)%360,O(e,i.R)];let s=a+180;const M=R/g.AU_IN_METERS,d=s-1.397*n-31e-5*n**2,J=108778e-10*(Math.cos(o.convertDegreesToRadians(d))-Math.sin(o.convertDegreesToRadians(d)));s-=250833e-10,s<0&&(s+=360);const f=3548.193+118.568*Math.sin(o.convertDegreesToRadians(87.5287+359993.7286*e))+2.476*Math.sin(o.convertDegreesToRadians(85.0561+719987.4571*e))+1.376*Math.sin(o.convertDegreesToRadians(27.8502+44526711152e-4*e))+.119*Math.sin(o.convertDegreesToRadians(73.1375+450368.8567*e))+.114*Math.sin(o.convertDegreesToRadians(337.2264+329644.6719*e))+.086*Math.sin(o.convertDegreesToRadians(222.54+659289.3436*e))+.078*Math.sin(o.convertDegreesToRadians(162.8136+92246597915e-4*e))+.054*Math.sin(o.convertDegreesToRadians(82.5823+10799811857e-4*e))+.052*Math.sin(o.convertDegreesToRadians(171.5189+225184.4282*e))+.034*Math.sin(o.convertDegreesToRadians(30.3214+40926773866e-4*e))+.033*Math.sin(o.convertDegreesToRadians(119.8105+337181.0415*e))+.023*Math.sin(o.convertDegreesToRadians(247.5418+299295.6151*e))+.023*Math.sin(o.convertDegreesToRadians(325.1526+315559.556*e))+.021*Math.sin(o.convertDegreesToRadians(155.1241+675553.2846*e))+7.311*Math.sin(o.convertDegreesToRadians(333.4515+359993.7286*e))+.305*Math.sin(o.convertDegreesToRadians(330.9814+719987.4571*e))+.0107*Math.sin(o.convertDegreesToRadians(328.517+10799811857e-4*e))+.309*e*Math.sin(o.convertDegreesToRadians(241.4518+359993.7286*e))+.021*e*Math.sin(o.convertDegreesToRadians(205.0482+719987.4571*e))+.004*e**2*Math.sin(o.convertDegreesToRadians(297.861+44526711152e-4*e))+.01*e**3*Math.sin(o.convertDegreesToRadians(154.7066+359993.7286*e));return s-=20.4898/3600/M,s-=-.005775518*M*f/3600,{λ:s%360,β:J-E,R}}const y=t=>A.convertEclipticToEquatorial(t,v(t)),I=t=>{const r=l(t);return .533128*L.getFOrbitalParameter(r,.016708)},S=t=>{const r=i.getEccentricityOfOrbit(t),n=l(t);return 1.000001018*(1-r**2)/(1+r*Math.cos(o.convertDegreesToRadians(n)))*g.AU_IN_METERS},B=t=>{const r=c.getJulianDate(t),n=S(t);return r-n/g.c/86400};exports.SOLAR_TROPICAL_YEAR=_;exports.getHeliocentricJulianDate=B;exports.getSolarAngularDiameter=I;exports.getSolarDistance=S;exports.getSolarEclipticCoordinate=v;exports.getSolarEclipticLongitude=b;exports.getSolarEquationOfCenter=T;exports.getSolarEquatorialCoordinate=y;exports.getSolarMeanAnomaly=D;exports.getSolarMeanGeometricLongitude=h;exports.getSolarTrueAnomaly=l;exports.getSolarTrueGeometricLongitude=p;
//# sourceMappingURL=sun.cjs.map