@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.
3 lines (2 loc) • 6.9 kB
JavaScript
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./coordinates.cjs"),S=require("./earth.cjs"),F=require("./epoch-BuLOjzKu.cjs"),f=require("./moon.cjs"),O=require("./temporal.cjs"),e=require("./utilities-HBcnbrPA.cjs");exports.EclipseType=void 0;(function(o){o.Penumbral="penumbral",o.Partial="partial",o.Annular="annular",o.Total="total",o.AnnularTotal="annular-total"})(exports.EclipseType||(exports.EclipseType={}));function U(o,g){const a=(o.getUTCFullYear()+o.getUTCMonth()/12+o.getUTCDate()/365.25-2e3)*12.3685;return Math.floor(a-g+.5)+g}const m=(o,g)=>{const a=(F.getJulianDate(o)-2451545)/36525,r=U(o,.5),T=245155009766e-5+29.530588861*r+15437e-8*a**2-15e-8*a**3+73e-11*a**4;let h=(160.7108+390.67050284*r-.0016118*a**2-227e-8*a**3+11e-9*a**4)%360;if(h<0&&(h+=360),Math.abs(Math.sin(e.convertDegreesToRadians(h)))>.36)return!1;const D=(124.7746-1.56375588*r+.0020672*a**2+215e-8*a**3)%360,i=h-.02665*Math.sin(e.convertDegreesToRadians(D)),C=299.77+.107408*r-.009173*a**2,t=S.getCoefficientOfEccentricity(o),n=(2.5534+29.1053567*r-14e-7*a**2-11e-8*a**3)%360,s=(201.5643+385.81693528*r+.0107582*a**2+1238e-8*a**3-58e-9*a**4)%360,E=-.4065*Math.sin(e.convertDegreesToRadians(s))+.1727*t*Math.sin(e.convertDegreesToRadians(n))+.0161*Math.sin(e.convertDegreesToRadians(2*s))-.0097*Math.sin(e.convertDegreesToRadians(2*i))+.0073*t*Math.sin(e.convertDegreesToRadians(s-n))-.005*t*Math.sin(e.convertDegreesToRadians(s+n))-.0023*Math.sin(e.convertDegreesToRadians(s-2*i))+.0021*t*Math.sin(e.convertDegreesToRadians(2*n))+.0012*Math.sin(e.convertDegreesToRadians(s+2*i))+6e-4*t*Math.sin(e.convertDegreesToRadians(2*s+n))-4e-4*Math.sin(e.convertDegreesToRadians(3*s))-3e-4*t*Math.sin(e.convertDegreesToRadians(n+2*i))+3e-4*Math.sin(e.convertDegreesToRadians(C))-2e-4*t*Math.sin(e.convertDegreesToRadians(n-2*i))-2e-4*t*Math.sin(e.convertDegreesToRadians(2*s-n))-2e-4*Math.sin(e.convertDegreesToRadians(D)),v=O.convertJulianDateToUTC(T+E),J=Math.abs(Math.cos(e.convertDegreesToRadians(i))),A=.207*t*Math.sin(e.convertDegreesToRadians(n))+.0024*t*Math.sin(e.convertDegreesToRadians(2*n))-.0392*Math.sin(e.convertDegreesToRadians(s))+.0116*Math.sin(e.convertDegreesToRadians(2*s))-.0073*t*Math.sin(e.convertDegreesToRadians(s+n))+.0067*t*Math.sin(e.convertDegreesToRadians(s-n))+.0118*Math.sin(e.convertDegreesToRadians(2*i)),q=5.2207-.0048*t*Math.cos(e.convertDegreesToRadians(n))+.002*t*Math.cos(e.convertDegreesToRadians(2*n))-.3299*Math.cos(e.convertDegreesToRadians(s))-.006*t*Math.cos(e.convertDegreesToRadians(s+n))-.0041*t*Math.cos(e.convertDegreesToRadians(s-n)),c=.0059+.0046*t*Math.cos(e.convertDegreesToRadians(n))-.0182*Math.cos(e.convertDegreesToRadians(s))+4e-4*Math.cos(e.convertDegreesToRadians(2*s))-5e-4*Math.cos(e.convertDegreesToRadians(n+s)),l=(A*Math.cos(e.convertDegreesToRadians(i))+q*Math.sin(e.convertDegreesToRadians(i)))*(1-.0048*J),M=Math.abs(l)<.9972,u=1.2848+c,y=.7403-c;let d=(1.0128-c-Math.abs(l))/.545,p=exports.EclipseType.Penumbral;if(d>1&&(p=exports.EclipseType.Total),d>0&&d<1&&(p=exports.EclipseType.Partial),d<0&&(d=(1.5573+c-Math.abs(l))/.545,d<0))return!1;const{ra:b,dec:L}=f.getLunarEquatorialCoordinate(v),{alt:k,az:x}=P.convertEquatorialToHorizontal(v,g,{ra:b,dec:L});return{k:r,JD:T+E,type:p,isCentral:M,maximum:v,magnitude:d,alt:k,az:x,ra:b,dec:L,F:h,Ω:D,γ:l,u:c,ρ:u,σ:y}},z=(o,g)=>{const a=(F.getJulianDate(o)-2451545)/36525,r=U(o,0),T=245155009766e-5+29.530588861*r+15437e-8*a**2-15e-8*a**3+73e-11*a**4;let h=(160.7108+390.67050284*r-.0016118*a**2-227e-8*a**3+11e-9*a**4)%360;if(h<0&&(h+=360),Math.abs(Math.sin(e.convertDegreesToRadians(h)))>.36)return!1;const D=(124.7746-1.56375588*r+.0020672*a**2+215e-8*a**3)%360,i=h-.02665*Math.sin(e.convertDegreesToRadians(D)),C=299.77+.107408*r-.009173*a**2,t=S.getCoefficientOfEccentricity(o),n=(2.5534+29.1053567*r-14e-7*a**2-11e-8*a**3)%360,s=(201.5643+385.81693528*r+.0107582*a**2+1238e-8*a**3-58e-9*a**4)%360,E=-.4075*Math.sin(e.convertDegreesToRadians(s))+.1721*t*Math.sin(e.convertDegreesToRadians(n))+.0161*Math.sin(e.convertDegreesToRadians(2*s))-.0097*Math.sin(e.convertDegreesToRadians(2*i))+.0073*t*Math.sin(e.convertDegreesToRadians(s-n))-.005*t*Math.sin(e.convertDegreesToRadians(s+n))-.0023*Math.sin(e.convertDegreesToRadians(s-2*i))+.0021*t*Math.sin(e.convertDegreesToRadians(2*n))+.0012*Math.sin(e.convertDegreesToRadians(s+2*i))+6e-4*t*Math.sin(e.convertDegreesToRadians(2*s+n))-4e-4*Math.sin(e.convertDegreesToRadians(3*s))-3e-4*t*Math.sin(e.convertDegreesToRadians(n+2*i))+3e-4*Math.sin(e.convertDegreesToRadians(C))-2e-4*t*Math.sin(e.convertDegreesToRadians(n-2*i))-2e-4*t*Math.sin(e.convertDegreesToRadians(2*s-n))-2e-4*Math.sin(e.convertDegreesToRadians(D)),v=O.convertJulianDateToUTC(T+E),J=Math.abs(Math.cos(e.convertDegreesToRadians(i))),A=.207*t*Math.sin(e.convertDegreesToRadians(n))+.0024*t*Math.sin(e.convertDegreesToRadians(2*n))-.0392*Math.sin(e.convertDegreesToRadians(s))+.0116*Math.sin(e.convertDegreesToRadians(2*s))-.0073*t*Math.sin(e.convertDegreesToRadians(s+n))+.0067*t*Math.sin(e.convertDegreesToRadians(s-n))+.0118*Math.sin(e.convertDegreesToRadians(2*i)),q=5.2207-.0048*t*Math.cos(e.convertDegreesToRadians(n))+.002*t*Math.cos(e.convertDegreesToRadians(2*n))-.3299*Math.cos(e.convertDegreesToRadians(s))-.006*t*Math.cos(e.convertDegreesToRadians(s+n))-.0041*t*Math.cos(e.convertDegreesToRadians(s-n)),c=.0059+.0046*t*Math.cos(e.convertDegreesToRadians(n))-.0182*Math.cos(e.convertDegreesToRadians(s))+4e-4*Math.cos(e.convertDegreesToRadians(2*s))-5e-4*Math.cos(e.convertDegreesToRadians(n+s)),l=(A*Math.cos(e.convertDegreesToRadians(i))+q*Math.sin(e.convertDegreesToRadians(i)))*(1-.0048*J);if(Math.abs(l)>1.5433+c)return!1;let M=exports.EclipseType.Total;const u=Math.abs(l)<.9972;u||(M=exports.EclipseType.Partial),u&&c>.0047&&(M=exports.EclipseType.Annular),u&&c>0&&c<.0047&&(M=c<.00464*Math.sqrt(1-l**2)?exports.EclipseType.AnnularTotal:exports.EclipseType.Annular);let y;M===exports.EclipseType.Partial&&(y=(1.5433+c-Math.abs(l))/(.5461+2*c)),(M===exports.EclipseType.Total||M===exports.EclipseType.Annular||M===exports.EclipseType.AnnularTotal)&&(y=1-c/(.27305+c));const{ra:d,dec:p}=f.getLunarEquatorialCoordinate(v),{alt:b,az:L}=P.convertEquatorialToHorizontal(v,g,{ra:d,dec:p});return b<0?!1:{k:r,JD:T+E,type:M,isCentral:u,maximum:v,magnitude:y,alt:b,az:L,ra:d,dec:p,F:h,Ω:D,γ:l,u:c}},H=(o,g)=>{const a=f.getLunarTrueEclipticLongitude(o),r=f.getLunarCorrectedEclipticLongitudeOfTheAscendingNode(o),T=a-r;return Math.abs(T)%360>18.25&&Math.abs(T-180)%360>18.25?!1:m(o,g)},N=(o,g)=>{const R=18.5166666666667,a=f.getLunarTrueEclipticLongitude(o),r=f.getLunarCorrectedEclipticLongitudeOfTheAscendingNode(o),T=a-r;return Math.abs(T%360)>R&&Math.abs(T-180)%360>R?!1:z(o,g)};exports.getLunarEclipse=m;exports.getSolarEclipse=z;exports.isLunarEclipse=H;exports.isSolarEclipse=N;
//# sourceMappingURL=eclipse.cjs.map