This commit is contained in:
2026-10-21 19:32:02 -04:00
commit b74d278c8e
96 changed files with 54476 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
{
"name": "eye-spy",
"lockfileVersion": 3,
"requires": true,
"packages": {
"node_modules/astronomy-engine": {
"version": "2.1.19",
"resolved": "https://registry.npmjs.org/astronomy-engine/-/astronomy-engine-2.1.19.tgz",
"integrity": "sha512-8yWKNf7UeNbH458h3sAJ6ZgAjE5jTXp/mNNRFoC20j2SHwZIjAQeEsBB2Q3uCFRaTCCJRv33K2XhkhZQMXoX6w==",
"license": "MIT"
},
"node_modules/geomagnetism": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/geomagnetism/-/geomagnetism-0.2.0.tgz",
"integrity": "sha512-dO8HJrXqah244nMe+pU5m52L90SMoi4lDA0AV3xunRxogloYV+s3aYWCW72VMMfiYis+YSAlhoKktw8aLMiJbw==",
"license": "Apache-2.0"
},
"node_modules/satellite.js": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/satellite.js/-/satellite.js-6.0.2.tgz",
"integrity": "sha512-XWKxtqVF5xiJ1xAeiYeT/oSSzsukoCLWvk6nO/WFy4un0M3g4djAU9TAtOCqJLtYW9vxx9pkPJ1L9ITOc607GA==",
"license": "MIT"
}
}
}
+3408
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+258
View File
@@ -0,0 +1,258 @@
/*
MIT
Astronomy library for JavaScript (browser and Node.js).
https://github.com/cosinekitty/astronomy
MIT License
Copyright (c) 2019-2023 Don Cross <cosinekitty@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.createTemplateTagFirstArg=function(r){return r.raw=r};$jscomp.createTemplateTagFirstArgWithRaw=function(r,u){r.raw=u;return r};$jscomp.arrayIteratorImpl=function(r){var u=0;return function(){return u<r.length?{done:!1,value:r[u++]}:{done:!0}}};$jscomp.arrayIterator=function(r){return{next:$jscomp.arrayIteratorImpl(r)}};$jscomp.makeIterator=function(r){var u="undefined"!=typeof Symbol&&Symbol.iterator&&r[Symbol.iterator];return u?u.call(r):$jscomp.arrayIterator(r)};
$jscomp.getGlobal=function(r){r=["object"==typeof globalThis&&globalThis,r,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var u=0;u<r.length;++u){var e=r[u];if(e&&e.Math==Math)return e}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;$jscomp.FORCE_POLYFILL_PROMISE=!1;
$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(r,u,e){if(r==Array.prototype||r==Object.prototype)return r;r[u]=e.value;return r};$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};
$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(r,u){var e=$jscomp.propertyToPolyfillSymbol[u];if(null==e)return r[u];e=r[e];return void 0!==e?e:r[u]};$jscomp.polyfill=function(r,u,e,C){u&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(r,u,e,C):$jscomp.polyfillUnisolated(r,u,e,C))};
$jscomp.polyfillUnisolated=function(r,u,e,C){e=$jscomp.global;r=r.split(".");for(C=0;C<r.length-1;C++){var A=r[C];if(!(A in e))return;e=e[A]}r=r[r.length-1];C=e[r];u=u(C);u!=C&&null!=u&&$jscomp.defineProperty(e,r,{configurable:!0,writable:!0,value:u})};
$jscomp.polyfillIsolated=function(r,u,e,C){var A=r.split(".");r=1===A.length;C=A[0];C=!r&&C in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var w=0;w<A.length-1;w++){var Q=A[w];if(!(Q in C))return;C=C[Q]}A=A[A.length-1];e=$jscomp.IS_SYMBOL_NATIVE&&"es6"===e?C[A]:null;u=u(e);null!=u&&(r?$jscomp.defineProperty($jscomp.polyfills,A,{configurable:!0,writable:!0,value:u}):u!==e&&(void 0===$jscomp.propertyToPolyfillSymbol[A]&&($jscomp.propertyToPolyfillSymbol[A]=$jscomp.IS_SYMBOL_NATIVE?$jscomp.global.Symbol(A):
$jscomp.POLYFILL_PREFIX+A),$jscomp.defineProperty(C,$jscomp.propertyToPolyfillSymbol[A],{configurable:!0,writable:!0,value:u})))};$jscomp.polyfill("Math.log10",function(r){return r?r:function(u){return Math.log(u)/Math.LN10}},"es6","es3");$jscomp.polyfill("Number.isFinite",function(r){return r?r:function(u){return"number"!==typeof u?!1:!isNaN(u)&&Infinity!==u&&-Infinity!==u}},"es6","es3");
$jscomp.polyfill("Math.hypot",function(r){return r?r:function(u){if(2>arguments.length)return arguments.length?Math.abs(arguments[0]):0;var e,C,A;for(e=A=0;e<arguments.length;e++)A=Math.max(A,Math.abs(arguments[e]));if(1E100<A||1E-100>A){if(!A)return A;for(e=C=0;e<arguments.length;e++){var w=Number(arguments[e])/A;C+=w*w}return Math.sqrt(C)*A}for(e=C=0;e<arguments.length;e++)w=Number(arguments[e]),C+=w*w;return Math.sqrt(C)}},"es6","es3");
$jscomp.polyfill("Number.MAX_SAFE_INTEGER",function(){return 9007199254740991},"es6","es3");$jscomp.polyfill("Number.isInteger",function(r){return r?r:function(u){return Number.isFinite(u)?u===Math.floor(u):!1}},"es6","es3");$jscomp.polyfill("Number.isSafeInteger",function(r){return r?r:function(u){return Number.isInteger(u)&&Math.abs(u)<=Number.MAX_SAFE_INTEGER}},"es6","es3");
$jscomp.polyfill("Math.cbrt",function(r){return r?r:function(u){if(0===u)return u;u=Number(u);var e=Math.pow(Math.abs(u),1/3);return 0>u?-e:e}},"es6","es3");
(function(r){"object"===typeof exports&&"undefined"!==typeof module?module.exports=r():"function"===typeof define&&define.amd?define([],r):("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:this).Astronomy=r()})(function(){return function(){function r(u,e,C){function A(N,T){if(!e[N]){if(!u[N]){var ka="function"==typeof require&&require;if(!T&&ka)return ka(N,!0);if(w)return w(N,!0);T=Error("Cannot find module '"+N+"'");throw T.code="MODULE_NOT_FOUND",
T;}T=e[N]={exports:{}};u[N][0].call(T.exports,function(sa){return A(u[N][1][sa]||sa)},T,T.exports,r,u,e,C)}return e[N].exports}for(var w="function"==typeof require&&require,Q=0;Q<C.length;Q++)A(C[Q]);return A}return r}()({1:[function(r,u,e){function C(a){switch(a){case m.Sun:return 2.959122082855911E-4;case m.Mercury:return 4.912547451450812E-11;case m.Venus:return 7.243452486162703E-10;case m.Earth:return 8.887692390113509E-10;case m.Moon:return 1.093189565989891E-11;case m.EMB:return 8.997011346712498E-10;
case m.Mars:return 9.549535105779258E-11;case m.Jupiter:return 2.825345909524226E-7;case m.Saturn:return 8.459715185680659E-8;case m.Uranus:return 1.292024916781969E-8;case m.Neptune:return 1.524358900784276E-8;case m.Pluto:return 2.18869976542597E-12;default:throw"Do not know mass product for body: "+a;}}function A(a){if(!0!==a&&!1!==a)throw console.trace(),"Value is not boolean: "+a;return a}function w(a){if(!Number.isFinite(a))throw console.trace(),"Value is not a finite number: "+a;return a}function Q(a){return a-
Math.floor(a)}function N(a,b){var c=a.x*a.x+a.y*a.y+a.z*a.z;if(1E-8>Math.abs(c))throw"AngleBetween: first vector is too short.";var d=b.x*b.x+b.y*b.y+b.z*b.z;if(1E-8>Math.abs(d))throw"AngleBetween: second vector is too short.";a=(a.x*b.x+a.y*b.y+a.z*b.z)/Math.sqrt(c*d);return-1>=a?180:1<=a?0:e.RAD2DEG*Math.acos(a)}function T(a){a=ld.indexOf(a);return 0<=a?md[a]:null}function ka(a){return(a=T(a))&&0<a.dist?a:null}function sa(a){var b=2E3+(a-14)/365.24217;if(-500>b)return a=(b-1820)/100,-20+32*a*a;
if(500>b){a=b/100;b=a*a;var c=a*b;return 10583.6-1014.41*a+33.78311*b-5.952053*c-.1798452*b*b+.022174192*b*c+.0090316521*c*c}if(1600>b)return a=(b-1E3)/100,b=a*a,c=a*b,1574.2-556.01*a+71.23472*b+.319781*c-.8503463*b*b-.005050998*b*c+.0083572073*c*c;if(1700>b)return a=b-1600,b=a*a,120-.9808*a-.01532*b+a*b/7129;if(1800>b)return a=b-1700,b=a*a,8.83+.1603*a-.0059285*b+1.3336E-4*a*b-b*b/1174E3;if(1860>b){a=b-1800;b=a*a;c=a*b;var d=b*b;return 13.72-.332447*a+.0068612*b+.0041116*c-3.7436E-4*d+1.21272E-5*
b*c-1.699E-7*c*c+8.75E-10*c*d}if(1900>b)return a=b-1860,b=a*a,c=a*b,7.62+.5737*a-.251754*b+.01680668*c-4.473624E-4*b*b+b*c/233174;if(1920>b)return a=b-1900,b=a*a,-2.79+1.494119*a-.0598939*b+.0061966*a*b-1.97E-4*b*b;if(1941>b)return a=b-1920,b=a*a,21.2+.84493*a-.0761*b+.0020936*a*b;if(1961>b)return a=b-1950,b=a*a,29.07+.407*a-b/233+a*b/2547;if(1986>b)return a=b-1975,b=a*a,45.45+1.067*a-b/260-a*b/718;if(2005>b)return a=b-2E3,b=a*a,c=a*b,63.86+.3345*a-.060374*b+.0017275*c+6.51814E-4*b*b+2.373599E-5*
b*c;if(2050>b)return a=b-2E3,62.92+.32217*a+.005589*a*a;if(2150>b)return a=(b-1820)/100,-20+32*a*a-.5628*(2150-b);a=(b-1820)/100;return-20+32*a*a}function Vb(a){return a+Wb(a)/86400}function v(a){return a instanceof O?a:new O(a)}function Xb(a){a=a.tt/36525;return(((((-4.34E-8*a-5.76E-7)*a+.0020034)*a-1.831E-4)*a-46.836769)*a+84381.406)/3600}function da(a){if(!$a||1E-6<Math.abs($a.tt-a.tt)){var b=a.tt/36525;var c=(1287104.79305+1.295965810481E8*b)%1296E3*4.84813681109536E-6;var d=(335779.526232+1.7395272628478E9*
b)%1296E3*4.84813681109536E-6,f=(450160.398036-6962890.5431*b)%1296E3*4.84813681109536E-6,g=Math.sin(f),h=Math.cos(f),l=(-172064161-174666*b)*g+33386*h,k=(92052331+9086*b)*h+15377*g;h=2*(d-(1072260.70369+1.602961601209E9*b)%1296E3*4.84813681109536E-6+f);g=Math.sin(h);h=Math.cos(h);l+=(-13170906-1675*b)*g-13696*h;k+=(5730336-3015*b)*h-4587*g;h=2*(d+f);g=Math.sin(h);h=Math.cos(h);l+=(-2276413-234*b)*g+2796*h;k+=(978459-485*b)*h+1374*g;h=2*f;g=Math.sin(h);h=Math.cos(h);l+=(2074554+207*b)*g-698*h;k+=
(-897492+470*b)*h-291*g;g=Math.sin(c);h=Math.cos(c);c=-1.35E-4+1E-7*(l+((1475877-3633*b)*g+11817*h));b=3.88E-4+1E-7*(k+((73871-184*b)*h-1924*g));g=Xb(a);$a={tt:a.tt,dpsi:c,deps:b,ee:c*Math.cos(g*e.DEG2RAD)/15,mobl:g,tobl:g+b/3600}}return $a}function Yb(a,b){var c=a*e.DEG2RAD;a=Math.cos(c);c=Math.sin(c);return[b[0],b[1]*a-b[2]*c,b[1]*c+b[2]*a]}function ea(a){function b(D,G,P,fa){for(var L=[],ta=0;ta<=G-D;++ta){var ua=L,ub=ua.push,vb,Zb=P,nd=fa,$b=[];for(vb=0;vb<=nd-Zb;++vb)$b.push(0);ub.call(ua,{min:Zb,
array:$b})}return{min:D,array:L}}function c(D,G,P){D=D.array[G-D.min];return D.array[P-D.min]}function d(D,G,P){D=y.array[D-y.min];D.array[G-D.min]=P}function f(D,G,P){D=x.array[D-x.min];D.array[G-D.min]=P}function g(D,G,P,fa,L){L(D*P-G*fa,G*P+D*fa)}function h(D){return Math.sin(U*D)}function l(D,G,P,fa){var L={x:1,y:0};D=[0,D,G,P,fa];for(G=1;4>=G;++G)0!==D[G]&&g(L.x,L.y,c(y,D[G],G),c(x,D[G],G),function(ta,ua){return L.x=ta,L.y=ua});return L}function k(D,G,P,fa,L,ta,ua,ub){L=l(L,ta,ua,ub);q+=D*L.y;
t+=G*L.y;ab+=P*L.x;va+=fa*L.x}++e.CalcMoonCount;a=a.tt/36525;var n,p,q,t,y=b(-6,6,1,4),x=b(-6,6,1,4);var z=a*a;var ab=t=q=0;var va=3422.7;var la=h(.19833+.05611*a);var ha=h(.27869+.04508*a);var V=h(.16827-.36903*a);var ba=h(.34734-5.37261*a);var La=h(.10498-5.37899*a);var bb=h(.42681-.41855*a),od=h(.14943-5.37511*a);var cb=.84*la+.31*ha+14.27*V+7.26*ba+.28*La+.24*bb;var wb=2.94*la+.31*ha+14.27*V+9.34*ba+1.12*La+.83*bb;var db=-6.4*la-1.89*bb;ha=.21*la+.31*ha+14.27*V-88.7*ba-15.3*La+.24*bb-1.86*od;
V=cb-db;la=-3.332E-6*h(.59734-5.37261*a)-5.39E-7*h(.35498-5.37899*a)-6.4E-8*h(.39943-5.37511*a);cb=U*Q(.60643382+1336.85522467*a-3.13E-6*z)+cb/ia;wb=U*Q(.37489701+1325.55240982*a+2.565E-5*z)+wb/ia;db=U*Q(.99312619+99.99735956*a-4.4E-7*z)+db/ia;ha=U*Q(.25909118+1342.2278298*a-8.92E-6*z)+ha/ia;La=U*Q(.82736186+1236.85308708*a-3.97E-6*z)+V/ia;for(n=1;4>=n;++n){switch(n){case 1:V=wb;z=4;ba=1.000002208;break;case 2:V=db;z=3;ba=.997504612-.002495388*a;break;case 3:V=ha;z=4;ba=1.000002708+139.978*la;break;
case 4:V=La;z=6;ba=1;break;default:throw"Internal error: I = "+n;}d(0,n,1);d(1,n,Math.cos(V)*ba);f(0,n,0);f(1,n,Math.sin(V)*ba);for(p=2;p<=z;++p)g(c(y,p-1,n),c(x,p-1,n),c(y,1,n),c(x,1,n),function(D,G){return d(p,n,D),f(p,n,G)});for(p=1;p<=z;++p)d(-p,n,c(y,p,n)),f(-p,n,-c(x,p,n))}k(13.902,14.06,-.001,.2607,0,0,0,4);k(.403,-4.01,.394,.0023,0,0,0,3);k(2369.912,2373.36,.601,28.2333,0,0,0,2);k(-125.154,-112.79,-.725,-.9781,0,0,0,1);k(1.979,6.98,-.445,.0433,1,0,0,4);k(191.953,192.72,.029,3.0861,1,0,0,2);
k(-8.466,-13.51,.455,-.1093,1,0,0,1);k(22639.5,22609.07,.079,186.5398,1,0,0,0);k(18.609,3.59,-.094,.0118,1,0,0,-1);k(-4586.465,-4578.13,-.077,34.3117,1,0,0,-2);k(3.215,5.44,.192,-.0386,1,0,0,-3);k(-38.428,-38.64,.001,.6008,1,0,0,-4);k(-.393,-1.43,-.092,.0086,1,0,0,-6);k(-.289,-1.59,.123,-.0053,0,1,0,4);k(-24.42,-25.1,.04,-.3,0,1,0,2);k(18.023,17.93,.007,.1494,0,1,0,1);k(-668.146,-126.98,-1.302,-.3997,0,1,0,0);k(.56,.32,-.001,-.0037,0,1,0,-1);k(-165.145,-165.06,.054,1.9178,0,1,0,-2);k(-1.877,-6.46,
-.416,.0339,0,1,0,-4);k(.213,1.02,-.074,.0054,2,0,0,4);k(14.387,14.78,-.017,.2833,2,0,0,2);k(-.586,-1.2,.054,-.01,2,0,0,1);k(769.016,767.96,.107,10.1657,2,0,0,0);k(1.75,2.01,-.018,.0155,2,0,0,-1);k(-211.656,-152.53,5.679,-.3039,2,0,0,-2);k(1.225,.91,-.03,-.0088,2,0,0,-3);k(-30.773,-34.07,-.308,.3722,2,0,0,-4);k(-.57,-1.4,-.074,.0109,2,0,0,-6);k(-2.921,-11.75,.787,-.0484,1,1,0,2);k(1.267,1.52,-.022,.0164,1,1,0,1);k(-109.673,-115.18,.461,-.949,1,1,0,0);k(-205.962,-182.36,2.056,1.4437,1,1,0,-2);k(.233,
.36,.012,-.0025,1,1,0,-3);k(-4.391,-9.66,-.471,.0673,1,1,0,-4);k(.283,1.53,-.111,.006,1,-1,0,4);k(14.577,31.7,-1.54,.2302,1,-1,0,2);k(147.687,138.76,.679,1.1528,1,-1,0,0);k(-1.089,.55,.021,0,1,-1,0,-1);k(28.475,23.59,-.443,-.2257,1,-1,0,-2);k(-.276,-.38,-.006,-.0036,1,-1,0,-3);k(.636,2.27,.146,-.0102,1,-1,0,-4);k(-.189,-1.68,.131,-.0028,0,2,0,2);k(-7.486,-.66,-.037,-.0086,0,2,0,0);k(-8.096,-16.35,-.74,.0918,0,2,0,-2);k(-5.741,-.04,0,-9E-4,0,0,2,2);k(.255,0,0,0,0,0,2,1);k(-411.608,-.2,0,-.0124,0,0,
2,0);k(.584,.84,0,.0071,0,0,2,-1);k(-55.173,-52.14,0,-.1052,0,0,2,-2);k(.254,.25,0,-.0017,0,0,2,-3);k(.025,-1.67,0,.0031,0,0,2,-4);k(1.06,2.96,-.166,.0243,3,0,0,2);k(36.124,50.64,-1.3,.6215,3,0,0,0);k(-13.193,-16.4,.258,-.1187,3,0,0,-2);k(-1.187,-.74,.042,.0074,3,0,0,-4);k(-.293,-.31,-.002,.0046,3,0,0,-6);k(-.29,-1.45,.116,-.0051,2,1,0,2);k(-7.649,-10.56,.259,-.1038,2,1,0,0);k(-8.627,-7.59,.078,-.0192,2,1,0,-2);k(-2.74,-2.54,.022,.0324,2,1,0,-4);k(1.181,3.32,-.212,.0213,2,-1,0,2);k(9.703,11.67,-.151,
.1268,2,-1,0,0);k(-.352,-.37,.001,-.0028,2,-1,0,-1);k(-2.494,-1.17,-.003,-.0017,2,-1,0,-2);k(.36,.2,-.012,-.0043,2,-1,0,-4);k(-1.167,-1.25,.008,-.0106,1,2,0,0);k(-7.412,-6.12,.117,.0484,1,2,0,-2);k(-.311,-.65,-.032,.0044,1,2,0,-4);k(.757,1.82,-.105,.0112,1,-2,0,2);k(2.58,2.32,.027,.0196,1,-2,0,0);k(2.533,2.4,-.014,-.0212,1,-2,0,-2);k(-.344,-.57,-.025,.0036,0,3,0,-2);k(-.992,-.02,0,0,1,0,2,2);k(-45.099,-.02,0,-.001,1,0,2,0);k(-.179,-9.52,0,-.0833,1,0,2,-2);k(-.301,-.33,0,.0014,1,0,2,-4);k(-6.382,-3.37,
0,-.0481,1,0,-2,2);k(39.528,85.13,0,-.7136,1,0,-2,0);k(9.366,.71,0,-.0112,1,0,-2,-2);k(.202,.02,0,0,1,0,-2,-4);k(.415,.1,0,.0013,0,1,2,0);k(-2.152,-2.26,0,-.0066,0,1,2,-2);k(-1.44,-1.3,0,.0014,0,1,-2,2);k(.384,-.04,0,0,0,1,-2,-2);k(1.938,3.6,-.145,.0401,4,0,0,0);k(-.952,-1.58,.052,-.013,4,0,0,-2);k(-.551,-.94,.032,-.0097,3,1,0,0);k(-.482,-.57,.005,-.0045,3,1,0,-2);k(.681,.96,-.026,.0115,3,-1,0,0);k(-.297,-.27,.002,-9E-4,2,2,0,-2);k(.254,.21,-.003,0,2,-2,0,-2);k(-.25,-.22,.004,.0014,1,3,0,-2);k(-3.996,
0,0,4E-4,2,0,2,0);k(.557,-.75,0,-.009,2,0,2,-2);k(-.459,-.38,0,-.0053,2,0,-2,2);k(-1.298,.74,0,4E-4,2,0,-2,0);k(.538,1.14,0,-.0141,2,0,-2,-2);k(.263,.02,0,0,1,1,2,0);k(.426,.07,0,-6E-4,1,1,-2,-2);k(-.304,.03,0,3E-4,1,-1,2,0);k(-.372,-.19,0,-.0027,1,-1,-2,2);k(.418,0,0,0,0,0,4,0);k(-.33,-.04,0,0,3,0,2,0);z=-526.069*l(0,0,1,-2).y;z+=-3.352*l(0,0,1,-4).y;z+=44.297*l(1,0,1,-2).y;z+=-6*l(1,0,1,-4).y;z+=20.599*l(-1,0,1,0).y;z+=-30.598*l(-1,0,1,-2).y;z+=-24.649*l(-2,0,1,0).y;z+=-2*l(-2,0,1,-2).y;z+=-22.571*
l(0,1,1,-2).y;z+=10.985*l(0,-1,1,-2).y;q+=.82*h(.7736-62.5512*a)+.31*h(.0466-125.1025*a)+.35*h(.5785-25.1042*a)+.66*h(.4591+1335.8075*a)+.64*h(.313-91.568*a)+1.14*h(.148+1331.2898*a)+.21*h(.5918+1056.5859*a)+.44*h(.5784+1322.8595*a)+.24*h(.2275-5.7374*a)+.28*h(.2965+2.6929*a)+.33*h(.3132+6.3368*a);a=ha+t/ia;a=(1.000002708+139.978*la)*(18518.511+1.189+ab)*Math.sin(a)-6.24*Math.sin(3*a)+z;return{geo_eclip_lon:U*Q((cb+q/ia)/U),geo_eclip_lat:Math.PI/648E3*a,distance_au:ia*pd/(.999953253*va)}}function ac(a,
b){return[a.rot[0][0]*b[0]+a.rot[1][0]*b[1]+a.rot[2][0]*b[2],a.rot[0][1]*b[0]+a.rot[1][1]*b[1]+a.rot[2][1]*b[2],a.rot[0][2]*b[0]+a.rot[1][2]*b[1]+a.rot[2][2]*b[2]]}function wa(a,b,c){b=Ma(b,c);return ac(b,a)}function Ma(a,b){a=a.tt/36525;var c=84381.406,d=((((3.337E-7*a-4.67E-7)*a-.00772503)*a+.0512623)*a-.025754)*a+c;c*=4.84813681109536E-6;var f=((((-9.51E-8*a+1.32851E-4)*a-.00114045)*a-1.0790069)*a+5038.481507)*a*4.84813681109536E-6;d*=4.84813681109536E-6;var g=((((-5.6E-8*a+1.70663E-4)*a-.00121197)*
a-2.3814292)*a+10.556403)*a*4.84813681109536E-6;a=Math.sin(c);c=Math.cos(c);var h=Math.sin(-f);f=Math.cos(-f);var l=Math.sin(-d);d=Math.cos(-d);var k=Math.sin(g),n=Math.cos(g);g=n*f-h*k*d;var p=n*h*c+k*d*f*c-a*k*l,q=n*h*a+k*d*f*a+c*k*l,t=-k*f-h*n*d,y=-k*h*c+n*d*f*c-a*n*l;k=-k*h*a+n*d*f*a+c*n*l;h*=l;n=-l*f*c-a*d;a=-l*f*a+d*c;if(b===F.Into2000)return new J([[g,p,q],[t,y,k],[h,n,a]]);if(b===F.From2000)return new J([[g,t,h],[p,y,n],[q,k,a]]);throw"Invalid precess direction";}function ca(a){if(!eb||eb.tt!==
a.tt){var b=a.tt/36525,c=15*da(a).ee,d=(.779057273264+.00273781191135448*a.ut+a.ut%1)%1*360;0>d&&(d+=360);b=((c+.014506+((((-3.68E-8*b-2.9956E-5)*b-4.4E-7)*b+1.3915817)*b+4612.156534)*b)/3600+d)%360/15;0>b&&(b+=24);eb={tt:a.tt,st:b}}return eb.st}function bc(a){a=v(a);return ca(a)}function xb(a,b){var c=a.latitude*e.DEG2RAD,d=Math.sin(c);c=Math.cos(c);var f=1/Math.hypot(c,.996647180302104*d),g=a.height/1E3,h=6378.1366*f+g;b=(15*b+a.longitude)*e.DEG2RAD;a=Math.sin(b);b=Math.cos(b);return{pos:[h*c*b/
e.KM_PER_AU,h*c*a/e.KM_PER_AU,(6335.438815127603*f+g)*d/e.KM_PER_AU],vel:[-7.292115E-5*h*c*a*86400/e.KM_PER_AU,7.292115E-5*h*c*b*86400/e.KM_PER_AU,0]}}function xa(a,b,c){b=Na(b,c);return ac(b,a)}function Na(a,b){a=da(a);var c=a.mobl*e.DEG2RAD,d=a.tobl*e.DEG2RAD,f=4.84813681109536E-6*a.dpsi;a=Math.cos(c);c=Math.sin(c);var g=Math.cos(d),h=Math.sin(d);d=Math.cos(f);var l=Math.sin(f);f=-l*a;var k=-l*c,n=l*g,p=d*a*g+c*h,q=d*c*g-a*h;l*=h;var t=d*a*h-c*g;a=d*c*h+a*g;if(b===F.From2000)return new J([[d,n,
l],[f,p,t],[k,q,a]]);if(b===F.Into2000)return new J([[d,f,k],[n,p,q],[l,t,a]]);throw"Invalid precess direction";}function fb(a,b,c){return c===F.Into2000?wa(xa(a,b,c),b,c):xa(wa(a,b,c),b,c)}function cc(a,b){var c=ca(a);b=xb(b,c).pos;return fb(b,a,F.Into2000)}function qd(a){if(!(a instanceof Array)||3!==a.length)return!1;for(var b=0;3>b;++b){if(!(a[b]instanceof Array)||3!==a[b].length)return!1;for(var c=0;3>c;++c)if(!Number.isFinite(a[b][c]))return!1}return!0}function yb(a,b){return new E(a[0],a[1],
a[2],b)}function dc(a,b){b=yb(a,b);var c=b.x*b.x+b.y*b.y,d=Math.sqrt(c+b.z*b.z);if(0===c){if(0===b.z)throw"Indeterminate sky coordinates";return new gb(0,0>b.z?-90:90,d,b)}var f=e.RAD2HOUR*Math.atan2(b.y,b.x);0>f&&(f+=24);return new gb(f,e.RAD2DEG*Math.atan2(a[2],Math.sqrt(c)),d,b)}function ya(a,b){var c=a*e.DEG2RAD;a=Math.cos(c);c=Math.sin(c);return[a*b[0]+c*b[1],a*b[1]-c*b[0],b[2]]}function hb(a,b,c,d,f){a=v(a);za(b);w(c);w(d);var g=Math.sin(b.latitude*e.DEG2RAD),h=Math.cos(b.latitude*e.DEG2RAD),
l=Math.sin(b.longitude*e.DEG2RAD),k=Math.cos(b.longitude*e.DEG2RAD);b=Math.sin(d*e.DEG2RAD);var n=Math.cos(d*e.DEG2RAD),p=Math.sin(c*e.HOUR2RAD),q=Math.cos(c*e.HOUR2RAD),t=[h*k,h*l,g];g=[-g*k,-g*l,h];l=[l,-k,0];h=-15*ca(a);a=ya(h,t);t=ya(h,g);l=ya(h,l);b=[n*q,n*p,b];p=b[0]*a[0]+b[1]*a[1]+b[2]*a[2];n=b[0]*t[0]+b[1]*t[1]+b[2]*t[2];t=b[0]*l[0]+b[1]*l[1]+b[2]*l[2];q=Math.hypot(n,t);0<q?(n=-e.RAD2DEG*Math.atan2(t,n),0>n&&(n+=360)):n=0;p=e.RAD2DEG*Math.atan2(q,p);q=d;if(f&&(d=p,f=Oa(f,90-p),p-=f,0<f&&3E-4<
p)){c=Math.sin(p*e.DEG2RAD);q=Math.cos(p*e.DEG2RAD);t=Math.sin(d*e.DEG2RAD);d=Math.cos(d*e.DEG2RAD);f=[];for(l=0;3>l;++l)f.push((b[l]-d*a[l])/t*c+a[l]*q);q=Math.hypot(f[0],f[1]);0<q?(c=e.RAD2HOUR*Math.atan2(f[1],f[0]),0>c&&(c+=24)):c=0;q=e.RAD2DEG*Math.atan2(f[2],q)}return new ec(n,90-p,c,q)}function za(a){if(!(a instanceof zb))throw"Not an instance of the Observer class: "+a;w(a.latitude);w(a.longitude);w(a.height);if(-90>a.latitude||90<a.latitude)throw"Latitude "+a.latitude+" is out of range. Must be -90..+90.";
return a}function fc(a){a=v(a).AddDays(-1/e.C_AUDAY);var b=Aa(M.Earth,a),c=$jscomp.makeIterator(fb([-b.x,-b.y,-b.z],a,F.From2000));b=c.next().value;var d=c.next().value,f=c.next().value,g=e.DEG2RAD*da(a).tobl;c=Math.cos(g);g=Math.sin(g);a=new E(b,d,f,a);return Ab(a,c,g)}function Pa(a,b,c,d,f){za(c);A(d);A(f);b=v(b);c=cc(b,c);a=W(a,b,f);a=[a.x-c[0],a.y-c[1],a.z-c[2]];if(!d)return dc(a,b);d=fb(a,b,F.From2000);return dc(d,b)}function Ab(a,b,c){var d=a.x,f=a.y*b+a.z*c;c=-a.y*c+a.z*b;var g=Math.hypot(d,
f);b=0;0<g&&(b=e.RAD2DEG*Math.atan2(f,d),0>b&&(b+=360));g=e.RAD2DEG*Math.atan2(c,g);a=new E(d,f,c,a.t);return new gc(a,g,b)}function Qa(a){var b=da(a.t),c=wa([a.x,a.y,a.z],a.t,F.From2000),d=$jscomp.makeIterator(xa(c,a.t,F.From2000));c=d.next().value;var f=d.next().value;d=d.next().value;a=new E(c,f,d,a.t);b=b.tobl*e.DEG2RAD;return Ab(a,Math.cos(b),Math.sin(b))}function Y(a){a=v(a);var b=ea(a),c=b.distance_au*Math.cos(b.geo_eclip_lat);b=[c*Math.cos(b.geo_eclip_lon),c*Math.sin(b.geo_eclip_lon),b.distance_au*
Math.sin(b.geo_eclip_lat)];b=Yb(Xb(a),b);b=wa(b,a,F.Into2000);return new E(b[0],b[1],b[2],a)}function ib(a){var b=v(a);a=ea(b);var c=a.distance_au*Math.cos(a.geo_eclip_lat),d=[c*Math.cos(a.geo_eclip_lon),c*Math.sin(a.geo_eclip_lon),a.distance_au*Math.sin(a.geo_eclip_lat)];c=da(b);d=Yb(c.mobl,d);d=xa(d,b,F.From2000);b=yb(d,b);c=c.tobl*e.DEG2RAD;b=Ab(b,Math.cos(c),Math.sin(c));return new Ba(b.elat,b.elon,a.distance_au)}function Ra(a){a=v(a);var b=a.AddDays(-1E-5),c=a.AddDays(1E-5);b=Y(b);c=Y(c);return new I((b.x+
c.x)/2,(b.y+c.y)/2,(b.z+c.z)/2,(c.x-b.x)/2E-5,(c.y-b.y)/2E-5,(c.z-b.z)/2E-5,a)}function Bb(a){a=v(a);var b=Ra(a);return new I(b.x/82.30056,b.y/82.30056,b.z/82.30056,b.vx/82.30056,b.vy/82.30056,b.vz/82.30056,a)}function ma(a,b,c){var d=1,f=0;a=$jscomp.makeIterator(a);for(var g=a.next();!g.done;g=a.next()){var h=0;g=$jscomp.makeIterator(g.value);for(var l=g.next();!l.done;l=g.next()){var k=$jscomp.makeIterator(l.value);l=k.next().value;var n=k.next().value;k=k.next().value;h+=l*Math.cos(n+b*k)}h*=d;
c&&(h%=U);f+=h;d*=b}return f}function Cb(a,b){var c=1,d=0,f=0,g=0;a=$jscomp.makeIterator(a);for(var h=a.next();!h.done;h=a.next()){var l=0,k=0;h=$jscomp.makeIterator(h.value);for(var n=h.next();!n.done;n=h.next()){var p=$jscomp.makeIterator(n.value);n=p.next().value;var q=p.next().value;p=p.next().value;q+=b*p;l+=n*p*Math.sin(q);0<g&&(k+=n*Math.cos(q))}f+=g*d*k-c*l;d=c;c*=b;++g}return f}function Db(a){return new B(a[0]+4.4036E-7*a[1]-1.90919E-7*a[2],-4.79966E-7*a[0]+.917482137087*a[1]-.397776982902*
a[2],.397776982902*a[1]+.917482137087*a[2])}function hc(a,b,c){var d=c*Math.cos(b);return[d*Math.cos(a),d*Math.sin(a),c*Math.sin(b)]}function Aa(a,b){var c=b.tt/365250,d=ma(a[0],c,!0),f=ma(a[1],c,!1);a=ma(a[2],c,!1);d=hc(d,f,a);return Db(d).ToAstroVector(b)}function Sa(a,b){var c=b/365250,d=ma(a[0],c,!0),f=ma(a[1],c,!1),g=ma(a[2],c,!1),h=Cb(a[0],c),l=Cb(a[1],c);c=Cb(a[2],c);var k=Math.cos(d),n=Math.sin(d),p=Math.cos(f),q=Math.sin(f);a=+(c*p*k)-g*q*k*l-g*p*n*h;h=+(c*p*n)-g*q*n*l+g*p*k*h;l=+(c*q)+g*
p*l;d=hc(d,f,g);f=[a/365250,h/365250,l/365250];d=Db(d);f=Db(f);return new X(b,d,f)}function jb(a,b,c,d){d/=d+2.959122082855911E-4;b=Aa(M[c],b);a.x+=d*b.x;a.y+=d*b.y;a.z+=d*b.z}function R(a,b,c,d){d/=d+2.959122082855911E-4;b=Sa(M[c],b);a.r.incr(b.r.mul(d));a.v.incr(b.v.mul(d));return b}function Ta(a,b,c){a=c.sub(a);c=a.quadrature();return a.mul(b/(c*Math.sqrt(c)))}function Ca(a,b,c,d){return new B(b.x+a*(c.x+a*d.x/2),b.y+a*(c.y+a*d.y/2),b.z+a*(c.z+a*d.z/2))}function Eb(a,b,c){return new B(b.x+a*c.x,
b.y+a*c.y,b.z+a*c.z)}function Fb(a,b){var c=a-b.tt,d=new Da(a),f=Ca(c,b.r,b.v,b.a),g=d.Acceleration(f).mean(b.a);f=Ca(c,b.r,b.v,g);b=b.v.add(g.mul(c));c=d.Acceleration(f);a=new Ua(a,f,b,c);return new ic(d,a)}function jc(a,b){a=Math.floor(a);return 0>a?0:a>=b?b-1:a}function Gb(a){var b=$jscomp.makeIterator(a);a=b.next().value;var c=$jscomp.makeIterator(b.next().value);var d=c.next().value;var f=c.next().value;c=c.next().value;var g=$jscomp.makeIterator(b.next().value);b=g.next().value;var h=g.next().value;
g=g.next().value;d=new X(a,new B(d,f,c),new B(b,h,g));a=new Da(d.tt);f=d.r.add(a.Sun.r);c=d.v.add(a.Sun.v);b=a.Acceleration(f);d=new Ua(d.tt,f,c,b);return new ic(a,d)}function kc(a,b,c){a=Gb(a);for(var d=Math.ceil((b-a.grav.tt)/c),f=0;f<d;++f)a=Fb(f+1===d?b:a.grav.tt+c,a.grav);return a}function Hb(a,b){var c=a.tt;var d=na[0][0];if(c<d||c>na[50][0])c=null;else{c=jc((c-d)/29200,50);if(!Ib[c]){d=Ib[c]=[];d[0]=Gb(na[c]).grav;d[200]=Gb(na[c+1]).grav;var f,g=d[0].tt;for(f=1;200>f;++f)d[f]=Fb(g+=146,d[f-
1]).grav;g=d[200].tt;var h=[];h[200]=d[200];for(f=199;0<f;--f)h[f]=Fb(g-=146,h[f+1]).grav;for(f=199;0<f;--f)g=f/200,d[f].r=d[f].r.mul(1-g).add(h[f].r.mul(g)),d[f].v=d[f].v.mul(1-g).add(h[f].v.mul(g)),d[f].a=d[f].a.mul(1-g).add(h[f].a.mul(g))}c=Ib[c]}if(d=c){f=jc((a.tt-d[0].tt)/146,200);c=d[f];g=d[f+1];var l=c.a.mean(g.a);f=Ca(a.tt-c.tt,c.r,c.v,l);d=Eb(a.tt-c.tt,c.v,l);h=Ca(a.tt-g.tt,g.r,g.v,l);g=Eb(a.tt-g.tt,g.v,l);l=(a.tt-c.tt)/146;c=f.mul(1-l).add(h.mul(l));d=d.mul(1-l).add(g.mul(l))}else{var k=
a.tt<na[0][0]?kc(na[0],a.tt,-146):kc(na[50],a.tt,146);c=k.grav.r;d=k.grav.v;k=k.bary}b&&(k||(k=new Da(a.tt)),c=c.sub(k.Sun.r),d=d.sub(k.Sun.v));return new I(c.x,c.y,c.z,d.x,d.y,d.z,a)}function kb(a,b){for(var c=a.tt+18262.5,d=[0,b.al[0]+c*b.al[1],0,0,0,0],f=$jscomp.makeIterator(b.a),g=f.next();!g.done;g=f.next()){var h=$jscomp.makeIterator(g.value);g=h.next().value;var l=h.next().value;h=h.next().value;d[0]+=g*Math.cos(l+c*h)}f=$jscomp.makeIterator(b.l);for(g=f.next();!g.done;g=f.next())h=$jscomp.makeIterator(g.value),
g=h.next().value,l=h.next().value,h=h.next().value,d[1]+=g*Math.sin(l+c*h);d[1]%=U;0>d[1]&&(d[1]+=U);f=$jscomp.makeIterator(b.z);for(g=f.next();!g.done;g=f.next())h=$jscomp.makeIterator(g.value),g=h.next().value,l=h.next().value,h=h.next().value,l+=c*h,d[2]+=g*Math.cos(l),d[3]+=g*Math.sin(l);f=$jscomp.makeIterator(b.zeta);for(g=f.next();!g.done;g=f.next())h=$jscomp.makeIterator(g.value),g=h.next().value,l=h.next().value,h=h.next().value,l+=c*h,d[4]+=g*Math.cos(l),d[5]+=g*Math.sin(l);f=d[0];h=d[1];
g=d[2];l=d[3];c=d[4];d=d[5];var k=Math.sqrt(b.mu/(f*f*f));b=h+g*Math.sin(h)-l*Math.cos(h);do{var n=Math.cos(b);var p=Math.sin(b);n=(h-b+g*p-l*n)/(1-g*n-l*p);b+=n}while(1E-12<=Math.abs(n));n=Math.cos(b);p=Math.sin(b);h=l*n-g*p;var q=-g*n-l*p,t=1/(1+q),y=1/(1+Math.sqrt(1-g*g-l*l));b=f*(n-g-y*l*h);h=f*(p-l+y*g*h);l=k*t*f*(-p-y*l*q);f=k*t*f*(+n+y*g*q);g=2*Math.sqrt(1-c*c-d*d);k=1-2*d*d;n=1-2*c*c;p=2*d*c;a=new I(b*k+h*p,b*p+h*n,(c*h-b*d)*g,l*k+f*p,l*p+f*n,(c*f-l*d)*g,a);return Ea(rd,a)}function Z(a,b){b=
v(b);if(a in M)return Aa(M[a],b);if(a===m.Pluto)return a=Hb(b,!0),new E(a.x,a.y,a.z,b);if(a===m.Sun)return new E(0,0,0,b);if(a===m.Moon){a=Aa(M.Earth,b);var c=Y(b);return new E(a.x+c.x,a.y+c.y,a.z+c.z,b)}if(a===m.EMB)return a=Aa(M.Earth,b),c=Y(b),new E(a.x+c.x/82.30056,a.y+c.y/82.30056,a.z+c.z/82.30056,b);if(a===m.SSB)return a=new E(0,0,0,b),jb(a,b,m.Jupiter,2.825345909524226E-7),jb(a,b,m.Saturn,8.459715185680659E-8),jb(a,b,m.Uranus,1.292024916781969E-8),jb(a,b,m.Neptune,1.524358900784276E-8),a;if(c=
ka(a))return a=new Ba(c.dec,15*c.ra,c.dist),lb(a,b);throw'HelioVector: Unknown body "'+a+'"';}function oa(a,b){var c=ka(a);if(c)return c.dist;b=v(b);return a in M?ma(M[a][2],b.tt/365250,!1):Z(a,b).Length()}function lc(a,b){for(var c=b,d=0,f=0;10>f;++f){var g=a(c);d=g.Length()/e.C_AUDAY;if(1<d)throw"Object is too distant for light-travel solver.";var h=b.AddDays(-d);d=Math.abs(h.tt-c.tt);if(1E-9>d)return g;c=h}throw"Light-travel time solver did not converge: dt = "+d;}function mc(a,b,c,d){A(d);a=v(a);
if(ka(c)){c=Z(c,a);if(d)return b=mb(b,a),d=new E(c.x-b.x,c.y-b.y,c.z-b.z,a),c=e.C_AUDAY/d.Length(),new E(d.x+b.vx/c,d.y+b.vy/c,d.z+b.vz/c,a);b=Z(b,a);return new E(c.x-b.x,c.y-b.y,c.z-b.z,a)}var f=d?new E(0,0,0,a):Z(b,a);var g=new nc(b,c,d,f);return lc(function(h){return g.Position(h)},a)}function W(a,b,c){A(c);b=v(b);switch(a){case m.Earth:return new E(0,0,0,b);case m.Moon:return Y(b);default:return a=mc(b,m.Earth,a,c),a.t=b,a}}function pa(a,b){return new I(a.r.x,a.r.y,a.r.z,a.v.x,a.v.y,a.v.z,b)}
function mb(a,b){b=v(b);switch(a){case m.Sun:return new I(0,0,0,0,0,0,b);case m.SSB:return a=new Da(b.tt),new I(-a.Sun.r.x,-a.Sun.r.y,-a.Sun.r.z,-a.Sun.v.x,-a.Sun.v.y,-a.Sun.v.z,b);case m.Mercury:case m.Venus:case m.Earth:case m.Mars:case m.Jupiter:case m.Saturn:case m.Uranus:case m.Neptune:return a=Sa(M[a],b.tt),pa(a,b);case m.Pluto:return Hb(b,!0);case m.Moon:case m.EMB:var c=Sa(M.Earth,b.tt);a=a==m.Moon?Ra(b):Bb(b);return new I(a.x+c.r.x,a.y+c.r.y,a.z+c.r.z,a.vx+c.v.x,a.vy+c.v.y,a.vz+c.v.z,b);
default:if(ka(a))return a=Z(a,b),new I(a.x,a.y,a.z,0,0,0,b);throw'HelioState: Unsupported body "'+a+'"';}}function sd(a,b,c,d,f){var g=(f+c)/2-d;c=(f-c)/2;if(0==g){if(0==c)return null;d=-d/c;if(-1>d||1<d)return null}else{d=c*c-4*g*d;if(0>=d)return null;f=Math.sqrt(d);d=(-c+f)/(2*g);f=(-c-f)/(2*g);if(-1<=d&&1>=d){if(-1<=f&&1>=f)return null}else if(-1<=f&&1>=f)d=f;else return null}return{t:a+d*b,df_dt:(2*g*d+c)/b}}function K(a,b,c,d){var f=w(d&&d.dt_tolerance_seconds||1);f=Math.abs(f/86400);var g=d&&
d.init_f1||a(b),h=d&&d.init_f2||a(c),l=NaN,k=0;d=d&&d.iter_limit||20;for(var n=!0;;){if(++k>d)throw"Excessive iteration in Search()";var p=new O(b.ut+.5*(c.ut-b.ut)),q=p.ut-b.ut;if(Math.abs(q)<f)return p;n?l=a(p):n=!0;var t=sd(p.ut,c.ut-p.ut,g,l,h);if(t){var y=v(t.t),x=a(y);if(0!==t.df_dt){if(Math.abs(x/t.df_dt)<f)return y;t=1.2*Math.abs(x/t.df_dt);if(t<q/10&&(q=y.AddDays(-t),y=y.AddDays(+t),0>(q.ut-b.ut)*(q.ut-c.ut)&&0>(y.ut-b.ut)*(y.ut-c.ut))){t=a(q);var z=a(y);if(0>t&&0<=z){g=t;h=z;b=q;c=y;l=x;
n=!1;continue}}}}if(0>g&&0<=l)c=p,h=l;else if(0>l&&0<=h)b=p,g=l;else return null}}function Fa(a){for(;-180>=a;)a+=360;for(;180<a;)a-=360;return a}function Ga(a){for(;0>a;)a+=360;for(;360<=a;)a-=360;return a}function oc(a,b,c){w(a);w(c);b=v(b);c=b.AddDays(c);return K(function(d){d=fc(d);return Fa(d.elon-a)},b,c,{dt_tolerance_seconds:.01})}function Jb(a,b,c){if(a===m.Earth||b===m.Earth)throw"The Earth does not have a longitude as seen from itself.";c=v(c);a=W(a,c,!1);a=Qa(a);b=W(b,c,!1);b=Qa(b);return Ga(a.elon-
b.elon)}function Ha(a,b){if(a==m.Earth)throw"The Earth does not have an angle as seen from itself.";var c=v(b);b=W(m.Sun,c,!0);a=W(a,c,!0);return N(b,a)}function qa(a,b){if(a===m.Sun)throw"Cannot calculate heliocentric longitude of the Sun.";a=Z(a,b);return Qa(a).elon}function nb(a,b){if(a===m.Earth)throw"The illumination of the Earth is not defined.";var c=v(b),d=Aa(M.Earth,c);if(a===m.Sun){var f=new E(-d.x,-d.y,-d.z,c);b=new E(0,0,0,c);d=0}else a===m.Moon?(f=Y(c),b=new E(d.x+f.x,d.y+f.y,d.z+f.z,
c)):(b=Z(a,b),f=new E(b.x-d.x,b.y-d.y,b.z-d.z,c)),d=N(f,b);var g=f.Length(),h=b.Length();if(a===m.Sun)var l=td+5*Math.log10(g);else if(a===m.Moon)a=d*e.DEG2RAD,l=a*a,a=-12.717+1.49*Math.abs(a)+.0431*l*l,l=a+=5*Math.log10(g/(385000.6/e.KM_PER_AU)*h);else if(a===m.Saturn){var k=d;a=Qa(f);l=28.06*e.DEG2RAD;var n=e.DEG2RAD*a.elat;a=Math.asin(Math.sin(n)*Math.cos(l)-Math.cos(n)*Math.sin(l)*Math.sin(e.DEG2RAD*a.elon-e.DEG2RAD*(169.51+3.82E-5*c.tt)));l=Math.sin(Math.abs(a));k=-9+.044*k+l*(-2.6+1.2*l)+5*
Math.log10(h*g);a*=e.RAD2DEG;l=k;k=a}else{var p=n=l=0;switch(a){case m.Mercury:a=-.6;l=4.98;n=-4.88;p=3.02;break;case m.Venus:163.6>d?(a=-4.47,l=1.03,n=.57,p=.13):(a=.98,l=-1.02);break;case m.Mars:a=-1.52;l=1.6;break;case m.Jupiter:a=-9.4;l=.5;break;case m.Uranus:a=-7.19;l=.25;break;case m.Neptune:a=-6.87;break;case m.Pluto:a=-1;l=4;break;default:throw"VisualMagnitude: unsupported body "+a;}var q=d/100;l=a+q*(l+q*(n+q*p))+5*Math.log10(h*g)}return new pc(c,l,d,h,g,f,b,k)}function Va(a){if(a===m.Earth)throw"The Earth does not have a synodic period as seen from itself.";
if(a===m.Moon)return 29.530588;var b=aa[a];if(!b)throw"Not a valid planet name: "+a;a=aa.Earth.OrbitalPeriod;return Math.abs(a/(a/b.OrbitalPeriod-1))}function Ia(a,b,c){function d(n){var p=qa(a,n);n=qa(m.Earth,n);return Fa(g*(n-p)-b)}w(b);var f=aa[a];if(!f)throw"Cannot search relative longitude because body is not a planet: "+a;if(a===m.Earth)throw"Cannot search relative longitude for the Earth (it is always 0)";var g=f.OrbitalPeriod>aa.Earth.OrbitalPeriod?1:-1;f=Va(a);c=v(c);var h=d(c);0<h&&(h-=
360);for(var l=0;100>l;++l){var k=-h/360*f;c=c.AddDays(k);if(1>86400*Math.abs(k))return c;k=h;h=d(c);30>Math.abs(k)&&k!==h&&(k/=k-h,.5<k&&2>k&&(f*=k))}throw"Relative longitude search failed to converge for "+a+" near "+c.toString()+" (error_angle = "+h+").";}function Kb(a){return Jb(m.Moon,m.Sun,a)}function Wa(a,b,c){function d(l){l=Kb(l);return Fa(l-a)}w(a);w(c);b=v(b);var f=d(b);if(0>c){0>f&&(f+=360);var g=-(29.530588*f)/360;f=g+1.5;if(f<c)return null;var h=Math.max(c,g-1.5)}else{0<f&&(f-=360);
g=-(29.530588*f)/360;h=g-1.5;if(h>c)return null;f=Math.min(c,g+1.5)}c=b.AddDays(h);b=b.AddDays(f);return K(d,c,b,{dt_tolerance_seconds:.1})}function qc(a){var b=Kb(a);b=(Math.floor(b/90)+1)%4;a=Wa(90*b,a,10);if(!a)throw"Cannot find moon quarter";return new rc(b,a)}function sc(a){if(!Number.isFinite(a)||-500>a||1E5<a)throw"Invalid elevation: "+a;if(11E3>=a){var b=288.15-.0065*a;a=101325*Math.pow(288.15/b,-5.25577)}else 2E4>=a?(b=216.65,a=22632*Math.exp(-1.5768832E-4*(a-11E3))):(b=216.65+.001*(a-2E4),
a=5474.87*Math.pow(216.65/b,34.16319));return new tc(a,b,a/b/(101325/288.15))}function Lb(a,b,c,d,f,g,h){if(0>g&&0<=h)return new ud(d,f,g,h);if(0<=g&&0>h)return null;if(17<a)throw"Excessive recursion in rise/set ascent search.";var l=f.ut-d.ut;if(1>86400*l||Math.min(Math.abs(g),Math.abs(h))>l/2*c)return null;l=new O((d.ut+f.ut)/2);var k=b(l);return Lb(1+a,b,c,d,l,g,k)||Lb(1+a,b,c,l,f,k,h)}function vd(a,b){if(-90>b||90<b)throw"Invalid geographic latitude: "+b;switch(a){case m.Moon:a=4.5;var c=8.2;
break;case m.Sun:a=.8;c=.5;break;case m.Mercury:a=-1.6;c=1;break;case m.Venus:a=-.8;c=.6;break;case m.Mars:a=-.5;c=.4;break;case m.Jupiter:case m.Saturn:case m.Uranus:case m.Neptune:case m.Pluto:a=-.2;c=.2;break;case m.Star1:case m.Star2:case m.Star3:case m.Star4:case m.Star5:case m.Star6:case m.Star7:case m.Star8:a=-.008;c=.008;break;default:throw"Body not allowed for altitude search: "+a;}b*=e.DEG2RAD;return Math.abs((360.98564540070413-a)*Math.cos(b))+Math.abs(c*Math.sin(b))}function uc(a,b,c,
d,f,g,h){function l(x){var z=Pa(a,x,b,!0,!0);x=hb(x,b,z.ra,z.dec).altitude+e.RAD2DEG*Math.asin(g/z.dist);return c*(x-h)}za(b);w(f);w(g);w(h);if(-90>h||90<h)throw"Invalid target altitude angle: "+h;for(var k=vd(a,b.latitude),n=d=v(d),p=d,q=l(n),t=q;;){0>f?(n=p.AddDays(-.42),q=l(n)):(p=n.AddDays(.42),t=l(p));var y=Lb(0,l,k,n,p,q,t);if(y){if(k=K(l,y.tx,y.ty,{dt_tolerance_seconds:.1,init_f1:y.ax,init_f2:y.ay})){if(0>f){if(k.ut<d.ut+f)return null}else if(k.ut>d.ut+f)return null;return k}throw"Rise/set search failed after finding ascent: t1="+
n+", t2="+p+", a1="+q+", a2="+t;}if(0>f){if(n.ut<d.ut+f)return null;p=n;t=q}else{if(p.ut>d.ut+f)return null;n=p;q=t}}}function vc(a,b){b=v(b);var c=Jb(a,m.Sun,b);if(180<c){var d="morning";c=360-c}else d="evening";a=Ha(a,b);return new wc(b,d,a,c)}function xc(a){function b(l){var k=l.AddDays(-5E-4);l=l.AddDays(5E-4);k=ea(k).distance_au;return(ea(l).distance_au-k)/.001}function c(l){return-b(l)}a=v(a);for(var d=b(a),f=0;59.061176>5*f;++f){var g=a.AddDays(5),h=b(g);if(0>=d*h){if(0>d||0<h){a=K(b,a,g,{init_f1:d,
init_f2:h});if(!a)throw"SearchLunarApsis INTERNAL ERROR: perigee search failed!";d=ea(a).distance_au;return new Xa(a,0,d)}if(0<d||0>h){a=K(c,a,g,{init_f1:-d,init_f2:-h});if(!a)throw"SearchLunarApsis INTERNAL ERROR: apogee search failed!";d=ea(a).distance_au;return new Xa(a,1,d)}throw"SearchLunarApsis INTERNAL ERROR: cannot classify apsis event!";}a=g;d=h}throw"SearchLunarApsis INTERNAL ERROR: could not find apsis within 2 synodic months of start date.";}function yc(a,b,c,d){for(var f=b===Ja.Apocenter?
1:-1;;){d/=9;if(d<1/1440)return c=c.AddDays(d/2),a=oa(a,c),new Xa(c,b,a);for(var g=-1,h=0,l=0;10>l;++l){var k=c.AddDays(l*d);k=f*oa(a,k);if(0==l||k>h)g=l,h=k}c=c.AddDays((g-1)*d);d*=2}}function wd(a,b){var c=b.AddDays(-30/360*aa[a].OrbitalPeriod),d=b.AddDays(.75*aa[a].OrbitalPeriod),f=c,g=c,h=-1,l=-1;d=(d.ut-c.ut)/99;for(var k=0;100>k;++k){var n=c.AddDays(k*d),p=oa(a,n);0===k?l=h=p:(p>l&&(l=p,g=n),p<h&&(h=p,f=n))}c=yc(a,0,f.AddDays(-2*d),4*d);a=yc(a,1,g.AddDays(-2*d),4*d);if(c.time.tt>=b.tt)return a.time.tt>=
b.tt&&a.time.tt<c.time.tt?a:c;if(a.time.tt>=b.tt)return a;throw"Internal error: failed to find Neptune apsis.";}function zc(a,b){function c(p){var q=p.AddDays(-5E-4);p=p.AddDays(5E-4);q=oa(a,q);return(oa(a,p)-q)/.001}function d(p){return-c(p)}b=v(b);if(a===m.Neptune||a===m.Pluto)return wd(a,b);for(var f=aa[a].OrbitalPeriod,g=f/6,h=c(b),l=0;l*g<2*f;++l){var k=b.AddDays(g),n=c(k);if(0>=h*n){f=g=void 0;if(0>h||0<n)g=c,f=Ja.Pericenter;else if(0<h||0>n)g=d,f=Ja.Apocenter;else throw"Internal error with slopes in SearchPlanetApsis";
b=K(g,b,k);if(!b)throw"Failed to find slope transition in planetary apsis search.";h=oa(a,b);return new Xa(b,f,h)}b=k;h=n}throw"Internal error: should have found planetary apsis within 2 orbital periods.";}function Ka(a){return new J([[a.rot[0][0],a.rot[1][0],a.rot[2][0]],[a.rot[0][1],a.rot[1][1],a.rot[2][1]],[a.rot[0][2],a.rot[1][2],a.rot[2][2]]])}function ja(a,b){return new J([[b.rot[0][0]*a.rot[0][0]+b.rot[1][0]*a.rot[0][1]+b.rot[2][0]*a.rot[0][2],b.rot[0][1]*a.rot[0][0]+b.rot[1][1]*a.rot[0][1]+
b.rot[2][1]*a.rot[0][2],b.rot[0][2]*a.rot[0][0]+b.rot[1][2]*a.rot[0][1]+b.rot[2][2]*a.rot[0][2]],[b.rot[0][0]*a.rot[1][0]+b.rot[1][0]*a.rot[1][1]+b.rot[2][0]*a.rot[1][2],b.rot[0][1]*a.rot[1][0]+b.rot[1][1]*a.rot[1][1]+b.rot[2][1]*a.rot[1][2],b.rot[0][2]*a.rot[1][0]+b.rot[1][2]*a.rot[1][1]+b.rot[2][2]*a.rot[1][2]],[b.rot[0][0]*a.rot[2][0]+b.rot[1][0]*a.rot[2][1]+b.rot[2][0]*a.rot[2][2],b.rot[0][1]*a.rot[2][0]+b.rot[1][1]*a.rot[2][1]+b.rot[2][1]*a.rot[2][2],b.rot[0][2]*a.rot[2][0]+b.rot[1][2]*a.rot[2][1]+
b.rot[2][2]*a.rot[2][2]]])}function lb(a,b){b=v(b);var c=a.lat*e.DEG2RAD,d=a.lon*e.DEG2RAD,f=a.dist*Math.cos(c);return new E(f*Math.cos(d),f*Math.sin(d),a.dist*Math.sin(c),b)}function Mb(a){var b=Nb(a);return new gb(b.lon/15,b.lat,b.dist,a)}function Nb(a){var b=a.x*a.x+a.y*a.y,c=Math.sqrt(b+a.z*a.z);if(0===b){if(0===a.z)throw"Zero-length vector not allowed.";var d=0;a=0>a.z?-90:90}else d=e.RAD2DEG*Math.atan2(a.y,a.x),0>d&&(d+=360),a=e.RAD2DEG*Math.atan2(a.z,Math.sqrt(b));return new Ba(a,d,c)}function Ac(a){a=
360-a;360<=a?a-=360:0>a&&(a+=360);return a}function Oa(a,b){w(b);if(-90>b||90<b)return 0;if("normal"===a||"jplhor"===a){var c=b;-1>c&&(c=-1);c=1.02/Math.tan((c+10.3/(c+5.11))*e.DEG2RAD)/60;"normal"===a&&-1>b&&(c*=(b+90)/89)}else{if(a)throw"Invalid refraction option: "+a;c=0}return c}function Bc(a,b){if(-90>b||90<b)return 0;for(var c=b-Oa(a,b);;){var d=c+Oa(a,c)-b;if(1E-14>Math.abs(d))return c-b;c-=d}}function Ya(a,b){return new E(a.rot[0][0]*b.x+a.rot[1][0]*b.y+a.rot[2][0]*b.z,a.rot[0][1]*b.x+a.rot[1][1]*
b.y+a.rot[2][1]*b.z,a.rot[0][2]*b.x+a.rot[1][2]*b.y+a.rot[2][2]*b.z,b.t)}function Ea(a,b){return new I(a.rot[0][0]*b.x+a.rot[1][0]*b.y+a.rot[2][0]*b.z,a.rot[0][1]*b.x+a.rot[1][1]*b.y+a.rot[2][1]*b.z,a.rot[0][2]*b.x+a.rot[1][2]*b.y+a.rot[2][2]*b.z,a.rot[0][0]*b.vx+a.rot[1][0]*b.vy+a.rot[2][0]*b.vz,a.rot[0][1]*b.vx+a.rot[1][1]*b.vy+a.rot[2][1]*b.vz,a.rot[0][2]*b.vx+a.rot[1][2]*b.vy+a.rot[2][2]*b.vz,b.t)}function Cc(){return new J([[1,0,0],[0,.9174821430670688,-.3977769691083922],[0,.3977769691083922,
.9174821430670688]])}function ob(a){a=v(a);var b=Ma(a,F.From2000);a=Na(a,F.From2000);return ja(b,a)}function pb(a){a=v(a);var b=Na(a,F.Into2000);a=Ma(a,F.Into2000);return ja(b,a)}function Ob(a,b){a=v(a);var c=Math.sin(b.latitude*e.DEG2RAD),d=Math.cos(b.latitude*e.DEG2RAD),f=Math.sin(b.longitude*e.DEG2RAD),g=Math.cos(b.longitude*e.DEG2RAD);b=[d*g,d*f,c];c=[-c*g,-c*f,d];f=[f,-g,0];a=-15*ca(a);b=ya(a,b);c=ya(a,c);a=ya(a,f);return new J([[c[0],a[0],b[0]],[c[1],a[1],b[1]],[c[2],a[2],b[2]]])}function Dc(a,
b){a=Ob(a,b);return Ka(a)}function Ec(a,b){a=v(a);b=Dc(a,b);a=pb(a);return ja(b,a)}function Fc(a){a=pb(a);var b=Cc();return ja(a,b)}function Gc(a){a=Fc(a);return Ka(a)}function Hc(a,b){a=v(a);var c=Gc(a);a=Ob(a,b);return ja(c,a)}function Ic(a){var b=da(v(a)).tobl*e.DEG2RAD;a=Math.cos(b);b=Math.sin(b);return new J([[1,0,0],[0,+a,+b],[0,-b,+a]])}function Jc(a){var b=da(v(a)).tobl*e.DEG2RAD;a=Math.cos(b);b=Math.sin(b);return new J([[1,0,0],[0,+a,-b],[0,+b,+a]])}function Za(a,b,c,d){var f=(d.x*c.x+d.y*
c.y+d.z*c.z)/(d.x*d.x+d.y*d.y+d.z*d.z);return new xd(b,f,e.KM_PER_AU*Math.hypot(f*d.x-c.x,f*d.y-c.y,f*d.z-c.z),695700-(1+f)*(695700-a),-695700+(1+f)*(695700+a),c,d)}function qb(a){var b=W(m.Sun,a,!0);b=new E(-b.x,-b.y,-b.z,b.t);var c=Y(a);return Za(6459,a,c,b)}function Kc(a){var b=W(m.Sun,a,!0),c=Y(a),d=new E(-c.x,-c.y,-c.z,c.t);c.x-=b.x;c.y-=b.y;c.z-=b.z;return Za(1737.4,a,d,c)}function Pb(a,b){var c=cc(a,b);b=W(m.Sun,a,!0);var d=Y(a);c=new E(c[0]-d.x,c[1]-d.y,c[2]-d.z,a);d.x-=b.x;d.y-=b.y;d.z-=
b.z;return Za(1737.4,a,c,d)}function rb(a,b,c){a=W(a,c,!0);var d=W(m.Sun,c,!0),f=new E(a.x-d.x,a.y-d.y,a.z-d.z,c);d.x=-a.x;d.y=-a.y;d.z=-a.z;return Za(b,c,d,f)}function Qb(a,b){var c=1/86400,d=b.AddDays(-c);b=b.AddDays(+c);d=a(d);return(a(b).r-d.r)/c}function yd(a){var b=a.AddDays(-.03);a=a.AddDays(.03);b=K(function(c){return Qb(qb,c)},b,a);if(!b)throw"Failed to find peak Earth shadow time.";return qb(b)}function zd(a){var b=a.AddDays(-.03);a=a.AddDays(.03);b=K(function(c){return Qb(Kc,c)},b,a);if(!b)throw"Failed to find peak Moon shadow time.";
return Kc(b)}function Ad(a,b,c){var d=c.AddDays(-1);c=c.AddDays(1);d=K(function(f){var g=1/86400,h=rb(a,b,f.AddDays(-g));return(rb(a,b,f.AddDays(+g)).r-h.r)/g},d,c);if(!d)throw"Failed to find peak planet shadow time.";return rb(a,b,d)}function Bd(a,b){function c(g){return Pb(g,b)}var d=a.AddDays(-.2),f=a.AddDays(.2);d=K(function(g){return Qb(c,g)},d,f);if(!d)throw"PeakLocalMoonShadow: search failure for search_center_time = "+a;return Pb(d,b)}function Rb(a,b,c){var d=c/1440;c=a.AddDays(-d);d=a.AddDays(+d);
c=K(function(f){return-(qb(f).r-b)},c,a);a=K(function(f){return+(qb(f).r-b)},a,d);if(!c||!a)throw"Failed to find shadow semiduration";return 720*(a.ut-c.ut)}function Sb(a){a=ea(a);return e.RAD2DEG*a.geo_eclip_lat}function Lc(a,b,c){if(0>=a)throw"Radius of first disc must be positive.";if(0>=b)throw"Radius of second disc must be positive.";if(0>c)throw"Distance between discs is not allowed to be negative.";if(c>=a+b)return 0;if(0==c)return a<=b?1:b*b/(a*a);var d=(a*a-b*b+c*c)/(2*c),f=a*a-d*d;if(0>=
f)return a<=b?1:b*b/(a*a);f=Math.sqrt(f);return(a*a*Math.acos(d/a)-d*f+(b*b*Math.acos((c-d)/b)-(c-d)*f))/(Math.PI*a*a)}function Mc(a,b){var c=new E(a.x+b.x,a.y+b.y,a.z+b.z,a.t);a=Math.asin(Nc/c.Length());var d=Math.asin(Cd/b.Length());b=N(b,c);b=Lc(a,d,b*e.DEG2RAD);return Math.min(.9999,b)}function Oc(a){a=v(a);for(var b=0;12>b;++b){var c=Wa(180,a,40);if(!c)throw"Cannot find full moon.";a=Sb(c);if(1.8>Math.abs(a)&&(a=yd(c),a.r<a.p+1737.4)){b=S.Penumbral;var d=c=0,f=0,g=Rb(a.time,a.p+1737.4,200);a.r<
a.k+1737.4&&(b=S.Partial,f=Rb(a.time,a.k+1737.4,g),a.r+1737.4<a.k?(b=S.Total,c=1,d=Rb(a.time,a.k-1737.4,f)):c=Lc(1737.4,a.k,a.r));return new Pc(b,c,a.time,g,f,d)}a=c.AddDays(10)}throw"Failed to find lunar eclipse within 12 full moons.";}function Qc(a){a=v(a);var b;for(b=0;12>b;++b){var c=Wa(0,a,40);if(!c)throw"Cannot find new moon";a=Sb(c);if(1.8>Math.abs(a)&&(a=zd(c),a.r<a.p+6371)){var d=void 0,f=void 0,g=S.Partial;b=a.time;c=a.r;var h=ob(a.time),l=Ya(h,a.dir),k=Ya(h,a.target);l.x*=e.KM_PER_AU;l.y*=
e.KM_PER_AU;l.z*=e.KM_PER_AU/.996647180302104;k.x*=e.KM_PER_AU;k.y*=e.KM_PER_AU;k.z*=e.KM_PER_AU/.996647180302104;var n=l.x*l.x+l.y*l.y+l.z*l.z,p=-2*(l.x*k.x+l.y*k.y+l.z*k.z),q=p*p-4*n*(k.x*k.x+k.y*k.y+k.z*k.z-4.068062648825956E7);if(0<q){f=(-p-Math.sqrt(q))/(2*n);g=f*l.x-k.x;n=f*l.y-k.y;l=.996647180302104*(f*l.z-k.z);f=.9933056020041345*Math.hypot(g,n);f=0==f?0<l?90:-90:e.RAD2DEG*Math.atan(l/f);d=ca(b);d=(e.RAD2DEG*Math.atan2(n,g)-15*d)%360;-180>=d?d+=360:180<d&&(d-=360);h=Ka(h);l=new E(g/e.KM_PER_AU,
n/e.KM_PER_AU,l/e.KM_PER_AU,a.time);l=Ya(h,l);l.x+=a.target.x;l.y+=a.target.y;l.z+=a.target.z;h=Za(1736,a.time,l,a.dir);if(1E-9<h.r||0>h.r)throw"Unexpected shadow distance from geoid intersection = "+h.r;g=.014<h.k?S.Total:S.Annular;a=g===S.Total?1:Mc(a.dir,l)}else a=void 0;return new Rc(g,a,b,c,f,d)}a=c.AddDays(10)}throw"Failed to find solar eclipse within 12 full moons.";}function Sc(a){return a.p-a.r}function Tc(a){return Math.abs(a.k)-a.r}function sb(a,b,c,d,f){d=K(function(g){g=Pb(g,a);return b*
c(g)},d,f);if(!d)throw"Local eclipse transition search failed.";return Uc(a,d)}function Uc(a,b){var c=Pa(m.Sun,b,a,!0,!0);a=hb(b,a,c.ra,c.dec,"normal").altitude;return new Vc(b,a)}function Wc(a,b){a=v(a);for(za(b);;){a=Wa(0,a,40);if(!a)throw"Cannot find next new moon";var c=Sb(a);if(1.8>Math.abs(c)){var d=Bd(a,b);if(d.r<d.p){var f=c=void 0;var g=b;var h=Uc(g,d.time),l=d.time.AddDays(-.2),k=d.time.AddDays(.2),n=sb(g,1,Sc,l,d.time),p=sb(g,-1,Sc,d.time,k);d.r<Math.abs(d.k)?(l=d.time.AddDays(-.01),k=
d.time.AddDays(.01),f=sb(g,1,Tc,l,d.time),c=sb(g,-1,Tc,d.time,k),g=.014<d.k?S.Total:S.Annular):g=S.Partial;d=g===S.Total?1:Mc(d.dir,d.target);c=new Xc(g,d,n,f,h,c,p);if(0<c.partial_begin.altitude||0<c.partial_end.altitude)return c}}a=a.AddDays(10)}}function Yc(a,b,c,d,f){c=K(function(g){g=rb(a,b,g);return f*(g.r-g.p)},c,d);if(!c)throw"Planet transit boundary search failed";return c}function Zc(a,b){b=v(b);switch(a){case m.Mercury:var c=2439.7;break;case m.Venus:c=6051.8;break;default:throw"Invalid body: "+
a;}for(;;){var d=Ia(a,0,b);if(.4>Ha(a,d)&&(b=Ad(a,c,d),b.r<b.p)){d=b.time.AddDays(-1);d=Yc(a,c,d,b.time,-1);var f=b.time.AddDays(1);c=Yc(a,c,b.time,f,1);a=60*Ha(a,b.time);return new $c(d,b.time,c,a)}b=d.AddDays(10)}}function ad(a){var b=v(a),c=ib(b);for(a={};;a={$jscomp$loop$prop$kind$33:a.$jscomp$loop$prop$kind$33}){var d=b.AddDays(10),f=ib(d);if(0>=c.lat*f.lat){a.$jscomp$loop$prop$kind$33=f.lat>c.lat?ra.Ascending:ra.Descending;b=K(function(g){return function(h){return g.$jscomp$loop$prop$kind$33*
ib(h).lat}}(a),b,d);if(!b)throw"Could not find moon node.";return new bd(a.$jscomp$loop$prop$kind$33,b)}b=d;c=f}}function cd(a,b,c,d,f){if(1>a||5<a)throw"Invalid lagrange point "+a;if(!Number.isFinite(c)||0>=c)throw"Major mass must be a positive number.";if(!Number.isFinite(f)||0>=f)throw"Minor mass must be a negative number.";var g=d.x-b.x,h=d.y-b.y,l=d.z-b.z,k=g*g+h*h+l*l,n=Math.sqrt(k),p=d.vx-b.vx,q=d.vy-b.vy;d=d.vz-b.vz;if(4===a||5===a){k=h*d-l*q;c=l*p-g*d;var t=g*q-h*p,y=c*l-t*h;t=t*g-k*l;k=
k*h-c*g;c=Math.sqrt(y*y+t*t+k*k);y/=c;t/=c;k/=c;g/=n;h/=n;l/=n;a=4==a?.8660254037844386:-.8660254037844386;c=.5*g+a*y;f=.5*h+a*t;var x=.5*l+a*k,z=p*g+q*h+d*l;p=p*y+q*t+d*k;b=new I(n*c,n*f,n*x,z*c+p*(.5*y-a*g),z*f+p*(.5*t-a*h),z*x+p*(.5*k-a*l),b.t)}else{y=f/(c+f)*-n;t=c/(c+f)*+n;k=(c+f)/(k*n);if(1===a||2===a)x=c/(c+f)*Math.cbrt(f/(3*c)),c=-c,1==a?(x=1-x,a=+f):(x=1+x,a=-f);else if(3===a)x=(7/12*f-c)/(f+c),c=+c,a=+f;else throw"Invalid Langrage point "+a+". Must be an integer 1..5.";f=n*x-y;do x=f-y,
z=f-t,x=(k*f+c/(x*x)+a/(z*z))/(k-2*c/(x*x*x)-2*a/(z*z*z)),f-=x;while(1E-14<Math.abs(x/n));x=(f-y)/n;b=new I(x*g,x*h,x*l,x*p,x*q,x*d,b.t)}return b}Object.defineProperty(e,"__esModule",{value:!0});e.GeoEmbState=e.GeoMoonState=e.EclipticGeoMoon=e.GeoMoon=e.Ecliptic=e.ObserverGravity=e.VectorObserver=e.ObserverState=e.ObserverVector=e.Equator=e.SunPosition=e.Observer=e.Horizon=e.EclipticCoordinates=e.HorizontalCoordinates=e.MakeRotation=e.RotationMatrix=e.EquatorialCoordinates=e.Spherical=e.StateVector=
e.Vector=e.SiderealTime=e.Libration=e.LibrationInfo=e.CalcMoonCount=e.e_tilt=e.MakeTime=e.AstroTime=e.SetDeltaTFunction=e.DeltaT_JplHorizons=e.DeltaT_EspenakMeeus=e.PlanetOrbitalPeriod=e.DefineStar=e.Body=e.AngleBetween=e.MassProduct=e.CALLISTO_RADIUS_KM=e.GANYMEDE_RADIUS_KM=e.EUROPA_RADIUS_KM=e.IO_RADIUS_KM=e.JUPITER_MEAN_RADIUS_KM=e.JUPITER_POLAR_RADIUS_KM=e.JUPITER_EQUATORIAL_RADIUS_KM=e.RAD2HOUR=e.RAD2DEG=e.HOUR2RAD=e.DEG2RAD=e.AU_PER_LY=e.KM_PER_AU=e.C_AUDAY=void 0;e.VectorFromHorizon=e.HorizonFromVector=
e.SphereFromVector=e.EquatorFromVector=e.VectorFromSphere=e.Pivot=e.IdentityMatrix=e.CombineRotation=e.InverseRotation=e.NextPlanetApsis=e.SearchPlanetApsis=e.NextLunarApsis=e.SearchLunarApsis=e.Apsis=e.ApsisKind=e.SearchPeakMagnitude=e.SearchMaxElongation=e.Elongation=e.ElongationEvent=e.Seasons=e.SeasonInfo=e.HourAngle=e.SearchHourAngle=e.HourAngleEvent=e.SearchAltitude=e.SearchRiseSet=e.Atmosphere=e.AtmosphereInfo=e.NextMoonQuarter=e.SearchMoonQuarter=e.MoonQuarter=e.SearchMoonPhase=e.MoonPhase=
e.SearchRelativeLongitude=e.Illumination=e.IlluminationInfo=e.EclipticLongitude=e.AngleFromSun=e.PairLongitude=e.SearchSunLongitude=e.Search=e.HelioState=e.BaryState=e.GeoVector=e.BackdatePosition=e.CorrectLightTravel=e.HelioDistance=e.HelioVector=e.JupiterMoons=e.JupiterMoonsInfo=void 0;e.GravitySimulator=e.LagrangePointFast=e.LagrangePoint=e.RotationAxis=e.AxisInfo=e.NextMoonNode=e.SearchMoonNode=e.NodeEventInfo=e.NodeEventKind=e.NextTransit=e.SearchTransit=e.TransitInfo=e.NextLocalSolarEclipse=
e.SearchLocalSolarEclipse=e.LocalSolarEclipseInfo=e.EclipseEvent=e.NextGlobalSolarEclipse=e.SearchGlobalSolarEclipse=e.NextLunarEclipse=e.GlobalSolarEclipseInfo=e.SearchLunarEclipse=e.LunarEclipseInfo=e.EclipseKind=e.Constellation=e.ConstellationInfo=e.Rotation_EQD_ECT=e.Rotation_ECT_EQD=e.Rotation_GAL_EQJ=e.Rotation_EQJ_GAL=e.Rotation_HOR_ECL=e.Rotation_ECL_HOR=e.Rotation_ECL_EQD=e.Rotation_EQD_ECL=e.Rotation_EQJ_HOR=e.Rotation_HOR_EQJ=e.Rotation_HOR_EQD=e.Rotation_EQD_HOR=e.Rotation_EQD_EQJ=e.Rotation_ECT_EQJ=
e.Rotation_EQJ_ECT=e.Rotation_EQJ_EQD=e.Rotation_ECL_EQJ=e.Rotation_EQJ_ECL=e.RotateState=e.RotateVector=e.InverseRefraction=e.Refraction=void 0;e.C_AUDAY=173.1446326846693;e.KM_PER_AU=1.4959787069098932E8;e.AU_PER_LY=63241.07708807546;e.DEG2RAD=.017453292519943295;e.HOUR2RAD=.26179938779914946;e.RAD2DEG=57.29577951308232;e.RAD2HOUR=3.819718634205488;e.JUPITER_EQUATORIAL_RADIUS_KM=71492;e.JUPITER_POLAR_RADIUS_KM=66854;e.JUPITER_MEAN_RADIUS_KM=69911;e.IO_RADIUS_KM=1821.6;e.EUROPA_RADIUS_KM=1560.8;
e.GANYMEDE_RADIUS_KM=2631.2;e.CALLISTO_RADIUS_KM=2410.3;var dd=new Date("2000-01-01T12:00:00Z"),U=2*Math.PI,ia=180/Math.PI*3600,td=-.17-5*Math.log10(648E3/Math.PI),Nc=695700/e.KM_PER_AU,pd=6378.1366/e.KM_PER_AU,Dd=1738.1/e.KM_PER_AU,Cd=1736/e.KM_PER_AU,Ed=34/60;e.MassProduct=C;e.AngleBetween=N;var m;(function(a){a.Sun="Sun";a.Moon="Moon";a.Mercury="Mercury";a.Venus="Venus";a.Earth="Earth";a.Mars="Mars";a.Jupiter="Jupiter";a.Saturn="Saturn";a.Uranus="Uranus";a.Neptune="Neptune";a.Pluto="Pluto";a.SSB=
"SSB";a.EMB="EMB";a.Star1="Star1";a.Star2="Star2";a.Star3="Star3";a.Star4="Star4";a.Star5="Star5";a.Star6="Star6";a.Star7="Star7";a.Star8="Star8"})(m=e.Body||(e.Body={}));var ld=[m.Star1,m.Star2,m.Star3,m.Star4,m.Star5,m.Star6,m.Star7,m.Star8],md=[{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0}];e.DefineStar=function(a,b,c,d){var f=T(a);if(!f)throw"Invalid star body: "+a;w(b);w(c);w(d);
if(0>b||24<=b)throw"Invalid right ascension for star: "+b;if(-90>c||90<c)throw"Invalid declination for star: "+c;if(1>d)throw"Invalid star distance: "+d;f.ra=b;f.dec=c;f.dist=d*e.AU_PER_LY};var F;(function(a){a[a.From2000=0]="From2000";a[a.Into2000=1]="Into2000"})(F||(F={}));var aa={Mercury:{OrbitalPeriod:87.969},Venus:{OrbitalPeriod:224.701},Earth:{OrbitalPeriod:365.256},Mars:{OrbitalPeriod:686.98},Jupiter:{OrbitalPeriod:4332.589},Saturn:{OrbitalPeriod:10759.22},Uranus:{OrbitalPeriod:30685.4},Neptune:{OrbitalPeriod:60189},
Pluto:{OrbitalPeriod:90560}};e.PlanetOrbitalPeriod=function(a){if(a in aa)return aa[a].OrbitalPeriod;throw"Unknown orbital period for: "+a;};var M={Mercury:[[[[4.40250710144,0,0],[.40989414977,1.48302034195,26087.9031415742],[.050462942,4.47785489551,52175.8062831484],[.00855346844,1.16520322459,78263.70942472259],[.00165590362,4.11969163423,104351.61256629678],[3.4561897E-4,.77930768443,130439.51570787099],[7.583476E-5,3.71348404924,156527.41884944518]],[[26087.90313685529,0,0],[.01131199811,6.21874197797,
26087.9031415742],[.00292242298,3.04449355541,52175.8062831484],[7.5775081E-4,6.08568821653,78263.70942472259],[1.9676525E-4,2.80965111777,104351.61256629678]]],[[[.11737528961,1.98357498767,26087.9031415742],[.02388076996,5.03738959686,52175.8062831484],[.01222839532,3.14159265359,0],[.0054325181,1.79644363964,78263.70942472259],[.0012977877,4.83232503958,104351.61256629678],[3.1866927E-4,1.58088495658,130439.51570787099],[7.963301E-5,4.60972126127,156527.41884944518]],[[.00274646065,3.95008450011,
26087.9031415742],[9.9737713E-4,3.14159265359,0]]],[[[.39528271651,0,0],[.07834131818,6.19233722598,26087.9031415742],[.00795525558,2.95989690104,52175.8062831484],[.00121281764,6.01064153797,78263.70942472259],[2.1921969E-4,2.77820093972,104351.61256629678],[4.354065E-5,5.82894543774,130439.51570787099]],[[.0021734774,4.65617158665,26087.9031415742],[4.4141826E-4,1.42385544001,52175.8062831484]]]],Venus:[[[[3.17614666774,0,0],[.01353968419,5.59313319619,10213.285546211],[8.9891645E-4,5.30650047764,
20426.571092422],[5.477194E-5,4.41630661466,7860.4193924392],[3.455741E-5,2.6996444782,11790.6290886588],[2.372061E-5,2.99377542079,3930.2096962196],[1.317168E-5,5.18668228402,26.2983197998],[1.664146E-5,4.25018630147,1577.3435424478],[1.438387E-5,4.15745084182,9683.5945811164],[1.200521E-5,6.15357116043,30639.856638633]],[[10213.28554621638,0,0],[9.5617813E-4,2.4640651111,10213.285546211],[7.787201E-5,.6247848222,20426.571092422]]],[[[.05923638472,.26702775812,10213.285546211],[4.0107978E-4,1.14737178112,
20426.571092422],[3.2814918E-4,3.14159265359,0]],[[.00287821243,1.88964962838,10213.285546211]]],[[[.72334820891,0,0],[.00489824182,4.02151831717,10213.285546211],[1.658058E-5,4.90206728031,20426.571092422],[1.378043E-5,1.12846591367,11790.6290886588],[1.632096E-5,2.84548795207,7860.4193924392],[4.98395E-6,2.58682193892,9683.5945811164],[2.21985E-6,2.01346696541,19367.1891622328],[2.37454E-6,2.55136053886,15720.8387848784]],[[3.4551041E-4,.89198706276,10213.285546211]]]],Earth:[[[[1.75347045673,0,
0],[.03341656453,4.66925680415,6283.0758499914],[3.4894275E-4,4.62610242189,12566.1516999828],[3.417572E-5,2.82886579754,3.523118349],[3.497056E-5,2.74411783405,5753.3848848968],[3.135899E-5,3.62767041756,77713.7714681205],[2.676218E-5,4.41808345438,7860.4193924392],[2.342691E-5,6.13516214446,3930.2096962196],[1.273165E-5,2.03709657878,529.6909650946],[1.324294E-5,.74246341673,11506.7697697936],[9.01854E-6,2.04505446477,26.2983197998],[1.199167E-5,1.10962946234,1577.3435424478],[8.57223E-6,3.50849152283,
398.1490034082],[7.79786E-6,1.17882681962,5223.6939198022],[9.9025E-6,5.23268072088,5884.9268465832],[7.53141E-6,2.53339052847,5507.5532386674],[5.05267E-6,4.58292599973,18849.2275499742],[4.92392E-6,4.20505711826,775.522611324],[3.56672E-6,2.91954114478,.0673103028],[2.84125E-6,1.89869240932,796.2980068164],[2.42879E-6,.34481445893,5486.777843175],[3.17087E-6,5.84901948512,11790.6290886588],[2.71112E-6,.31486255375,10977.078804699],[2.06217E-6,4.80646631478,2544.3144198834],[2.05478E-6,1.86953770281,
5573.1428014331],[2.02318E-6,2.45767790232,6069.7767545534],[1.26225E-6,1.08295459501,20.7753954924],[1.55516E-6,.83306084617,213.299095438]],[[6283.0758499914,0,0],[.00206058863,2.67823455808,6283.0758499914],[4.303419E-5,2.63512233481,12566.1516999828]],[[8.721859E-5,1.07253635559,6283.0758499914]]],[[],[[.00227777722,3.4137662053,6283.0758499914],[3.805678E-5,3.37063423795,12566.1516999828]]],[[[1.00013988784,0,0],[.01670699632,3.09846350258,6283.0758499914],[1.3956024E-4,3.05524609456,12566.1516999828],
[3.08372E-5,5.19846674381,77713.7714681205],[1.628463E-5,1.17387558054,5753.3848848968],[1.575572E-5,2.84685214877,7860.4193924392],[9.24799E-6,5.45292236722,11506.7697697936],[5.42439E-6,4.56409151453,3930.2096962196],[4.7211E-6,3.66100022149,5884.9268465832],[8.5831E-7,1.27079125277,161000.6857376741],[5.7056E-7,2.01374292245,83996.84731811189],[5.5736E-7,5.2415979917,71430.69561812909],[1.74844E-6,3.01193636733,18849.2275499742],[2.43181E-6,4.2734953079,11790.6290886588]],[[.00103018607,1.10748968172,
6283.0758499914],[1.721238E-5,1.06442300386,12566.1516999828]],[[4.359385E-5,5.78455133808,6283.0758499914]]]],Mars:[[[[6.20347711581,0,0],[.18656368093,5.0503710027,3340.6124266998],[.01108216816,5.40099836344,6681.2248533996],[9.1798406E-4,5.75478744667,10021.8372800994],[2.7744987E-4,5.97049513147,3.523118349],[1.0610235E-4,2.93958560338,2281.2304965106],[1.2315897E-4,.84956094002,2810.9214616052],[8.926784E-5,4.15697846427,.0172536522],[8.715691E-5,6.11005153139,13362.4497067992],[6.797556E-5,
.36462229657,398.1490034082],[7.774872E-5,3.33968761376,5621.8429232104],[3.575078E-5,1.6618650571,2544.3144198834],[4.161108E-5,.22814971327,2942.4634232916],[3.075252E-5,.85696614132,191.4482661116],[2.628117E-5,.64806124465,3337.0893083508],[2.937546E-5,6.07893711402,.0673103028],[2.389414E-5,5.03896442664,796.2980068164],[2.579844E-5,.02996736156,3344.1355450488],[1.528141E-5,1.14979301996,6151.533888305],[1.798806E-5,.65634057445,529.6909650946],[1.264357E-5,3.62275122593,5092.1519581158],[1.286228E-5,
3.06796065034,2146.1654164752],[1.546404E-5,2.91579701718,1751.539531416],[1.024902E-5,3.69334099279,8962.4553499102],[8.91566E-6,.18293837498,16703.062133499],[8.58759E-6,2.4009381194,2914.0142358238],[8.32715E-6,2.46418619474,3340.5951730476],[8.3272E-6,4.49495782139,3340.629680352],[7.12902E-6,3.66335473479,1059.3819301892],[7.48723E-6,3.82248614017,155.4203994342],[7.23861E-6,.67497311481,3738.761430108],[6.35548E-6,2.92182225127,8432.7643848156],[6.55162E-6,.48864064125,3127.3133312618],[5.50474E-6,
3.81001042328,.9803210682],[5.5275E-6,4.47479317037,1748.016413067],[4.25966E-6,.55364317304,6283.0758499914],[4.15131E-6,.49662285038,213.299095438],[4.72167E-6,3.62547124025,1194.4470102246],[3.06551E-6,.38052848348,6684.7479717486],[3.12141E-6,.99853944405,6677.7017350506],[2.93198E-6,4.22131299634,20.7753954924],[3.02375E-6,4.48618007156,3532.0606928114],[2.74027E-6,.54222167059,3340.545116397],[2.81079E-6,5.88163521788,1349.8674096588],[2.31183E-6,1.28242156993,3870.3033917944],[2.83602E-6,5.7688543494,
3149.1641605882],[2.36117E-6,5.75503217933,3333.498879699],[2.74033E-6,.13372524985,3340.6797370026],[2.99395E-6,2.78323740866,6254.6266625236]],[[3340.61242700512,0,0],[.01457554523,3.60433733236,3340.6124266998],[.00168414711,3.92318567804,6681.2248533996],[2.0622975E-4,4.26108844583,10021.8372800994],[3.452392E-5,4.7321039319,3.523118349],[2.586332E-5,4.60670058555,13362.4497067992],[8.41535E-6,4.45864030426,2281.2304965106]],[[5.8152577E-4,2.04961712429,3340.6124266998],[1.3459579E-4,2.45738706163,
6681.2248533996]]],[[[.03197134986,3.76832042431,3340.6124266998],[.00298033234,4.10616996305,6681.2248533996],[.00289104742,0,0],[3.1365539E-4,4.4465105309,10021.8372800994],[3.4841E-5,4.7881254926,13362.4497067992]],[[.00217310991,6.04472194776,3340.6124266998],[2.0976948E-4,3.14159265359,0],[1.2834709E-4,1.60810667915,6681.2248533996]]],[[[1.53033488271,0,0],[.1418495316,3.47971283528,3340.6124266998],[.00660776362,3.81783443019,6681.2248533996],[4.6179117E-4,4.15595316782,10021.8372800994],[8.109733E-5,
5.55958416318,2810.9214616052],[7.485318E-5,1.77239078402,5621.8429232104],[5.523191E-5,1.3643630377,2281.2304965106],[3.82516E-5,4.49407183687,13362.4497067992],[2.306537E-5,.09081579001,2544.3144198834],[1.999396E-5,5.36059617709,3337.0893083508],[2.484394E-5,4.9254563992,2942.4634232916],[1.960195E-5,4.74249437639,3344.1355450488],[1.167119E-5,2.11260868341,5092.1519581158],[1.102816E-5,5.00908403998,398.1490034082],[8.99066E-6,4.40791133207,529.6909650946],[9.92252E-6,5.83861961952,6151.533888305],
[8.07354E-6,2.10217065501,1059.3819301892],[7.97915E-6,3.44839203899,796.2980068164],[7.40975E-6,1.49906336885,2146.1654164752]],[[.01107433345,2.03250524857,3340.6124266998],[.00103175887,2.37071847807,6681.2248533996],[1.28772E-4,0,0],[1.081588E-4,2.70888095665,10021.8372800994]],[[4.4242249E-4,.47930604954,3340.6124266998],[8.138042E-5,.86998389204,6681.2248533996]]]],Jupiter:[[[[.59954691494,0,0],[.09695898719,5.06191793158,529.6909650946],[.00573610142,1.44406205629,7.1135470008],[.00306389205,
5.41734730184,1059.3819301892],[9.7178296E-4,4.14264726552,632.7837393132],[7.2903078E-4,3.64042916389,522.5774180938],[6.4263975E-4,3.41145165351,103.0927742186],[3.9806064E-4,2.29376740788,419.4846438752],[3.8857767E-4,1.27231755835,316.3918696566],[2.7964629E-4,1.7845459182,536.8045120954],[1.358973E-4,5.7748104079,1589.0728952838],[8.246349E-5,3.5822792584,206.1855484372],[8.768704E-5,3.63000308199,949.1756089698],[7.368042E-5,5.0810119427,735.8765135318],[6.26315E-5,.02497628807,213.299095438],
[6.114062E-5,4.51319998626,1162.4747044078],[4.905396E-5,1.32084470588,110.2063212194],[5.305285E-5,1.30671216791,14.2270940016],[5.305441E-5,4.18625634012,1052.2683831884],[4.647248E-5,4.69958103684,3.9321532631],[3.045023E-5,4.31676431084,426.598190876],[2.609999E-5,1.56667394063,846.0828347512],[2.028191E-5,1.06376530715,3.1813937377],[1.764763E-5,2.14148655117,1066.49547719],[1.722972E-5,3.88036268267,1265.5674786264],[1.920945E-5,.97168196472,639.897286314],[1.633223E-5,3.58201833555,515.463871093],
[1.431999E-5,4.29685556046,625.6701923124],[9.73272E-6,4.09764549134,95.9792272178]],[[529.69096508814,0,0],[.00489503243,4.2208293947,529.6909650946],[.00228917222,6.02646855621,7.1135470008],[3.0099479E-4,4.54540782858,1059.3819301892],[2.072092E-4,5.45943156902,522.5774180938],[1.2103653E-4,.16994816098,536.8045120954],[6.067987E-5,4.42422292017,103.0927742186],[5.433968E-5,3.98480737746,419.4846438752],[4.237744E-5,5.89008707199,14.2270940016]],[[4.7233601E-4,4.32148536482,7.1135470008],[3.0649436E-4,
2.929777887,529.6909650946],[1.4837605E-4,3.14159265359,0]]],[[[.02268615702,3.55852606721,529.6909650946],[.00109971634,3.90809347197,1059.3819301892],[.00110090358,0,0],[8.101428E-5,3.60509572885,522.5774180938],[6.043996E-5,4.25883108339,1589.0728952838],[6.437782E-5,.30627119215,536.8045120954]],[[7.8203446E-4,1.52377859742,529.6909650946]]],[[[5.20887429326,0,0],[.25209327119,3.49108639871,529.6909650946],[.00610599976,3.84115365948,1059.3819301892],[.00282029458,2.57419881293,632.7837393132],
[.00187647346,2.07590383214,522.5774180938],[8.6792905E-4,.71001145545,419.4846438752],[7.2062974E-4,.21465724607,536.8045120954],[6.5517248E-4,5.9799588479,316.3918696566],[2.9134542E-4,1.67759379655,103.0927742186],[3.0135335E-4,2.16132003734,949.1756089698],[2.3453271E-4,3.54023522184,735.8765135318],[2.2283743E-4,4.19362594399,1589.0728952838],[2.3947298E-4,.2745803748,7.1135470008],[1.3032614E-4,2.96042965363,1162.4747044078],[9.70336E-5,1.90669633585,206.1855484372],[1.2749023E-4,2.71550286592,
1052.2683831884],[7.057931E-5,2.18184839926,1265.5674786264],[6.137703E-5,6.26418240033,846.0828347512],[2.616976E-5,2.00994012876,1581.959348283]],[[.0127180152,2.64937512894,529.6909650946],[6.1661816E-4,3.00076460387,1059.3819301892],[5.3443713E-4,3.89717383175,522.5774180938],[3.1185171E-4,4.88276958012,536.8045120954],[4.1390269E-4,0,0]]]],Saturn:[[[[.87401354025,0,0],[.11107659762,3.96205090159,213.299095438],[.01414150957,4.58581516874,7.1135470008],[.00398379389,.52112032699,206.1855484372],
[.00350769243,3.30329907896,426.598190876],[.00206816305,.24658372002,103.0927742186],[7.92713E-4,3.84007056878,220.4126424388],[2.3990355E-4,4.66976924553,110.2063212194],[1.6573588E-4,.43719228296,419.4846438752],[1.4906995E-4,5.76903183869,316.3918696566],[1.582029E-4,.93809155235,632.7837393132],[1.4609559E-4,1.56518472,3.9321532631],[1.3160301E-4,4.44891291899,14.2270940016],[1.5053543E-4,2.71669915667,639.897286314],[1.3005299E-4,5.98119023644,11.0457002639],[1.0725067E-4,3.12939523827,202.2533951741],
[5.863206E-5,.23656938524,529.6909650946],[5.227757E-5,4.20783365759,3.1813937377],[6.126317E-5,1.76328667907,277.0349937414],[5.019687E-5,3.17787728405,433.7117378768],[4.59255E-5,.61977744975,199.0720014364],[4.005867E-5,2.24479718502,63.7358983034],[2.953796E-5,.98280366998,95.9792272178],[3.87367E-5,3.22283226966,138.5174968707],[2.461186E-5,2.03163875071,735.8765135318],[3.269484E-5,.77492638211,949.1756089698],[1.758145E-5,3.2658010994,522.5774180938],[1.640172E-5,5.5050445305,846.0828347512],
[1.391327E-5,4.02333150505,323.5054166574],[1.580648E-5,4.37265307169,309.2783226558],[1.123498E-5,2.83726798446,415.5524906121],[1.017275E-5,3.71700135395,227.5261894396],[8.48642E-6,3.1915017083,209.3669421749]],[[213.2990952169,0,0],[.01297370862,1.82834923978,213.299095438],[.00564345393,2.88499717272,7.1135470008],[9.3734369E-4,1.06311793502,426.598190876],[.00107674962,2.27769131009,206.1855484372],[4.0244455E-4,2.04108104671,220.4126424388],[1.9941774E-4,1.2795439047,103.0927742186],[1.0511678E-4,
2.7488034213,14.2270940016],[6.416106E-5,.38238295041,639.897286314],[4.848994E-5,2.43037610229,419.4846438752],[4.056892E-5,2.92133209468,110.2063212194],[3.768635E-5,3.6496533078,3.9321532631]],[[.0011644133,1.17988132879,7.1135470008],[9.1841837E-4,.0732519584,213.299095438],[3.6661728E-4,0,0],[1.5274496E-4,4.06493179167,206.1855484372]]],[[[.04330678039,3.60284428399,213.299095438],[.00240348302,2.85238489373,426.598190876],[8.4745939E-4,0,0],[3.0863357E-4,3.48441504555,220.4126424388],[3.4116062E-4,
.57297307557,206.1855484372],[1.473407E-4,2.11846596715,639.897286314],[9.916667E-5,5.79003188904,419.4846438752],[6.993564E-5,4.7360468972,7.1135470008],[4.807588E-5,5.43305312061,316.3918696566]],[[.00198927992,4.93901017903,213.299095438],[3.6947916E-4,3.14159265359,0],[1.7966989E-4,.5197943111,426.598190876]]],[[[9.55758135486,0,0],[.52921382865,2.39226219573,213.299095438],[.01873679867,5.2354960466,206.1855484372],[.01464663929,1.64763042902,426.598190876],[.00821891141,5.93520042303,316.3918696566],
[.00547506923,5.0153261898,103.0927742186],[.0037168465,2.27114821115,220.4126424388],[.00361778765,3.13904301847,7.1135470008],[.00140617506,5.70406606781,632.7837393132],[.00108974848,3.29313390175,110.2063212194],[6.9006962E-4,5.94099540992,419.4846438752],[6.1053367E-4,.94037691801,639.897286314],[4.8913294E-4,1.55733638681,202.2533951741],[3.4143772E-4,.19519102597,277.0349937414],[3.2401773E-4,5.47084567016,949.1756089698],[2.0936596E-4,.46349251129,735.8765135318],[9.796004E-5,5.20477537945,
1265.5674786264],[1.1993338E-4,5.98050967385,846.0828347512],[2.08393E-4,1.52102476129,433.7117378768],[1.5298404E-4,3.0594381494,529.6909650946],[6.465823E-5,.17732249942,1052.2683831884],[1.1380257E-4,1.7310542704,522.5774180938],[3.419618E-5,4.94550542171,1581.959348283]],[[.0618298134,.2584351148,213.299095438],[.00506577242,.71114625261,206.1855484372],[.00341394029,5.79635741658,426.598190876],[.00188491195,.47215589652,220.4126424388],[.00186261486,3.14159265359,0],[.00143891146,1.40744822888,
7.1135470008]],[[.00436902572,4.78671677509,213.299095438]]]],Uranus:[[[[5.48129294297,0,0],[.09260408234,.89106421507,74.7815985673],[.01504247898,3.6271926092,1.4844727083],[.00365981674,1.89962179044,73.297125859],[.00272328168,3.35823706307,149.5631971346],[7.0328461E-4,5.39254450063,63.7358983034],[6.8892678E-4,6.09292483287,76.2660712756],[6.1998615E-4,2.26952066061,2.9689454166],[6.1950719E-4,2.85098872691,11.0457002639],[2.646877E-4,3.14152083966,71.8126531507],[2.5710476E-4,6.11379840493,
454.9093665273],[2.107885E-4,4.36059339067,148.0787244263],[1.7818647E-4,1.74436930289,36.6485629295],[1.4613507E-4,4.73732166022,3.9321532631],[1.1162509E-4,5.8268179635,224.3447957019],[1.099791E-4,.48865004018,138.5174968707],[9.527478E-5,2.95516862826,35.1640902212],[7.545601E-5,5.236265824,109.9456887885],[4.220241E-5,3.23328220918,70.8494453042],[4.0519E-5,2.277550173,151.0476698429],[3.354596E-5,1.0654900738,4.4534181249],[2.926718E-5,4.62903718891,9.5612275556],[3.49034E-5,5.48306144511,146.594251718],
[3.144069E-5,4.75199570434,77.7505439839],[2.922333E-5,5.35235361027,85.8272988312],[2.272788E-5,4.36600400036,70.3281804424],[2.051219E-5,1.51773566586,.1118745846],[2.148602E-5,.60745949945,38.1330356378],[1.991643E-5,4.92437588682,277.0349937414],[1.376226E-5,2.04283539351,65.2203710117],[1.666902E-5,3.62744066769,380.12776796],[1.284107E-5,3.11347961505,202.2533951741],[1.150429E-5,.93343589092,3.1813937377],[1.533221E-5,2.58594681212,52.6901980395],[1.281604E-5,.54271272721,222.8603229936],[1.372139E-5,
4.19641530878,111.4301614968],[1.221029E-5,.1990065003,108.4612160802],[9.46181E-6,1.19253165736,127.4717966068],[1.150989E-5,4.17898916639,33.6796175129]],[[74.7815986091,0,0],[.00154332863,5.24158770553,74.7815985673],[2.4456474E-4,1.71260334156,1.4844727083],[9.258442E-5,.4282973235,11.0457002639],[8.265977E-5,1.50218091379,63.7358983034],[9.15016E-5,1.41213765216,149.5631971346]]],[[[.01346277648,2.61877810547,74.7815985673],[6.23414E-4,5.08111189648,149.5631971346],[6.1601196E-4,3.14159265359,
0],[9.963722E-5,1.61603805646,76.2660712756],[9.92616E-5,.57630380333,73.297125859]],[[3.4101978E-4,.01321929936,74.7815985673]]],[[[19.21264847206,0,0],[.88784984413,5.60377527014,74.7815985673],[.03440836062,.32836099706,73.297125859],[.0205565386,1.7829515933,149.5631971346],[.0064932241,4.52247285911,76.2660712756],[.00602247865,3.86003823674,63.7358983034],[.00496404167,1.40139935333,454.9093665273],[.00338525369,1.58002770318,138.5174968707],[.00243509114,1.57086606044,71.8126531507],[.00190522303,
1.99809394714,1.4844727083],[.00161858838,2.79137786799,148.0787244263],[.00143706183,1.38368544947,11.0457002639],[9.3192405E-4,.17437220467,36.6485629295],[7.1424548E-4,4.24509236074,224.3447957019],[8.9806014E-4,3.66105364565,109.9456887885],[3.9009723E-4,1.66971401684,70.8494453042],[4.6677296E-4,1.39976401694,35.1640902212],[3.9025624E-4,3.36234773834,277.0349937414],[3.6755274E-4,3.88649278513,146.594251718],[3.0348723E-4,.70100838798,151.0476698429],[2.9156413E-4,3.180563367,77.7505439839],
[2.2637073E-4,.72518687029,529.6909650946],[1.1959076E-4,1.7504339214,984.6003316219],[2.5620756E-4,5.25656086672,380.12776796]],[[.01479896629,3.67205697578,74.7815985673]]]],Neptune:[[[[5.31188633046,0,0],[.0179847553,2.9010127389,38.1330356378],[.01019727652,.48580922867,1.4844727083],[.00124531845,4.83008090676,36.6485629295],[4.2064466E-4,5.41054993053,2.9689454166],[3.7714584E-4,6.09221808686,35.1640902212],[3.3784738E-4,1.24488874087,76.2660712756],[1.6482741E-4,7.727998E-5,491.5579294568],
[9.198584E-5,4.93747051954,39.6175083461],[8.99425E-5,.27462171806,175.1660598002]],[[38.13303563957,0,0],[1.6604172E-4,4.86323329249,1.4844727083],[1.5744045E-4,2.27887427527,38.1330356378]]],[[[.03088622933,1.44104372644,38.1330356378],[2.7780087E-4,5.91271884599,76.2660712756],[2.7623609E-4,0,0],[1.5355489E-4,2.52123799551,36.6485629295],[1.5448133E-4,3.50877079215,39.6175083461]]],[[[30.07013205828,0,0],[.27062259632,1.32999459377,38.1330356378],[.01691764014,3.25186135653,36.6485629295],[.00807830553,
5.18592878704,1.4844727083],[.0053776051,4.52113935896,35.1640902212],[.00495725141,1.5710564165,491.5579294568],[.00274571975,1.84552258866,175.1660598002],[1.201232E-4,1.92059384991,1021.2488945514],[.00121801746,5.79754470298,76.2660712756],[.00100896068,.3770272493,73.297125859],[.00135134092,3.37220609835,39.6175083461],[7.571796E-5,1.07149207335,388.4651552382]]]]};e.DeltaT_EspenakMeeus=sa;e.DeltaT_JplHorizons=function(a){return sa(Math.min(a,17*365.24217))};var Wb=sa;e.SetDeltaTFunction=function(a){Wb=
a};var O=function(a){if(a instanceof O)this.date=a.date,this.ut=a.ut,this.tt=a.tt;else if(a instanceof Date&&Number.isFinite(a.getTime()))this.date=a,this.ut=(a.getTime()-dd.getTime())/864E5,this.tt=Vb(this.ut);else if(Number.isFinite(a))this.date=new Date(dd.getTime()+864E5*a),this.ut=a,this.tt=Vb(this.ut);else throw"Argument must be a Date object, an AstroTime object, or a numeric UTC Julian date.";};O.FromTerrestrialTime=function(a){for(var b=new O(a);;){var c=a-b.tt;if(1E-12>Math.abs(c))return b;
b=b.AddDays(c)}};O.prototype.toString=function(){return this.date.toISOString()};O.prototype.AddDays=function(a){return new O(this.ut+a)};e.AstroTime=O;e.MakeTime=v;var $a;e.e_tilt=da;e.CalcMoonCount=0;var ed=function(a,b,c,d,f,g){this.elat=a;this.elon=b;this.mlat=c;this.mlon=d;this.dist_km=f;this.diam_deg=g};e.LibrationInfo=ed;e.Libration=function(a){var b=v(a);a=b.tt/36525;var c=a*a,d=c*a,f=c*c,g=ea(b);b=g.geo_eclip_lon;var h=g.geo_eclip_lat;g=g.distance_au*e.KM_PER_AU;var l=1.543*e.DEG2RAD,k=e.DEG2RAD*
Ga(93.272095+483202.0175233*a-.0036539*c-d/3526E3+f/86331E4),n=e.DEG2RAD*Ga(125.0445479-1934.1362891*a+.0020754*c+d/467441-f/60616E3),p=e.DEG2RAD*Ga(357.5291092+35999.0502909*a-1.536E-4*c+d/2449E4),q=e.DEG2RAD*Ga(134.9633964+477198.8675055*a+.0087414*c+d/69699-f/14712E3);d=e.DEG2RAD*Ga(297.8501921+445267.1114034*a-.0018819*c+d/545868-f/113065E3);c=1-.002516*a-7.4E-6*c;var t=b-n;f=Math.atan2(Math.sin(t)*Math.cos(h)*Math.cos(l)-Math.sin(h)*Math.sin(l),Math.cos(t)*Math.cos(h));var y=Fa(e.RAD2DEG*(f-
k));l=Math.asin(-Math.sin(t)*Math.cos(h)*Math.sin(l)-Math.sin(h)*Math.cos(l));t=-.02752*Math.cos(q)+-.02245*Math.sin(k)+.00684*Math.cos(q-2*k)+-.00293*Math.cos(2*k)+-8.5E-4*Math.cos(2*k-2*d)+-5.4E-4*Math.cos(q-2*d)+-2E-4*Math.sin(q+k)+-2E-4*Math.cos(q+2*k)+-2E-4*Math.cos(q-k)+1.4E-4*Math.cos(q+2*k-2*d);var x=-.02816*Math.sin(q)+.02244*Math.cos(k)+-.00682*Math.sin(q-2*k)+-.00279*Math.sin(2*k)+-8.3E-4*Math.sin(2*k-2*d)+6.9E-4*Math.sin(q-2*d)+4E-4*Math.cos(q+k)+-2.5E-4*Math.sin(2*q)+-2.3E-4*Math.sin(q+
2*k)+2E-4*Math.cos(q-k)+1.9E-4*Math.sin(q-k)+1.3E-4*Math.sin(q+2*k-2*d)+-1E-4*Math.cos(q-3*k);return new ed(e.RAD2DEG*l+(x*Math.cos(f)-t*Math.sin(f)),y+(-(.0252*c*Math.sin(p)+.00473*Math.sin(2*q-2*k)+-.00467*Math.sin(q)+.00396*Math.sin(e.DEG2RAD*(119.75+131.849*a))+.00276*Math.sin(2*q-2*d)+.00196*Math.sin(n)+-.00183*Math.cos(q-k)+.00115*Math.sin(q-2*d)+-9.6E-4*Math.sin(q-d)+4.6E-4*Math.sin(2*k-2*d)+-3.9E-4*Math.sin(q-k)+-3.2E-4*Math.sin(q-p-d)+2.7E-4*Math.sin(2*q-p-2*d)+2.3E-4*Math.sin(e.DEG2RAD*
(72.56+20.186*a))+-1.4E-4*Math.sin(2*d)+1.4E-4*Math.cos(2*q-2*k)+-1.2E-4*Math.sin(q-2*k)+-1.2E-4*Math.sin(2*q)+1.1E-4*Math.sin(2*q-2*p-2*d))+(t*Math.cos(f)+x*Math.sin(f))*Math.tan(l)),e.RAD2DEG*h,e.RAD2DEG*b,g,2*e.RAD2DEG*Math.atan(1737.4/Math.sqrt(g*g-1737.4*1737.4)))};var eb;e.SiderealTime=bc;var E=function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.t=d};E.prototype.Length=function(){return Math.hypot(this.x,this.y,this.z)};e.Vector=E;var I=function(a,b,c,d,f,g,h){this.x=a;this.y=b;this.z=c;this.vx=
d;this.vy=f;this.vz=g;this.t=h};e.StateVector=I;var Ba=function(a,b,c){this.lat=w(a);this.lon=w(b);this.dist=w(c)};e.Spherical=Ba;var gb=function(a,b,c,d){this.ra=w(a);this.dec=w(b);this.dist=w(c);this.vec=d};e.EquatorialCoordinates=gb;var J=function(a){this.rot=a};e.RotationMatrix=J;e.MakeRotation=function(a){if(!qd(a))throw"Argument must be a [3][3] array of numbers";return new J(a)};var ec=function(a,b,c,d){this.azimuth=w(a);this.altitude=w(b);this.ra=w(c);this.dec=w(d)};e.HorizontalCoordinates=
ec;var gc=function(a,b,c){this.vec=a;this.elat=w(b);this.elon=w(c)};e.EclipticCoordinates=gc;e.Horizon=hb;var zb=function(a,b,c){this.latitude=a;this.longitude=b;this.height=c;za(this)};e.Observer=zb;e.SunPosition=fc;e.Equator=Pa;e.ObserverVector=function(a,b,c){a=v(a);var d=ca(a);b=xb(b,d).pos;c||(b=fb(b,a,F.Into2000));return yb(b,a)};e.ObserverState=function(a,b,c){a=v(a);var d=ca(a);b=xb(b,d);b=new I(b.pos[0],b.pos[1],b.pos[2],b.vel[0],b.vel[1],b.vel[2],a);return c?b:(c=F.Into2000,c===F.Into2000?
(d=Na(a,c),b=Ea(d,b),a=Ma(a,c),a=Ea(a,b)):(d=Ma(a,c),b=Ea(d,b),a=Na(a,c),a=Ea(a,b)),a)};e.VectorObserver=function(a,b){var c=ca(a.t),d=[a.x,a.y,a.z];b||(d=wa(d,a.t,F.From2000),d=xa(d,a.t,F.From2000));b=d[0]*e.KM_PER_AU;var f=d[1]*e.KM_PER_AU;d=d[2]*e.KM_PER_AU;a=Math.hypot(b,f);if(1E-6>a){c=0;var g=0<d?90:-90;d=Math.abs(d)-6356.751857971648}else{for(c=e.RAD2DEG*Math.atan2(f,b)-15*c;-180>=c;)c+=360;for(;180<c;)c-=360;g=Math.atan2(d,a);for(var h,l=0;;){if(10<++l)throw"inverse_terra failed to converge.";
b=Math.cos(g);f=Math.sin(g);var k=b*b,n=f*f,p=k+.9933056020041345*n;h=Math.sqrt(p);var q=-42.69778487239616*f*b/h-d*b+a*f;if(1E-8>Math.abs(q))break;g-=q/(-42.69778487239616*((k-n)/h-n*k*-.006694397995865464/(-42.69778487239616*p))+d*f+a*b)}g*=e.RAD2DEG;h=6378.1366/h;d=Math.abs(f)>Math.abs(b)?d/f-.9933056020041345*h:a/b-h}return new zb(g,c,1E3*d)};e.ObserverGravity=function(a,b){a=Math.sin(a*e.DEG2RAD);a*=a;return 9.7803253359*(1+.00193185265241*a)/Math.sqrt(1-.00669437999013*a)*(1-(3.15704E-7-2.10269E-9*
a)*b+7.37452E-14*b*b)};e.Ecliptic=Qa;e.GeoMoon=Y;e.EclipticGeoMoon=ib;e.GeoMoonState=Ra;e.GeoEmbState=Bb;var na=[[-73E4,[-26.118207232108,-14.376168177825,3.384402515299],[.0016339372163656,-.0027861699588508,-.0013585880229445]],[-700800,[41.974905202127,-.448502952929,-12.770351505989],[7.3458569351457E-4,.0022785014891658,4.8619778602049E-4]],[-671600,[14.706930780744,44.269110540027,9.353698474772],[-.00210001479998,2.2295915939915E-4,7.0143443551414E-4]],[-642400,[-29.441003929957,-6.43016153057,
6.858481011305],[8.4495803960544E-4,-.0030783914758711,-.0012106305981192]],[-613200,[39.444396946234,-6.557989760571,-13.913760296463],[.0011480029005873,.0022400006880665,3.5168075922288E-4]],[-584E3,[20.2303809507,43.266966657189,7.382966091923],[-.0019754081700585,5.3457141292226E-4,7.5929169129793E-4]],[-554800,[-30.65832536462,2.093818874552,9.880531138071],[6.1010603013347E-5,-.0031326500935382,-9.9346125151067E-4]],[-525600,[35.737703251673,-12.587706024764,-14.677847247563],[.0015802939375649,
.0021347678412429,1.9074436384343E-4]],[-496400,[25.466295188546,41.367478338417,5.216476873382],[-.0018054401046468,8.328308359951E-4,8.0260156912107E-4]],[-467200,[-29.847174904071,10.636426313081,12.297904180106],[-6.3257063052907E-4,-.0029969577578221,-7.4476074151596E-4]],[-438E3,[30.774692107687,-18.236637015304,-14.945535879896],[.0020113162005465,.0019353827024189,-2.0937793168297E-6]],[-408800,[30.243153324028,38.656267888503,2.938501750218],[-.0016052508674468,.0011183495337525,8.3333973416824E-4]],
[-379600,[-27.288984772533,18.643162147874,14.023633623329],[-.0011856388898191,-.0027170609282181,-4.9015526126399E-4]],[-350400,[24.519605196774,-23.245756064727,-14.626862367368],[.0024322321483154,.0016062008146048,-2.3369181613312E-4]],[-321200,[34.505274805875,35.125338586954,.557361475637],[-.0013824391637782,.0013833397561817,8.4823598806262E-4]],[-292E3,[-23.275363915119,25.818514298769,15.055381588598],[-.0016062295460975,-.0023395961498533,-2.4377362639479E-4]],[-262800,[17.050384798092,
-27.180376290126,-13.608963321694],[.0028175521080578,.0011358749093955,-4.9548725258825E-4]],[-233600,[38.093671910285,30.880588383337,-1.843688067413],[-.0011317697153459,.0016128814698472,8.4177586176055E-4]],[-204400,[-18.197852930878,31.932869934309,15.438294826279],[-.0019117272501813,-.0019146495909842,-1.9657304369835E-5]],[-175200,[8.528924039997,-29.618422200048,-11.805400994258],[.0031034370787005,5.139363329243E-4,-7.7293066202546E-4]],[-146E3,[40.94685725864,25.904973592021,-4.256336240499],
[-8.3652705194051E-4,.0018129497136404,8.156422827306E-4]],[-116800,[-12.326958895325,36.881883446292,15.217158258711],[-.0021166103705038,-.001481442003599,1.7401209844705E-4]],[-87600,[-.633258375909,-30.018759794709,-9.17193287495],[.0032016994581737,-2.5279858672148E-4,-.0010411088271861]],[-58400,[42.936048423883,20.344685584452,-6.588027007912],[-5.0525450073192E-4,.0019910074335507,7.7440196540269E-4]],[-29200,[-5.975910552974,40.61180995846,14.470131723673],[-.0022184202156107,-.0010562361130164,
3.3652250216211E-4]],[0,[-9.875369580774,-27.978926224737,-5.753711824704],[.0030287533248818,-.0011276087003636,-.0012651326732361]],[29200,[43.958831986165,14.214147973292,-8.808306227163],[-1.4717608981871E-4,.0021404187242141,7.1486567806614E-4]],[58400,[.67813676352,43.094461639362,13.243238780721],[-.0022358226110718,-6.3233636090933E-4,4.7664798895648E-4]],[87600,[-18.282602096834,-23.30503958666,-1.766620508028],[.0025567245263557,-.0019902940754171,-.0013943491701082]],[116800,[43.873338744526,
7.700705617215,-10.814273666425],[2.3174803055677E-4,.0022402163127924,6.2988756452032E-4]],[146E3,[7.392949027906,44.382678951534,11.629500214854],[-.002193281545383,-2.1751799585364E-4,5.9556516201114E-4]],[175200,[-24.981690229261,-16.204012851426,2.466457544298],[.001819398914958,-.0026765419531201,-.0013848283502247]],[204400,[42.530187039511,.845935508021,-12.554907527683],[6.5059779150669E-4,.0022725657282262,5.1133743202822E-4]],[233600,[13.999526486822,44.462363044894,9.669418486465],[-.0021079296569252,
1.7533423831993E-4,6.9128485798076E-4]],[262800,[-29.184024803031,-7.371243995762,6.493275957928],[9.3581363109681E-4,-.0030610357109184,-.0012364201089345]],[292E3,[39.831980671753,-6.078405766765,-13.909815358656],[.0011117769689167,.0022362097830152,3.6230548231153E-4]],[321200,[20.294955108476,43.417190420251,7.450091985932],[-.0019742157451535,5.3102050468554E-4,7.5938408813008E-4]],[350400,[-30.66999230216,2.318743558955,9.973480913858],[4.5605107450676E-5,-.0031308219926928,-9.9066533301924E-4]],
[379600,[35.626122155983,-12.897647509224,-14.777586508444],[.0016015684949743,.0021171931182284,1.8002516202204E-4]],[408800,[26.133186148561,41.232139187599,5.00640132622],[-.0017857704419579,8.6046232702817E-4,8.0614690298954E-4]],[438E3,[-29.57674022923,11.863535943587,12.631323039872],[-7.2292830060955E-4,-.0029587820140709,-7.08242964503E-4]],[467200,[29.910805787391,-19.159019294,-15.013363865194],[.0020871080437997,.0018848372554514,-3.8528655083926E-5]],[496400,[31.375957451819,38.050372720763,
2.433138343754],[-.0015546055556611,.0011699815465629,8.3565439266001E-4]],[525600,[-26.360071336928,20.662505904952,14.414696258958],[-.0013142373118349,-.0026236647854842,-4.2542017598193E-4]],[554800,[22.599441488648,-24.508879898306,-14.484045731468],[.0025454108304806,.0014917058755191,-3.0243665086079E-4]],[584E3,[35.877864013014,33.894226366071,-.224524636277],[-.0012941245730845,.0014560427668319,8.4762160640137E-4]],[613200,[-21.538149762417,28.204068269761,15.321973799534],[-.001731211740901,
-.0021939631314577,-1.631691327518E-4]],[642400,[13.971521374415,-28.339941764789,-13.083792871886],[.0029334630526035,9.1860931752944E-4,-5.9939422488627E-4]],[671600,[39.526942044143,28.93989736011,-2.872799527539],[-.0010068481658095,.001702113288809,8.3578230511981E-4]],[700800,[-15.576200701394,34.399412961275,15.466033737854],[-.0020098814612884,-.0017191109825989,7.0414782780416E-5]],[73E4,[4.24325283709,-30.118201690825,-10.707441231349],[.0031725847067411,1.609846120227E-4,-9.0672150593868E-4]]],
B=function(a,b,c){this.x=a;this.y=b;this.z=c};B.prototype.clone=function(){return new B(this.x,this.y,this.z)};B.prototype.ToAstroVector=function(a){return new E(this.x,this.y,this.z,a)};B.zero=function(){return new B(0,0,0)};B.prototype.quadrature=function(){return this.x*this.x+this.y*this.y+this.z*this.z};B.prototype.add=function(a){return new B(this.x+a.x,this.y+a.y,this.z+a.z)};B.prototype.sub=function(a){return new B(this.x-a.x,this.y-a.y,this.z-a.z)};B.prototype.incr=function(a){this.x+=a.x;
this.y+=a.y;this.z+=a.z};B.prototype.decr=function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z};B.prototype.mul=function(a){return new B(a*this.x,a*this.y,a*this.z)};B.prototype.div=function(a){return new B(this.x/a,this.y/a,this.z/a)};B.prototype.mean=function(a){return new B((this.x+a.x)/2,(this.y+a.y)/2,(this.z+a.z)/2)};B.prototype.neg=function(){return new B(-this.x,-this.y,-this.z)};var X=function(a,b,c){this.tt=a;this.r=b;this.v=c};X.prototype.clone=function(){return new X(this.tt,this.r,this.v)};
X.prototype.sub=function(a){return new X(this.tt,this.r.sub(a.r),this.v.sub(a.v))};var Da=function(a){var b=new X(a,new B(0,0,0),new B(0,0,0));this.Jupiter=R(b,a,m.Jupiter,2.825345909524226E-7);this.Saturn=R(b,a,m.Saturn,8.459715185680659E-8);this.Uranus=R(b,a,m.Uranus,1.292024916781969E-8);this.Neptune=R(b,a,m.Neptune,1.524358900784276E-8);this.Jupiter.r.decr(b.r);this.Jupiter.v.decr(b.v);this.Saturn.r.decr(b.r);this.Saturn.v.decr(b.v);this.Uranus.r.decr(b.r);this.Uranus.v.decr(b.v);this.Neptune.r.decr(b.r);
this.Neptune.v.decr(b.v);this.Sun=new X(a,b.r.mul(-1),b.v.mul(-1))};Da.prototype.Acceleration=function(a){var b=Ta(a,2.959122082855911E-4,this.Sun.r);b.incr(Ta(a,2.825345909524226E-7,this.Jupiter.r));b.incr(Ta(a,8.459715185680659E-8,this.Saturn.r));b.incr(Ta(a,1.292024916781969E-8,this.Uranus.r));b.incr(Ta(a,1.524358900784276E-8,this.Neptune.r));return b};var Ua=function(a,b,c,d){this.tt=a;this.r=b;this.v=c;this.a=d};Ua.prototype.clone=function(){return new Ua(this.tt,this.r.clone(),this.v.clone(),
this.a.clone())};var ic=function(a,b){this.bary=a;this.grav=b},Ib=[],rd=new J([[.999432765338654,-.0336771074697641,0],[.0303959428906285,.902057912352809,.430543388542295],[-.0144994559663353,-.430299169409101,.902569881273754]]),tb=[{mu:2.82489428433814E-7,al:[1.446213296021224,3.5515522861824],a:[[.0028210960212903,0,0]],l:[[-1.925258348666E-4,4.9369589722645,.01358483658305],[-9.70803596076E-5,4.3188796477322,.01303413843243],[-8.988174165E-5,1.9080016428617,.00305064867158],[-5.53101050262E-5,
1.4936156681569,.01293892891155]],z:[[.0041510849668155,4.089939635545,-.01290686414666],[6.260521444113E-4,1.446188898627,3.5515522949802],[3.52747346169E-5,2.1256287034578,1.2727416567E-4]],zeta:[[3.142172466014E-4,2.7964219722923,-.002315096098],[9.04169207946E-5,1.0477061879627,-5.6920638196E-4]]},{mu:2.82483274392893E-7,al:[-.3735263437471362,1.76932271112347],a:[[.0044871037804314,0,0],[4.324367498E-7,1.819645606291,1.7822295777568]],l:[[8.576433172936E-4,4.3188693178264,.01303413830805],[4.549582875086E-4,
1.4936531751079,.01293892881962],[3.248939825174E-4,1.8196494533458,1.7822295777568],[-3.074250079334E-4,4.9377037005911,.01358483286724],[1.982386144784E-4,1.907986905476,.00305101212869],[1.834063551804E-4,2.1402853388529,.00145009789338],[-1.434383188452E-4,5.622214036663,.89111478887838],[-7.71939140944E-5,4.300272437235,2.6733443704266]],z:[[-.0093589104136341,4.0899396509039,-.01290686414666],[2.988994545555E-4,5.9097265185595,1.7693227079462],[2.13903639035E-4,2.1256289300016,1.2727418407E-4],
[1.980963564781E-4,2.743516829265,6.7797343009E-4],[1.210388158965E-4,5.5839943711203,3.20566149E-5],[8.37042048393E-5,1.6094538368039,-.90402165808846],[8.23525166369E-5,1.4461887708689,3.5515522949802]],zeta:[[.0040404917832303,1.0477063169425,-5.692064054E-4],[2.200421034564E-4,3.3368857864364,-1.2491307307E-4],[1.662544744719E-4,2.4134862374711,0],[5.90282470983E-5,5.9719930968366,-3.056160225E-5]]},{mu:2.82498184184723E-7,al:[.2874089391143348,.878207923589328],a:[[.0071566594572575,0,0],[1.393029911E-6,
1.1586745884981,2.6733443704266]],l:[[2.310797886226E-4,2.1402987195942,.00145009784384],[-1.828635964118E-4,4.3188672736968,.01303413828263],[1.512378778204E-4,4.9373102372298,.01358483481252],[-1.163720969778E-4,4.300265986149,2.6733443704266],[-9.55478069846E-5,1.4936612842567,.01293892879857],[8.15246854464E-5,5.6222137132535,.89111478887838],[-8.01219679602E-5,1.2995922951532,1.0034433456729],[-6.07017260182E-5,.64978769669238,.50172167043264]],z:[[.0014289811307319,2.1256295942739,1.2727413029E-4],
[7.71093122676E-4,5.5836330003496,3.20643411E-5],[5.925911780766E-4,4.0899396636448,-.01290686414666],[2.045597496146E-4,5.2713683670372,-.12523544076106],[1.785118648258E-4,.28743156721063,.8782079244252],[1.131999784893E-4,1.4462127277818,3.5515522949802],[-6.5877816921E-5,2.2702423990985,-1.7951364394537],[4.97058888328E-5,5.9096792204858,1.7693227129285]],zeta:[[.0015932721570848,3.3368862796665,-1.2491307058E-4],[8.533093128905E-4,2.4133881688166,0],[3.513347911037E-4,5.9720789850127,-3.056101771E-5],
[-1.441929255483E-4,1.0477061764435,-5.6920632124E-4]]},{mu:2.82492144889909E-7,al:[-.3620341291375704,.376486233433828],a:[[.0125879701715314,0,0],[3.595204947E-6,.64965776007116,.50172168165034],[2.7580210652E-6,1.808423578151,3.1750660413359]],l:[[5.586040123824E-4,2.1404207189815,.00145009793231],[-3.805813868176E-4,2.7358844897853,2.972965062E-5],[2.205152863262E-4,.649796525964,.5017216724358],[1.877895151158E-4,1.8084787604005,3.1750660413359],[7.66916975242E-5,6.2720114319755,1.3928364636651],
[7.47056855106E-5,1.2995916202344,1.0034433456729]],z:[[.0073755808467977,5.5836071576084,3.206509914E-5],[2.065924169942E-4,5.9209831565786,.37648624194703],[1.589869764021E-4,.28744006242623,.8782079244252],[-1.561131605348E-4,2.1257397865089,1.2727441285E-4],[1.486043380971E-4,1.4462134301023,3.5515522949802],[6.35073108731E-5,5.9096803285954,1.7693227129285],[5.99351698525E-5,4.1125517584798,-2.7985797954589],[5.40660842731E-5,5.5390350845569,.00286834082283],[-4.89596900866E-5,4.6218149483338,
-.62695712529519]],zeta:[[.0038422977898495,2.4133922085557,0],[.0022453891791894,5.9721736773277,-3.056125525E-5],[-2.604479450559E-4,3.3368746306409,-1.2491309972E-4],[3.3211214323E-5,5.5604137742337,.00290037688507]]}],fd=function(a,b,c,d){this.io=a;this.europa=b;this.ganymede=c;this.callisto=d};e.JupiterMoonsInfo=fd;e.JupiterMoons=function(a){a=new O(a);return new fd(kb(a,tb[0]),kb(a,tb[1]),kb(a,tb[2]),kb(a,tb[3]))};e.HelioVector=Z;e.HelioDistance=oa;e.CorrectLightTravel=lc;var nc=function(a,
b,c,d){this.observerBody=a;this.targetBody=b;this.aberration=c;this.observerPos=d};nc.prototype.Position=function(a){this.aberration&&(this.observerPos=Z(this.observerBody,a));var b=Z(this.targetBody,a);return new E(b.x-this.observerPos.x,b.y-this.observerPos.y,b.z-this.observerPos.z,a)};e.BackdatePosition=mc;e.GeoVector=W;e.BaryState=function(a,b){b=v(b);if(a===m.SSB)return new I(0,0,0,0,0,0,b);if(a===m.Pluto)return Hb(b,!1);var c=new Da(b.tt);switch(a){case m.Sun:return pa(c.Sun,b);case m.Jupiter:return pa(c.Jupiter,
b);case m.Saturn:return pa(c.Saturn,b);case m.Uranus:return pa(c.Uranus,b);case m.Neptune:return pa(c.Neptune,b);case m.Moon:case m.EMB:var d=Sa(M[m.Earth],b.tt);a=a===m.Moon?Ra(b):Bb(b);return new I(a.x+c.Sun.r.x+d.r.x,a.y+c.Sun.r.y+d.r.y,a.z+c.Sun.r.z+d.r.z,a.vx+c.Sun.v.x+d.v.x,a.vy+c.Sun.v.y+d.v.y,a.vz+c.Sun.v.z+d.v.z,b)}if(a in M)return a=Sa(M[a],b.tt),new I(c.Sun.r.x+a.r.x,c.Sun.r.y+a.r.y,c.Sun.r.z+a.r.z,c.Sun.v.x+a.v.x,c.Sun.v.y+a.v.y,c.Sun.v.z+a.v.z,b);throw'BaryState: Unsupported body "'+
a+'"';};e.HelioState=mb;e.Search=K;e.SearchSunLongitude=oc;e.PairLongitude=Jb;e.AngleFromSun=Ha;e.EclipticLongitude=qa;var pc=function(a,b,c,d,f,g,h,l){this.time=a;this.mag=b;this.phase_angle=c;this.helio_dist=d;this.geo_dist=f;this.gc=g;this.hc=h;this.ring_tilt=l;this.phase_fraction=(1+Math.cos(e.DEG2RAD*c))/2};e.IlluminationInfo=pc;e.Illumination=nb;e.SearchRelativeLongitude=Ia;e.MoonPhase=Kb;e.SearchMoonPhase=Wa;var rc=function(a,b){this.quarter=a;this.time=b};e.MoonQuarter=rc;e.SearchMoonQuarter=
qc;e.NextMoonQuarter=function(a){a=new Date(a.time.date.getTime()+5184E5);return qc(a)};var tc=function(a,b,c){this.pressure=a;this.temperature=b;this.density=c};e.AtmosphereInfo=tc;e.Atmosphere=sc;e.SearchRiseSet=function(a,b,c,d,f,g){g=void 0===g?0:g;if(!Number.isFinite(g)||0>g)throw"Invalid value for metersAboveGround: "+g;a:switch(a){case m.Sun:var h=Nc;break a;case m.Moon:h=Dd;break a;default:h=0}var l=sc(b.height-g),k=b.latitude*e.DEG2RAD,n=Math.sin(k);k=Math.cos(k);var p=1/Math.hypot(k,.996647180302104*
n),q=(b.height-g)/1E3,t=.175*Math.pow(1-.0065/283.15*(b.height-2/3*g),3.256);return uc(a,b,c,d,f,h,e.RAD2DEG*-(Math.sqrt(2*(1-t)*g/(1E3*Math.hypot((6378.1366*p+q)*k,(6335.438815127603*p+q)*n)))/(1-t))-Ed*l.density)};e.SearchAltitude=function(a,b,c,d,f,g){if(!Number.isFinite(g)||-90>g||90<g)throw"Invalid altitude angle: "+g;return uc(a,b,c,d,f,0,g)};var ud=function(a,b,c,d){this.tx=a;this.ty=b;this.ax=c;this.ay=d},gd=function(a,b){this.time=a;this.hor=b};e.HourAngleEvent=gd;e.SearchHourAngle=function(a,
b,c,d,f){f=void 0===f?1:f;za(b);d=v(d);var g=0;if(a===m.Earth)throw"Cannot search for hour angle of the Earth.";w(c);if(0>c||24<=c)throw"Invalid hour angle "+c;w(f);if(0===f)throw"Direction must be positive or negative.";for(;;){++g;var h=ca(d),l=Pa(a,d,b,!0,!0);h=(c+l.ra-b.longitude/15-h)%24;1===g?0<f?0>h&&(h+=24):0<h&&(h-=24):-12>h?h+=24:12<h&&(h-=24);if(.1>3600*Math.abs(h))return a=hb(d,b,l.ra,l.dec,"normal"),new gd(d,a);d=d.AddDays(h/24*.9972695717592592)}};e.HourAngle=function(a,b,c){var d=v(b);
b=bc(d);a=Pa(a,d,c,!0,!0);c=(c.longitude/15+b-a.ra)%24;0>c&&(c+=24);return c};var hd=function(a,b,c,d){this.mar_equinox=a;this.jun_solstice=b;this.sep_equinox=c;this.dec_solstice=d};e.SeasonInfo=hd;e.Seasons=function(a){function b(h,l,k){l=new Date(Date.UTC(a,l-1,k));h=oc(h,l,20);if(!h)throw"Cannot find season change near "+l.toISOString();return h}a instanceof Date&&Number.isFinite(a.getTime())&&(a=a.getUTCFullYear());if(!Number.isSafeInteger(a))throw"Cannot calculate seasons because year argument "+
a+" is neither a Date nor a safe integer.";var c=b(0,3,10),d=b(90,6,10),f=b(180,9,10),g=b(270,12,10);return new hd(c,d,f,g)};var wc=function(a,b,c,d){this.time=a;this.visibility=b;this.elongation=c;this.ecliptic_separation=d};e.ElongationEvent=wc;e.Elongation=vc;e.SearchMaxElongation=function(a,b){function c(n){var p=n.AddDays(-.005);n=n.AddDays(.005);p=Ha(a,p);n=Ha(a,n);return(p-n)/.01}b=v(b);var d={Mercury:{s1:50,s2:85},Venus:{s1:40,s2:50}}[a];if(!d)throw"SearchMaxElongation works for Mercury and Venus only.";
for(var f=0;2>=++f;){var g=qa(a,b),h=qa(m.Earth,b),l=Fa(g-h),k=g=h=void 0;l>=-d.s1&&l<+d.s1?(k=0,h=+d.s1,g=+d.s2):l>=+d.s2||l<-d.s2?(k=0,h=-d.s2,g=-d.s1):0<=l?(k=-Va(a)/4,h=+d.s1,g=+d.s2):(k=-Va(a)/4,h=-d.s2,g=-d.s1);l=b.AddDays(k);h=Ia(a,h,l);g=Ia(a,g,h);l=c(h);if(0<=l)throw"SearchMaxElongation: internal error: m1 = "+l;k=c(g);if(0>=k)throw"SearchMaxElongation: internal error: m2 = "+k;l=K(c,h,g,{init_f1:l,init_f2:k,dt_tolerance_seconds:10});if(!l)throw"SearchMaxElongation: failed search iter "+
f+" (t1="+h.toString()+", t2="+g.toString()+")";if(l.tt>=b.tt)return vc(a,l);b=g.AddDays(1)}throw"SearchMaxElongation: failed to find event after 2 tries.";};e.SearchPeakMagnitude=function(a,b){function c(k){var n=k.AddDays(-.005);k=k.AddDays(.005);n=nb(a,n).mag;return(nb(a,k).mag-n)/.01}if(a!==m.Venus)throw"SearchPeakMagnitude currently works for Venus only.";b=v(b);for(var d=0;2>=++d;){var f=qa(a,b),g=qa(m.Earth,b),h=Fa(f-g),l=f=g=void 0;-10<=h&&10>h?(l=0,g=10,f=30):30<=h||-30>h?(l=0,g=-30,f=-10):
0<=h?(l=-Va(a)/4,g=10,f=30):(l=-Va(a)/4,g=-30,f=-10);h=b.AddDays(l);g=Ia(a,g,h);f=Ia(a,f,g);h=c(g);if(0<=h)throw"SearchPeakMagnitude: internal error: m1 = "+h;l=c(f);if(0>=l)throw"SearchPeakMagnitude: internal error: m2 = "+l;h=K(c,g,f,{init_f1:h,init_f2:l,dt_tolerance_seconds:10});if(!h)throw"SearchPeakMagnitude: failed search iter "+d+" (t1="+g.toString()+", t2="+f.toString()+")";if(h.tt>=b.tt)return nb(a,h);b=f.AddDays(1)}throw"SearchPeakMagnitude: failed to find event after 2 tries.";};var Ja;
(function(a){a[a.Pericenter=0]="Pericenter";a[a.Apocenter=1]="Apocenter"})(Ja=e.ApsisKind||(e.ApsisKind={}));var Xa=function(a,b,c){this.time=a;this.kind=b;this.dist_au=c;this.dist_km=c*e.KM_PER_AU};e.Apsis=Xa;e.SearchLunarApsis=xc;e.NextLunarApsis=function(a){var b=xc(a.time.AddDays(11));if(1!==b.kind+a.kind)throw"NextLunarApsis INTERNAL ERROR: did not find alternating apogee/perigee: prev="+a.kind+" @ "+a.time.toString()+", next="+b.kind+" @ "+b.time.toString();return b};e.SearchPlanetApsis=zc;
e.NextPlanetApsis=function(a,b){if(b.kind!==Ja.Pericenter&&b.kind!==Ja.Apocenter)throw"Invalid apsis kind: "+b.kind;var c=b.time.AddDays(.25*aa[a].OrbitalPeriod);a=zc(a,c);if(1!==a.kind+b.kind)throw"Internal error: previous apsis was "+b.kind+", but found "+a.kind+" for next apsis.";return a};e.InverseRotation=Ka;e.CombineRotation=ja;e.IdentityMatrix=function(){return new J([[1,0,0],[0,1,0],[0,0,1]])};e.Pivot=function(a,b,c){if(0!==b&&1!==b&&2!==b)throw"Invalid axis "+b+". Must be [0, 1, 2].";var d=
w(c)*e.DEG2RAD;c=Math.cos(d);d=Math.sin(d);var f=(b+1)%3,g=(b+2)%3,h=[[0,0,0],[0,0,0],[0,0,0]];h[f][f]=c*a.rot[f][f]-d*a.rot[f][g];h[f][g]=d*a.rot[f][f]+c*a.rot[f][g];h[f][b]=a.rot[f][b];h[g][f]=c*a.rot[g][f]-d*a.rot[g][g];h[g][g]=d*a.rot[g][f]+c*a.rot[g][g];h[g][b]=a.rot[g][b];h[b][f]=c*a.rot[b][f]-d*a.rot[b][g];h[b][g]=d*a.rot[b][f]+c*a.rot[b][g];h[b][b]=a.rot[b][b];return new J(h)};e.VectorFromSphere=lb;e.EquatorFromVector=Mb;e.SphereFromVector=Nb;e.HorizonFromVector=function(a,b){a=Nb(a);a.lon=
Ac(a.lon);a.lat+=Oa(b,a.lat);return a};e.VectorFromHorizon=function(a,b,c){b=v(b);var d=Ac(a.lon);c=a.lat+Bc(c,a.lat);a=new Ba(c,d,a.dist);return lb(a,b)};e.Refraction=Oa;e.InverseRefraction=Bc;e.RotateVector=Ya;e.RotateState=Ea;e.Rotation_EQJ_ECL=Cc;e.Rotation_ECL_EQJ=function(){return new J([[1,0,0],[0,.9174821430670688,.3977769691083922],[0,-.3977769691083922,.9174821430670688]])};e.Rotation_EQJ_EQD=ob;e.Rotation_EQJ_ECT=function(a){var b=v(a);a=ob(b);b=Jc(b);return ja(a,b)};e.Rotation_ECT_EQJ=
function(a){var b=v(a);a=Ic(b);b=pb(b);return ja(a,b)};e.Rotation_EQD_EQJ=pb;e.Rotation_EQD_HOR=Ob;e.Rotation_HOR_EQD=Dc;e.Rotation_HOR_EQJ=Ec;e.Rotation_EQJ_HOR=function(a,b){a=Ec(a,b);return Ka(a)};e.Rotation_EQD_ECL=Fc;e.Rotation_ECL_EQD=Gc;e.Rotation_ECL_HOR=Hc;e.Rotation_HOR_ECL=function(a,b){a=Hc(a,b);return Ka(a)};e.Rotation_EQJ_GAL=function(){return new J([[-.0548624779711344,.4941095946388765,-.8676668813529025],[-.8734572784246782,-.4447938112296831,-.1980677870294097],[-.483800052994852,
.7470034631630423,.4559861124470794]])};e.Rotation_GAL_EQJ=function(){return new J([[-.0548624779711344,-.8734572784246782,-.483800052994852],[.4941095946388765,-.4447938112296831,.7470034631630423],[-.8676668813529025,-.1980677870294097,.4559861124470794]])};e.Rotation_ECT_EQD=Ic;e.Rotation_EQD_ECT=Jc;var Fd=[["And","Andromeda"],["Ant","Antila"],["Aps","Apus"],["Aql","Aquila"],["Aqr","Aquarius"],["Ara","Ara"],["Ari","Aries"],["Aur","Auriga"],["Boo","Bootes"],["Cae","Caelum"],["Cam","Camelopardis"],
["Cap","Capricornus"],["Car","Carina"],["Cas","Cassiopeia"],["Cen","Centaurus"],["Cep","Cepheus"],["Cet","Cetus"],["Cha","Chamaeleon"],["Cir","Circinus"],["CMa","Canis Major"],["CMi","Canis Minor"],["Cnc","Cancer"],["Col","Columba"],["Com","Coma Berenices"],["CrA","Corona Australis"],["CrB","Corona Borealis"],["Crt","Crater"],["Cru","Crux"],["Crv","Corvus"],["CVn","Canes Venatici"],["Cyg","Cygnus"],["Del","Delphinus"],["Dor","Dorado"],["Dra","Draco"],["Equ","Equuleus"],["Eri","Eridanus"],["For","Fornax"],
["Gem","Gemini"],["Gru","Grus"],["Her","Hercules"],["Hor","Horologium"],["Hya","Hydra"],["Hyi","Hydrus"],["Ind","Indus"],["Lac","Lacerta"],["Leo","Leo"],["Lep","Lepus"],["Lib","Libra"],["LMi","Leo Minor"],["Lup","Lupus"],["Lyn","Lynx"],["Lyr","Lyra"],["Men","Mensa"],["Mic","Microscopium"],["Mon","Monoceros"],["Mus","Musca"],["Nor","Norma"],["Oct","Octans"],["Oph","Ophiuchus"],["Ori","Orion"],["Pav","Pavo"],["Peg","Pegasus"],["Per","Perseus"],["Phe","Phoenix"],["Pic","Pictor"],["PsA","Pisces Austrinus"],
["Psc","Pisces"],["Pup","Puppis"],["Pyx","Pyxis"],["Ret","Reticulum"],["Scl","Sculptor"],["Sco","Scorpius"],["Sct","Scutum"],["Ser","Serpens"],["Sex","Sextans"],["Sge","Sagitta"],["Sgr","Sagittarius"],["Tau","Taurus"],["Tel","Telescopium"],["TrA","Triangulum Australe"],["Tri","Triangulum"],["Tuc","Tucana"],["UMa","Ursa Major"],["UMi","Ursa Minor"],["Vel","Vela"],["Vir","Virgo"],["Vol","Volans"],["Vul","Vulpecula"]],Gd=[[83,0,8640,2112],[83,2880,5220,2076],[83,7560,8280,2068],[83,6480,7560,2064],[15,
0,2880,2040],[10,3300,3840,1968],[15,0,1800,1920],[10,3840,5220,1920],[83,6300,6480,1920],[33,7260,7560,1920],[15,0,1263,1848],[10,4140,4890,1848],[83,5952,6300,1800],[15,7260,7440,1800],[10,2868,3300,1764],[33,3300,4080,1764],[83,4680,5952,1680],[13,1116,1230,1632],[33,7350,7440,1608],[33,4080,4320,1596],[15,0,120,1584],[83,5040,5640,1584],[15,8490,8640,1584],[33,4320,4860,1536],[33,4860,5190,1512],[15,8340,8490,1512],[10,2196,2520,1488],[33,7200,7350,1476],[15,7393.2,7416,1462],[10,2520,2868,1440],
[82,2868,3030,1440],[33,7116,7200,1428],[15,7200,7393.2,1428],[15,8232,8340,1418],[13,0,876,1404],[33,6990,7116,1392],[13,612,687,1380],[13,876,1116,1368],[10,1116,1140,1368],[15,8034,8232,1350],[10,1800,2196,1344],[82,5052,5190,1332],[33,5190,6990,1332],[10,1140,1200,1320],[15,7968,8034,1320],[15,7416,7908,1316],[13,0,612,1296],[50,2196,2340,1296],[82,4350,4860,1272],[33,5490,5670,1272],[15,7908,7968,1266],[10,1200,1800,1260],[13,8232,8400,1260],[33,5670,6120,1236],[62,735,906,1212],[33,6120,6564,
1212],[13,0,492,1200],[62,492,600,1200],[50,2340,2448,1200],[13,8400,8640,1200],[82,4860,5052,1164],[13,0,402,1152],[13,8490,8640,1152],[39,6543,6564,1140],[33,6564,6870,1140],[30,6870,6900,1140],[62,600,735,1128],[82,3030,3300,1128],[13,60,312,1104],[82,4320,4350,1080],[50,2448,2652,1068],[30,7887,7908,1056],[30,7875,7887,1050],[30,6900,6984,1044],[82,3300,3660,1008],[82,3660,3882,960],[8,5556,5670,960],[39,5670,5880,960],[50,3330,3450,954],[0,0,906,882],[62,906,924,882],[51,6969,6984,876],[62,1620,
1689,864],[30,7824,7875,864],[44,7875,7920,864],[7,2352,2652,852],[50,2652,2790,852],[0,0,720,840],[44,7920,8214,840],[44,8214,8232,828],[0,8232,8460,828],[62,924,978,816],[82,3882,3960,816],[29,4320,4440,816],[50,2790,3330,804],[48,3330,3558,804],[0,258,507,792],[8,5466,5556,792],[0,8460,8550,770],[29,4440,4770,768],[0,8550,8640,752],[29,5025,5052,738],[80,870,978,736],[62,978,1620,736],[7,1620,1710,720],[51,6543,6969,720],[82,3960,4320,696],[30,7080,7530,696],[7,1710,2118,684],[48,3558,3780,684],
[29,4770,5025,684],[0,0,24,672],[80,507,600,672],[7,2118,2352,672],[37,2838,2880,672],[30,7530,7824,672],[30,6933,7080,660],[80,690,870,654],[25,5820,5880,648],[8,5430,5466,624],[25,5466,5820,624],[51,6612,6792,624],[48,3870,3960,612],[51,6792,6933,612],[80,600,690,600],[66,258,306,570],[48,3780,3870,564],[87,7650,7710,564],[77,2052,2118,548],[0,24,51,528],[73,5730,5772,528],[37,2118,2238,516],[87,7140,7290,510],[87,6792,6930,506],[0,51,306,504],[87,7290,7404,492],[37,2811,2838,480],[87,7404,7650,
468],[87,6930,7140,460],[6,1182,1212,456],[75,6792,6840,444],[59,2052,2076,432],[37,2238,2271,420],[75,6840,7140,388],[77,1788,1920,384],[39,5730,5790,384],[75,7140,7290,378],[77,1662,1788,372],[77,1920,2016,372],[23,4620,4860,360],[39,6210,6570,344],[23,4272,4620,336],[37,2700,2811,324],[39,6030,6210,308],[61,0,51,300],[77,2016,2076,300],[37,2520,2700,300],[61,7602,7680,300],[37,2271,2496,288],[39,6570,6792,288],[31,7515,7578,284],[61,7578,7602,284],[45,4146,4272,264],[59,2247,2271,240],[37,2496,
2520,240],[21,2811,2853,240],[61,8580,8640,240],[6,600,1182,238],[31,7251,7308,204],[8,4860,5430,192],[61,8190,8580,180],[21,2853,3330,168],[45,3330,3870,168],[58,6570,6718.4,150],[3,6718.4,6792,150],[31,7500,7515,144],[20,2520,2526,132],[73,6570,6633,108],[39,5790,6030,96],[58,6570,6633,72],[61,7728,7800,66],[66,0,720,48],[73,6690,6792,48],[31,7308,7500,48],[34,7500,7680,48],[61,7680,7728,48],[61,7920,8190,48],[61,7800,7920,42],[20,2526,2592,36],[77,1290,1662,0],[59,1662,1680,0],[20,2592,2910,0],
[85,5280,5430,0],[58,6420,6570,0],[16,954,1182,-42],[77,1182,1290,-42],[73,5430,5856,-78],[59,1680,1830,-96],[59,2100,2247,-96],[73,6420,6468,-96],[73,6570,6690,-96],[3,6690,6792,-96],[66,8190,8580,-96],[45,3870,4146,-144],[85,4146,4260,-144],[66,0,120,-168],[66,8580,8640,-168],[85,5130,5280,-192],[58,5730,5856,-192],[3,7200,7392,-216],[4,7680,7872,-216],[58,6180,6468,-240],[54,2100,2910,-264],[35,1770,1830,-264],[59,1830,2100,-264],[41,2910,3012,-264],[74,3450,3870,-264],[85,4260,4620,-264],[58,
6330,6360,-280],[3,6792,7200,-288.8],[35,1740,1770,-348],[4,7392,7680,-360],[73,6180,6570,-384],[72,6570,6792,-384],[41,3012,3090,-408],[58,5856,5895,-438],[41,3090,3270,-456],[26,3870,3900,-456],[71,5856,5895,-462],[47,5640,5730,-480],[28,4530,4620,-528],[85,4620,5130,-528],[41,3270,3510,-576],[16,600,954,-585.2],[35,954,1350,-585.2],[26,3900,4260,-588],[28,4260,4530,-588],[47,5130,5370,-588],[58,5856,6030,-590],[16,0,600,-612],[11,7680,7872,-612],[4,7872,8580,-612],[16,8580,8640,-612],[41,3510,
3690,-636],[35,1692,1740,-654],[46,1740,2202,-654],[11,7200,7680,-672],[41,3690,3810,-700],[41,4530,5370,-708],[47,5370,5640,-708],[71,5640,5760,-708],[35,1650,1692,-720],[58,6030,6336,-720],[76,6336,6420,-720],[41,3810,3900,-748],[19,2202,2652,-792],[41,4410,4530,-792],[41,3900,4410,-840],[36,1260,1350,-864],[68,3012,3372,-882],[35,1536,1650,-888],[76,6420,6900,-888],[65,7680,8280,-888],[70,8280,8400,-888],[36,1080,1260,-950],[1,3372,3960,-954],[70,0,600,-960],[36,600,1080,-960],[35,1392,1536,-960],
[70,8400,8640,-960],[14,5100,5370,-1008],[49,5640,5760,-1008],[71,5760,5911.5,-1008],[9,1740,1800,-1032],[22,1800,2370,-1032],[67,2880,3012,-1032],[35,1230,1392,-1056],[71,5911.5,6420,-1092],[24,6420,6900,-1092],[76,6900,7320,-1092],[53,7320,7680,-1092],[35,1080,1230,-1104],[9,1620,1740,-1116],[49,5520,5640,-1152],[63,0,840,-1156],[35,960,1080,-1176],[40,1470,1536,-1176],[9,1536,1620,-1176],[38,7680,7920,-1200],[67,2160,2880,-1218],[84,2880,2940,-1218],[35,870,960,-1224],[40,1380,1470,-1224],[63,
0,660,-1236],[12,2160,2220,-1260],[84,2940,3042,-1272],[40,1260,1380,-1276],[32,1380,1440,-1276],[63,0,570,-1284],[35,780,870,-1296],[64,1620,1800,-1296],[49,5418,5520,-1296],[84,3042,3180,-1308],[12,2220,2340,-1320],[14,4260,4620,-1320],[49,5100,5418,-1320],[56,5418,5520,-1320],[32,1440,1560,-1356],[84,3180,3960,-1356],[14,3960,4050,-1356],[5,6300,6480,-1368],[78,6480,7320,-1368],[38,7920,8400,-1368],[40,1152,1260,-1380],[64,1800,1980,-1380],[12,2340,2460,-1392],[63,0,480,-1404],[35,480,780,-1404],
[63,8400,8640,-1404],[32,1560,1650,-1416],[56,5520,5911.5,-1440],[43,7320,7680,-1440],[64,1980,2160,-1464],[18,5460,5520,-1464],[5,5911.5,5970,-1464],[18,5370,5460,-1526],[5,5970,6030,-1526],[64,2160,2460,-1536],[12,2460,3252,-1536],[14,4050,4260,-1536],[27,4260,4620,-1536],[14,4620,5232,-1536],[18,4860,4920,-1560],[5,6030,6060,-1560],[40,780,1152,-1620],[69,1152,1650,-1620],[18,5310,5370,-1620],[5,6060,6300,-1620],[60,6300,6480,-1620],[81,7920,8400,-1620],[32,1650,2370,-1680],[18,4920,5310,-1680],
[79,5310,6120,-1680],[81,0,480,-1800],[42,1260,1650,-1800],[86,2370,3252,-1800],[12,3252,4050,-1800],[55,4050,4920,-1800],[60,6480,7680,-1800],[43,7680,8400,-1800],[81,8400,8640,-1800],[81,270,480,-1824],[42,0,1260,-1980],[17,2760,4920,-1980],[2,4920,6480,-1980],[52,1260,2760,-2040],[57,0,8640,-2160]],Tb,id,jd=function(a,b,c,d){this.symbol=a;this.name=b;this.ra1875=c;this.dec1875=d};e.ConstellationInfo=jd;e.Constellation=function(a,b){w(a);w(b);if(-90>b||90<b)throw"Invalid declination angle. Must be -90..+90.";
a%=24;0>a&&(a+=24);Tb||(Tb=ob(new O(-45655.74141261017)),id=new O(0));a=new Ba(b,15*a,1);a=lb(a,id);a=Ya(Tb,a);a=Mb(a);b=10/240;for(var c=b/15,d=$jscomp.makeIterator(Gd),f=d.next();!f.done;f=d.next()){f=f.value;var g=f[1]*c,h=f[2]*c;if(f[3]*b<=a.dec&&g<=a.ra&&a.ra<h)return b=Fd[f[0]],new jd(b[0],b[1],a.ra,a.dec)}throw"Unable to find constellation for given coordinates.";};var S;(function(a){a.Penumbral="penumbral";a.Partial="partial";a.Annular="annular";a.Total="total"})(S=e.EclipseKind||(e.EclipseKind=
{}));var Pc=function(a,b,c,d,f,g){this.kind=a;this.obscuration=b;this.peak=c;this.sd_penum=d;this.sd_partial=f;this.sd_total=g};e.LunarEclipseInfo=Pc;var xd=function(a,b,c,d,f,g,h){this.time=a;this.u=b;this.r=c;this.k=d;this.p=f;this.target=g;this.dir=h};e.SearchLunarEclipse=Oc;var Rc=function(a,b,c,d,f,g){this.kind=a;this.obscuration=b;this.peak=c;this.distance=d;this.latitude=f;this.longitude=g};e.GlobalSolarEclipseInfo=Rc;e.NextLunarEclipse=function(a){a=v(a);a=a.AddDays(10);return Oc(a)};e.SearchGlobalSolarEclipse=
Qc;e.NextGlobalSolarEclipse=function(a){a=v(a);a=a.AddDays(10);return Qc(a)};var Vc=function(a,b){this.time=a;this.altitude=b};e.EclipseEvent=Vc;var Xc=function(a,b,c,d,f,g,h){this.kind=a;this.obscuration=b;this.partial_begin=c;this.total_begin=d;this.peak=f;this.total_end=g;this.partial_end=h};e.LocalSolarEclipseInfo=Xc;e.SearchLocalSolarEclipse=Wc;e.NextLocalSolarEclipse=function(a,b){a=v(a);a=a.AddDays(10);return Wc(a,b)};var $c=function(a,b,c,d){this.start=a;this.peak=b;this.finish=c;this.separation=
d};e.TransitInfo=$c;e.SearchTransit=Zc;e.NextTransit=function(a,b){b=v(b);b=b.AddDays(100);return Zc(a,b)};var ra;(function(a){a[a.Invalid=0]="Invalid";a[a.Ascending=1]="Ascending";a[a.Descending=-1]="Descending"})(ra=e.NodeEventKind||(e.NodeEventKind={}));var bd=function(a,b){this.kind=a;this.time=b};e.NodeEventInfo=bd;e.SearchMoonNode=ad;e.NextMoonNode=function(a){var b=a.time.AddDays(10);b=ad(b);switch(a.kind){case ra.Ascending:if(b.kind!==ra.Descending)throw"Internal error: previous node was ascending, but this node was: "+
b.kind;break;case ra.Descending:if(b.kind!==ra.Ascending)throw"Internal error: previous node was descending, but this node was: "+b.kind;break;default:throw"Previous node has an invalid node kind: "+a.kind;}return b};var Ub=function(a,b,c,d){this.ra=a;this.dec=b;this.spin=c;this.north=d};e.AxisInfo=Ub;e.RotationAxis=function(a,b){b=v(b);var c=b.tt,d=c/36525;switch(a){case m.Sun:a=286.13;var f=63.87;c=84.176+14.1844*c;break;case m.Mercury:a=281.0103-.0328*d;f=61.4155-.0049*d;c=329.5988+6.1385108*c+
.01067257*Math.sin(e.DEG2RAD*(174.7910857+4.092335*c))-.00112309*Math.sin(e.DEG2RAD*(349.5821714+8.18467*c))-1.104E-4*Math.sin(e.DEG2RAD*(164.3732571+12.277005*c))-2.539E-5*Math.sin(e.DEG2RAD*(339.1643429+16.36934*c))-5.71E-6*Math.sin(e.DEG2RAD*(153.9554286+20.461675*c));break;case m.Venus:a=272.76;f=67.16;c=160.2-1.4813688*c;break;case m.Earth:return a=xa([0,0,1],b,F.Into2000),a=wa(a,b,F.Into2000),a=new E(a[0],a[1],a[2],b),c=Mb(a),new Ub(c.ra,c.dec,190.41375788700253+360.9856122880876*b.ut,a);case m.Moon:var g=
e.DEG2RAD*(125.045-.0529921*c),h=e.DEG2RAD*(250.089-.1059842*c),l=e.DEG2RAD*(260.008+13.0120009*c),k=e.DEG2RAD*(176.625+13.3407154*c),n=e.DEG2RAD*(357.529+.9856003*c),p=e.DEG2RAD*(311.589+26.4057084*c),q=e.DEG2RAD*(134.963+13.064993*c),t=e.DEG2RAD*(276.617+.3287146*c),y=e.DEG2RAD*(34.226+1.7484877*c),x=e.DEG2RAD*(15.134-.1589763*c),z=e.DEG2RAD*(119.743+.0036096*c),ab=e.DEG2RAD*(239.961+.1643573*c),va=e.DEG2RAD*(25.053+12.9590088*c);a=269.9949+.0031*d-3.8787*Math.sin(g)-.1204*Math.sin(h)+.07*Math.sin(l)-
.0172*Math.sin(k)+.0072*Math.sin(p)-.0052*Math.sin(x)+.0043*Math.sin(va);f=66.5392+.013*d+1.5419*Math.cos(g)+.0239*Math.cos(h)-.0278*Math.cos(l)+.0068*Math.cos(k)-.0029*Math.cos(p)+9E-4*Math.cos(q)+8E-4*Math.cos(x)-9E-4*Math.cos(va);c=38.3213+(13.17635815-1.4E-12*c)*c+3.561*Math.sin(g)+.1208*Math.sin(h)-.0642*Math.sin(l)+.0158*Math.sin(k)+.0252*Math.sin(n)-.0066*Math.sin(p)-.0047*Math.sin(q)-.0046*Math.sin(t)+.0028*Math.sin(y)+.0052*Math.sin(x)+.004*Math.sin(z)+.0019*Math.sin(ab)-.0044*Math.sin(va);
break;case m.Mars:a=317.269202-.10927547*d+6.8E-5*Math.sin(e.DEG2RAD*(198.991226+19139.4819985*d))+2.38E-4*Math.sin(e.DEG2RAD*(226.292679+38280.8511281*d))+5.2E-5*Math.sin(e.DEG2RAD*(249.663391+57420.7251593*d))+9E-6*Math.sin(e.DEG2RAD*(266.18351+76560.636795*d))+.419057*Math.sin(e.DEG2RAD*(79.398797+.5042615*d));f=54.432516-.05827105*d+5.1E-5*Math.cos(e.DEG2RAD*(122.433576+19139.9407476*d))+1.41E-4*Math.cos(e.DEG2RAD*(43.058401+38280.8753272*d))+3.1E-5*Math.cos(e.DEG2RAD*(57.663379+57420.7517205*
d))+5E-6*Math.cos(e.DEG2RAD*(79.476401+76560.6495004*d))+1.591274*Math.cos(e.DEG2RAD*(166.325722+.5042615*d));c=176.049863+350.891982443297*c+1.45E-4*Math.sin(e.DEG2RAD*(129.071773+19140.0328244*d))+1.57E-4*Math.sin(e.DEG2RAD*(36.352167+38281.0473591*d))+4E-5*Math.sin(e.DEG2RAD*(56.668646+57420.929536*d))+1E-6*Math.sin(e.DEG2RAD*(67.364003+76560.2552215*d))+1E-6*Math.sin(e.DEG2RAD*(104.79268+95700.4387578*d))+.584542*Math.sin(e.DEG2RAD*(95.391654+.5042615*d));break;case m.Jupiter:f=e.DEG2RAD*(99.360714+
4850.4046*d);g=e.DEG2RAD*(175.895369+1191.9605*d);h=e.DEG2RAD*(300.323162+262.5475*d);l=e.DEG2RAD*(114.012305+6070.2476*d);k=e.DEG2RAD*(49.511251+64.3*d);a=268.056595-.006499*d+1.17E-4*Math.sin(f)+9.38E-4*Math.sin(g)+.001432*Math.sin(h)+3E-5*Math.sin(l)+.00215*Math.sin(k);f=64.495303+.002413*d+5E-5*Math.cos(f)+4.04E-4*Math.cos(g)+6.17E-4*Math.cos(h)-1.3E-5*Math.cos(l)+9.26E-4*Math.cos(k);c=284.95+870.536*c;break;case m.Saturn:a=40.589-.036*d;f=83.537-.004*d;c=38.9+810.7939024*c;break;case m.Uranus:a=
257.311;f=-15.175;c=203.81-501.1600928*c;break;case m.Neptune:d=e.DEG2RAD*(357.85+52.316*d);a=299.36+.7*Math.sin(d);f=43.46-.51*Math.cos(d);c=249.978+541.1397757*c-.48*Math.sin(d);break;case m.Pluto:a=132.993;f=-6.163;c=302.695+56.3625225*c;break;default:throw"Invalid body: "+a;}d=f*e.DEG2RAD;g=a*e.DEG2RAD;h=Math.cos(d);b=new E(h*Math.cos(g),h*Math.sin(g),Math.sin(d),b);return new Ub(a/15,f,c,b)};e.LagrangePoint=function(a,b,c,d){var f=v(b);b=C(c);var g=C(d);c===m.Earth&&d===m.Moon?(c=new I(0,0,0,
0,0,0,f),d=Ra(f)):(c=mb(c,f),d=mb(d,f));return cd(a,c,b,d,g)};e.LagrangePointFast=cd;var H=function(a,b,c){b=v(b);this.originBody=a;for(var d=$jscomp.makeIterator(c),f=d.next();!f.done;f=d.next())if(f.value.t.tt!==b.tt)throw"Inconsistent times in bodyStates";d=[];f=H.CalcSolarSystem(b);this.curr=new kd(b,f,d);a=this.InternalBodyState(a);c=$jscomp.makeIterator(c);for(f=c.next();!f.done;f=c.next()){var g=f.value;f=new B(g.x+a.r.x,g.y+a.r.y,g.z+a.r.z);g=new B(g.vx+a.v.x,g.vy+a.v.y,g.vz+a.v.z);var h=
B.zero();d.push(new Ua(b.tt,f,g,h))}this.CalcBodyAccelerations();this.prev=this.Duplicate()};H.prototype.Update=function(a){a=v(a);var b=a.tt-this.curr.time.tt;if(0===b)this.prev=this.Duplicate();else{this.Swap();this.curr.time=a;this.curr.gravitators=H.CalcSolarSystem(a);for(var c=0;c<this.curr.bodies.length;++c){var d=this.prev.bodies[c];this.curr.bodies[c].r=Ca(b,d.r,d.v,d.a)}this.CalcBodyAccelerations();for(c=0;c<this.curr.bodies.length;++c){d=this.prev.bodies[c];var f=this.curr.bodies[c],g=d.a.mean(f.a);
f.tt=a.tt;f.r=Ca(b,d.r,d.v,g);f.v=Eb(b,d.v,g)}this.CalcBodyAccelerations()}b=[];c=this.InternalBodyState(this.originBody);d=$jscomp.makeIterator(this.curr.bodies);for(f=d.next();!f.done;f=d.next())f=f.value,b.push(new I(f.r.x-c.r.x,f.r.y-c.r.y,f.r.z-c.r.z,f.v.x-c.v.x,f.v.y-c.v.y,f.v.z-c.v.z,a));return b};H.prototype.Swap=function(){var a=this.curr;this.curr=this.prev;this.prev=a};H.prototype.SolarSystemBodyState=function(a){a=this.InternalBodyState(a);var b=this.InternalBodyState(this.originBody);
return pa(a.sub(b),this.curr.time)};H.prototype.InternalBodyState=function(a){if(a===m.SSB)return new X(this.curr.time.tt,B.zero(),B.zero());var b=this.curr.gravitators[a];if(b)return b;throw"Invalid body: "+a;};H.CalcSolarSystem=function(a){var b={},c=new X(a.tt,B.zero(),B.zero());b[m.Mercury]=R(c,a.tt,m.Mercury,4.912547451450812E-11);b[m.Venus]=R(c,a.tt,m.Venus,7.243452486162703E-10);b[m.Earth]=R(c,a.tt,m.Earth,8.997011346712498E-10);b[m.Mars]=R(c,a.tt,m.Mars,9.549535105779258E-11);b[m.Jupiter]=
R(c,a.tt,m.Jupiter,2.825345909524226E-7);b[m.Saturn]=R(c,a.tt,m.Saturn,8.459715185680659E-8);b[m.Uranus]=R(c,a.tt,m.Uranus,1.292024916781969E-8);b[m.Neptune]=R(c,a.tt,m.Neptune,1.524358900784276E-8);for(var d in b)b[d].r.decr(c.r),b[d].v.decr(c.v);b[m.Sun]=new X(a.tt,c.r.neg(),c.v.neg());return b};H.prototype.CalcBodyAccelerations=function(){for(var a=$jscomp.makeIterator(this.curr.bodies),b=a.next();!b.done;b=a.next())b=b.value,b.a=B.zero(),H.AddAcceleration(b.a,b.r,this.curr.gravitators[m.Sun].r,
2.959122082855911E-4),H.AddAcceleration(b.a,b.r,this.curr.gravitators[m.Mercury].r,4.912547451450812E-11),H.AddAcceleration(b.a,b.r,this.curr.gravitators[m.Venus].r,7.243452486162703E-10),H.AddAcceleration(b.a,b.r,this.curr.gravitators[m.Earth].r,8.997011346712498E-10),H.AddAcceleration(b.a,b.r,this.curr.gravitators[m.Mars].r,9.549535105779258E-11),H.AddAcceleration(b.a,b.r,this.curr.gravitators[m.Jupiter].r,2.825345909524226E-7),H.AddAcceleration(b.a,b.r,this.curr.gravitators[m.Saturn].r,8.459715185680659E-8),
H.AddAcceleration(b.a,b.r,this.curr.gravitators[m.Uranus].r,1.292024916781969E-8),H.AddAcceleration(b.a,b.r,this.curr.gravitators[m.Neptune].r,1.524358900784276E-8)};H.AddAcceleration=function(a,b,c,d){var f=c.x-b.x,g=c.y-b.y;b=c.z-b.z;c=f*f+g*g+b*b;d/=c*Math.sqrt(c);a.x+=f*d;a.y+=g*d;a.z+=b*d};H.prototype.Duplicate=function(){var a={};for(b in this.curr.gravitators)a[b]=this.curr.gravitators[b].clone();var b=[];for(var c=$jscomp.makeIterator(this.curr.bodies),d=c.next();!d.done;d=c.next())b.push(d.value.clone());
return new kd(this.curr.time,a,b)};$jscomp.global.Object.defineProperties(H.prototype,{OriginBody:{configurable:!0,enumerable:!0,get:function(){return this.originBody}},Time:{configurable:!0,enumerable:!0,get:function(){return this.curr.time}}});e.GravitySimulator=H;var kd=function(a,b,c){this.time=a;this.gravitators=b;this.bodies=c}},{}]},{},[1])(1)});
+3441
View File
File diff suppressed because it is too large Load Diff
+9806
View File
File diff suppressed because it is too large Load Diff
+338
View File
@@ -0,0 +1,338 @@
/*
MIT
Astronomy library for JavaScript (browser and Node.js).
https://github.com/cosinekitty/astronomy
MIT License
Copyright (c) 2019-2023 Don Cross <cosinekitty@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.createTemplateTagFirstArg=function(a){return a.raw=a};$jscomp.createTemplateTagFirstArgWithRaw=function(a,b){a.raw=b;return a};$jscomp.arrayIteratorImpl=function(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.makeIterator=function(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):$jscomp.arrayIterator(a)};
$jscomp.getGlobal=function(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;$jscomp.FORCE_POLYFILL_PROMISE=!1;
$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a};$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};
$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(a,b){var c=$jscomp.propertyToPolyfillSymbol[b];if(null==c)return a[b];c=a[c];return void 0!==c?c:a[b]};$jscomp.polyfill=function(a,b,c,d){b&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(a,b,c,d):$jscomp.polyfillUnisolated(a,b,c,d))};
$jscomp.polyfillUnisolated=function(a,b,c,d){c=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];if(!(e in c))return;c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:b})};
$jscomp.polyfillIsolated=function(a,b,c,d){var e=a.split(".");a=1===e.length;d=e[0];d=!a&&d in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var f=0;f<e.length-1;f++){var g=e[f];if(!(g in d))return;d=d[g]}e=e[e.length-1];c=$jscomp.IS_SYMBOL_NATIVE&&"es6"===c?d[e]:null;b=b(c);null!=b&&(a?$jscomp.defineProperty($jscomp.polyfills,e,{configurable:!0,writable:!0,value:b}):b!==c&&(void 0===$jscomp.propertyToPolyfillSymbol[e]&&($jscomp.propertyToPolyfillSymbol[e]=$jscomp.IS_SYMBOL_NATIVE?$jscomp.global.Symbol(e):
$jscomp.POLYFILL_PREFIX+e),$jscomp.defineProperty(d,$jscomp.propertyToPolyfillSymbol[e],{configurable:!0,writable:!0,value:b})))};$jscomp.polyfill("Math.log10",function(a){return a?a:function(b){return Math.log(b)/Math.LN10}},"es6","es3");$jscomp.polyfill("Number.isFinite",function(a){return a?a:function(b){return"number"!==typeof b?!1:!isNaN(b)&&Infinity!==b&&-Infinity!==b}},"es6","es3");
$jscomp.polyfill("Math.hypot",function(a){return a?a:function(b){if(2>arguments.length)return arguments.length?Math.abs(arguments[0]):0;var c,d,e;for(c=e=0;c<arguments.length;c++)e=Math.max(e,Math.abs(arguments[c]));if(1E100<e||1E-100>e){if(!e)return e;for(c=d=0;c<arguments.length;c++){var f=Number(arguments[c])/e;d+=f*f}return Math.sqrt(d)*e}for(c=d=0;c<arguments.length;c++)f=Number(arguments[c]),d+=f*f;return Math.sqrt(d)}},"es6","es3");
$jscomp.polyfill("Number.MAX_SAFE_INTEGER",function(){return 9007199254740991},"es6","es3");$jscomp.polyfill("Number.isInteger",function(a){return a?a:function(b){return Number.isFinite(b)?b===Math.floor(b):!1}},"es6","es3");$jscomp.polyfill("Number.isSafeInteger",function(a){return a?a:function(b){return Number.isInteger(b)&&Math.abs(b)<=Number.MAX_SAFE_INTEGER}},"es6","es3");
$jscomp.polyfill("Math.cbrt",function(a){return a?a:function(b){if(0===b)return b;b=Number(b);var c=Math.pow(Math.abs(b),1/3);return 0>b?-c:c}},"es6","es3");Object.defineProperty(exports,"__esModule",{value:!0});
exports.GeoEmbState=exports.GeoMoonState=exports.EclipticGeoMoon=exports.GeoMoon=exports.Ecliptic=exports.ObserverGravity=exports.VectorObserver=exports.ObserverState=exports.ObserverVector=exports.Equator=exports.SunPosition=exports.Observer=exports.Horizon=exports.EclipticCoordinates=exports.HorizontalCoordinates=exports.MakeRotation=exports.RotationMatrix=exports.EquatorialCoordinates=exports.Spherical=exports.StateVector=exports.Vector=exports.SiderealTime=exports.Libration=exports.LibrationInfo=
exports.CalcMoonCount=exports.e_tilt=exports.MakeTime=exports.AstroTime=exports.SetDeltaTFunction=exports.DeltaT_JplHorizons=exports.DeltaT_EspenakMeeus=exports.PlanetOrbitalPeriod=exports.DefineStar=exports.Body=exports.AngleBetween=exports.MassProduct=exports.CALLISTO_RADIUS_KM=exports.GANYMEDE_RADIUS_KM=exports.EUROPA_RADIUS_KM=exports.IO_RADIUS_KM=exports.JUPITER_MEAN_RADIUS_KM=exports.JUPITER_POLAR_RADIUS_KM=exports.JUPITER_EQUATORIAL_RADIUS_KM=exports.RAD2HOUR=exports.RAD2DEG=exports.HOUR2RAD=
exports.DEG2RAD=exports.AU_PER_LY=exports.KM_PER_AU=exports.C_AUDAY=void 0;
exports.VectorFromHorizon=exports.HorizonFromVector=exports.SphereFromVector=exports.EquatorFromVector=exports.VectorFromSphere=exports.Pivot=exports.IdentityMatrix=exports.CombineRotation=exports.InverseRotation=exports.NextPlanetApsis=exports.SearchPlanetApsis=exports.NextLunarApsis=exports.SearchLunarApsis=exports.Apsis=exports.ApsisKind=exports.SearchPeakMagnitude=exports.SearchMaxElongation=exports.Elongation=exports.ElongationEvent=exports.Seasons=exports.SeasonInfo=exports.HourAngle=exports.SearchHourAngle=
exports.HourAngleEvent=exports.SearchAltitude=exports.SearchRiseSet=exports.Atmosphere=exports.AtmosphereInfo=exports.NextMoonQuarter=exports.SearchMoonQuarter=exports.MoonQuarter=exports.SearchMoonPhase=exports.MoonPhase=exports.SearchRelativeLongitude=exports.Illumination=exports.IlluminationInfo=exports.EclipticLongitude=exports.AngleFromSun=exports.PairLongitude=exports.SearchSunLongitude=exports.Search=exports.HelioState=exports.BaryState=exports.GeoVector=exports.BackdatePosition=exports.CorrectLightTravel=
exports.HelioDistance=exports.HelioVector=exports.JupiterMoons=exports.JupiterMoonsInfo=void 0;
exports.GravitySimulator=exports.LagrangePointFast=exports.LagrangePoint=exports.RotationAxis=exports.AxisInfo=exports.NextMoonNode=exports.SearchMoonNode=exports.NodeEventInfo=exports.NodeEventKind=exports.NextTransit=exports.SearchTransit=exports.TransitInfo=exports.NextLocalSolarEclipse=exports.SearchLocalSolarEclipse=exports.LocalSolarEclipseInfo=exports.EclipseEvent=exports.NextGlobalSolarEclipse=exports.SearchGlobalSolarEclipse=exports.NextLunarEclipse=exports.GlobalSolarEclipseInfo=exports.SearchLunarEclipse=
exports.LunarEclipseInfo=exports.EclipseKind=exports.Constellation=exports.ConstellationInfo=exports.Rotation_EQD_ECT=exports.Rotation_ECT_EQD=exports.Rotation_GAL_EQJ=exports.Rotation_EQJ_GAL=exports.Rotation_HOR_ECL=exports.Rotation_ECL_HOR=exports.Rotation_ECL_EQD=exports.Rotation_EQD_ECL=exports.Rotation_EQJ_HOR=exports.Rotation_HOR_EQJ=exports.Rotation_HOR_EQD=exports.Rotation_EQD_HOR=exports.Rotation_EQD_EQJ=exports.Rotation_ECT_EQJ=exports.Rotation_EQJ_ECT=exports.Rotation_EQJ_EQD=exports.Rotation_ECL_EQJ=
exports.Rotation_EQJ_ECL=exports.RotateState=exports.RotateVector=exports.InverseRefraction=exports.Refraction=void 0;exports.C_AUDAY=173.1446326846693;exports.KM_PER_AU=1.4959787069098932E8;exports.AU_PER_LY=63241.07708807546;exports.DEG2RAD=.017453292519943295;exports.HOUR2RAD=.26179938779914946;exports.RAD2DEG=57.29577951308232;exports.RAD2HOUR=3.819718634205488;exports.JUPITER_EQUATORIAL_RADIUS_KM=71492;exports.JUPITER_POLAR_RADIUS_KM=66854;exports.JUPITER_MEAN_RADIUS_KM=69911;
exports.IO_RADIUS_KM=1821.6;exports.EUROPA_RADIUS_KM=1560.8;exports.GANYMEDE_RADIUS_KM=2631.2;exports.CALLISTO_RADIUS_KM=2410.3;
var DAYS_PER_TROPICAL_YEAR=365.24217,J2000=new Date("2000-01-01T12:00:00Z"),PI2=2*Math.PI,ARC=180/Math.PI*3600,ASEC2RAD=4.84813681109536E-6,ASEC180=648E3,ASEC360=2*ASEC180,ANGVEL=7.292115E-5,AU_PER_PARSEC=ASEC180/Math.PI,SUN_MAG_1AU=-.17-5*Math.log10(AU_PER_PARSEC),MEAN_SYNODIC_MONTH=29.530588,SECONDS_PER_DAY=86400,MILLIS_PER_DAY=1E3*SECONDS_PER_DAY,SOLAR_DAYS_PER_SIDEREAL_DAY=.9972695717592592,SUN_RADIUS_KM=695700,SUN_RADIUS_AU=SUN_RADIUS_KM/exports.KM_PER_AU,EARTH_FLATTENING=.996647180302104,EARTH_FLATTENING_SQUARED=
EARTH_FLATTENING*EARTH_FLATTENING,EARTH_EQUATORIAL_RADIUS_KM=6378.1366,EARTH_EQUATORIAL_RADIUS_AU=EARTH_EQUATORIAL_RADIUS_KM/exports.KM_PER_AU,EARTH_POLAR_RADIUS_KM=EARTH_EQUATORIAL_RADIUS_KM*EARTH_FLATTENING,EARTH_MEAN_RADIUS_KM=6371,EARTH_ATMOSPHERE_KM=88,EARTH_ECLIPSE_RADIUS_KM=EARTH_MEAN_RADIUS_KM+EARTH_ATMOSPHERE_KM,MOON_EQUATORIAL_RADIUS_KM=1738.1,MOON_EQUATORIAL_RADIUS_AU=MOON_EQUATORIAL_RADIUS_KM/exports.KM_PER_AU,MOON_MEAN_RADIUS_KM=1737.4,MOON_POLAR_RADIUS_KM=1736,MOON_POLAR_RADIUS_AU=MOON_POLAR_RADIUS_KM/
exports.KM_PER_AU,REFRACTION_NEAR_HORIZON=34/60,EARTH_MOON_MASS_RATIO=81.30056,SUN_GM=2.959122082855911E-4,MERCURY_GM=4.912547451450812E-11,VENUS_GM=7.243452486162703E-10,EARTH_GM=8.887692390113509E-10,MARS_GM=9.549535105779258E-11,JUPITER_GM=2.825345909524226E-7,SATURN_GM=8.459715185680659E-8,URANUS_GM=1.292024916781969E-8,NEPTUNE_GM=1.524358900784276E-8,PLUTO_GM=2.18869976542597E-12,MOON_GM=EARTH_GM/EARTH_MOON_MASS_RATIO;
function MassProduct(a){switch(a){case Body.Sun:return SUN_GM;case Body.Mercury:return MERCURY_GM;case Body.Venus:return VENUS_GM;case Body.Earth:return EARTH_GM;case Body.Moon:return MOON_GM;case Body.EMB:return EARTH_GM+MOON_GM;case Body.Mars:return MARS_GM;case Body.Jupiter:return JUPITER_GM;case Body.Saturn:return SATURN_GM;case Body.Uranus:return URANUS_GM;case Body.Neptune:return NEPTUNE_GM;case Body.Pluto:return PLUTO_GM;default:throw"Do not know mass product for body: "+a;}}
exports.MassProduct=MassProduct;function VerifyBoolean(a){if(!0!==a&&!1!==a)throw console.trace(),"Value is not boolean: "+a;return a}function VerifyNumber(a){if(!Number.isFinite(a))throw console.trace(),"Value is not a finite number: "+a;return a}function Frac(a){return a-Math.floor(a)}
function AngleBetween(a,b){var c=a.x*a.x+a.y*a.y+a.z*a.z;if(1E-8>Math.abs(c))throw"AngleBetween: first vector is too short.";var d=b.x*b.x+b.y*b.y+b.z*b.z;if(1E-8>Math.abs(d))throw"AngleBetween: second vector is too short.";a=(a.x*b.x+a.y*b.y+a.z*b.z)/Math.sqrt(c*d);return-1>=a?180:1<=a?0:exports.RAD2DEG*Math.acos(a)}exports.AngleBetween=AngleBetween;var Body;
(function(a){a.Sun="Sun";a.Moon="Moon";a.Mercury="Mercury";a.Venus="Venus";a.Earth="Earth";a.Mars="Mars";a.Jupiter="Jupiter";a.Saturn="Saturn";a.Uranus="Uranus";a.Neptune="Neptune";a.Pluto="Pluto";a.SSB="SSB";a.EMB="EMB";a.Star1="Star1";a.Star2="Star2";a.Star3="Star3";a.Star4="Star4";a.Star5="Star5";a.Star6="Star6";a.Star7="Star7";a.Star8="Star8"})(Body=exports.Body||(exports.Body={}));
var StarList=[Body.Star1,Body.Star2,Body.Star3,Body.Star4,Body.Star5,Body.Star6,Body.Star7,Body.Star8],StarTable=[{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0}];function GetStar(a){a=StarList.indexOf(a);return 0<=a?StarTable[a]:null}function UserDefinedStar(a){return(a=GetStar(a))&&0<a.dist?a:null}
function DefineStar(a,b,c,d){var e=GetStar(a);if(!e)throw"Invalid star body: "+a;VerifyNumber(b);VerifyNumber(c);VerifyNumber(d);if(0>b||24<=b)throw"Invalid right ascension for star: "+b;if(-90>c||90<c)throw"Invalid declination for star: "+c;if(1>d)throw"Invalid star distance: "+d;e.ra=b;e.dec=c;e.dist=d*exports.AU_PER_LY}exports.DefineStar=DefineStar;var PrecessDirection;(function(a){a[a.From2000=0]="From2000";a[a.Into2000=1]="Into2000"})(PrecessDirection||(PrecessDirection={}));
var Planet={Mercury:{OrbitalPeriod:87.969},Venus:{OrbitalPeriod:224.701},Earth:{OrbitalPeriod:365.256},Mars:{OrbitalPeriod:686.98},Jupiter:{OrbitalPeriod:4332.589},Saturn:{OrbitalPeriod:10759.22},Uranus:{OrbitalPeriod:30685.4},Neptune:{OrbitalPeriod:60189},Pluto:{OrbitalPeriod:90560}};function PlanetOrbitalPeriod(a){if(a in Planet)return Planet[a].OrbitalPeriod;throw"Unknown orbital period for: "+a;}exports.PlanetOrbitalPeriod=PlanetOrbitalPeriod;
var vsop={Mercury:[[[[4.40250710144,0,0],[.40989414977,1.48302034195,26087.9031415742],[.050462942,4.47785489551,52175.8062831484],[.00855346844,1.16520322459,78263.70942472259],[.00165590362,4.11969163423,104351.61256629678],[3.4561897E-4,.77930768443,130439.51570787099],[7.583476E-5,3.71348404924,156527.41884944518]],[[26087.90313685529,0,0],[.01131199811,6.21874197797,26087.9031415742],[.00292242298,3.04449355541,52175.8062831484],[7.5775081E-4,6.08568821653,78263.70942472259],[1.9676525E-4,2.80965111777,
104351.61256629678]]],[[[.11737528961,1.98357498767,26087.9031415742],[.02388076996,5.03738959686,52175.8062831484],[.01222839532,3.14159265359,0],[.0054325181,1.79644363964,78263.70942472259],[.0012977877,4.83232503958,104351.61256629678],[3.1866927E-4,1.58088495658,130439.51570787099],[7.963301E-5,4.60972126127,156527.41884944518]],[[.00274646065,3.95008450011,26087.9031415742],[9.9737713E-4,3.14159265359,0]]],[[[.39528271651,0,0],[.07834131818,6.19233722598,26087.9031415742],[.00795525558,2.95989690104,
52175.8062831484],[.00121281764,6.01064153797,78263.70942472259],[2.1921969E-4,2.77820093972,104351.61256629678],[4.354065E-5,5.82894543774,130439.51570787099]],[[.0021734774,4.65617158665,26087.9031415742],[4.4141826E-4,1.42385544001,52175.8062831484]]]],Venus:[[[[3.17614666774,0,0],[.01353968419,5.59313319619,10213.285546211],[8.9891645E-4,5.30650047764,20426.571092422],[5.477194E-5,4.41630661466,7860.4193924392],[3.455741E-5,2.6996444782,11790.6290886588],[2.372061E-5,2.99377542079,3930.2096962196],
[1.317168E-5,5.18668228402,26.2983197998],[1.664146E-5,4.25018630147,1577.3435424478],[1.438387E-5,4.15745084182,9683.5945811164],[1.200521E-5,6.15357116043,30639.856638633]],[[10213.28554621638,0,0],[9.5617813E-4,2.4640651111,10213.285546211],[7.787201E-5,.6247848222,20426.571092422]]],[[[.05923638472,.26702775812,10213.285546211],[4.0107978E-4,1.14737178112,20426.571092422],[3.2814918E-4,3.14159265359,0]],[[.00287821243,1.88964962838,10213.285546211]]],[[[.72334820891,0,0],[.00489824182,4.02151831717,
10213.285546211],[1.658058E-5,4.90206728031,20426.571092422],[1.378043E-5,1.12846591367,11790.6290886588],[1.632096E-5,2.84548795207,7860.4193924392],[4.98395E-6,2.58682193892,9683.5945811164],[2.21985E-6,2.01346696541,19367.1891622328],[2.37454E-6,2.55136053886,15720.8387848784]],[[3.4551041E-4,.89198706276,10213.285546211]]]],Earth:[[[[1.75347045673,0,0],[.03341656453,4.66925680415,6283.0758499914],[3.4894275E-4,4.62610242189,12566.1516999828],[3.417572E-5,2.82886579754,3.523118349],[3.497056E-5,
2.74411783405,5753.3848848968],[3.135899E-5,3.62767041756,77713.7714681205],[2.676218E-5,4.41808345438,7860.4193924392],[2.342691E-5,6.13516214446,3930.2096962196],[1.273165E-5,2.03709657878,529.6909650946],[1.324294E-5,.74246341673,11506.7697697936],[9.01854E-6,2.04505446477,26.2983197998],[1.199167E-5,1.10962946234,1577.3435424478],[8.57223E-6,3.50849152283,398.1490034082],[7.79786E-6,1.17882681962,5223.6939198022],[9.9025E-6,5.23268072088,5884.9268465832],[7.53141E-6,2.53339052847,5507.5532386674],
[5.05267E-6,4.58292599973,18849.2275499742],[4.92392E-6,4.20505711826,775.522611324],[3.56672E-6,2.91954114478,.0673103028],[2.84125E-6,1.89869240932,796.2980068164],[2.42879E-6,.34481445893,5486.777843175],[3.17087E-6,5.84901948512,11790.6290886588],[2.71112E-6,.31486255375,10977.078804699],[2.06217E-6,4.80646631478,2544.3144198834],[2.05478E-6,1.86953770281,5573.1428014331],[2.02318E-6,2.45767790232,6069.7767545534],[1.26225E-6,1.08295459501,20.7753954924],[1.55516E-6,.83306084617,213.299095438]],
[[6283.0758499914,0,0],[.00206058863,2.67823455808,6283.0758499914],[4.303419E-5,2.63512233481,12566.1516999828]],[[8.721859E-5,1.07253635559,6283.0758499914]]],[[],[[.00227777722,3.4137662053,6283.0758499914],[3.805678E-5,3.37063423795,12566.1516999828]]],[[[1.00013988784,0,0],[.01670699632,3.09846350258,6283.0758499914],[1.3956024E-4,3.05524609456,12566.1516999828],[3.08372E-5,5.19846674381,77713.7714681205],[1.628463E-5,1.17387558054,5753.3848848968],[1.575572E-5,2.84685214877,7860.4193924392],
[9.24799E-6,5.45292236722,11506.7697697936],[5.42439E-6,4.56409151453,3930.2096962196],[4.7211E-6,3.66100022149,5884.9268465832],[8.5831E-7,1.27079125277,161000.6857376741],[5.7056E-7,2.01374292245,83996.84731811189],[5.5736E-7,5.2415979917,71430.69561812909],[1.74844E-6,3.01193636733,18849.2275499742],[2.43181E-6,4.2734953079,11790.6290886588]],[[.00103018607,1.10748968172,6283.0758499914],[1.721238E-5,1.06442300386,12566.1516999828]],[[4.359385E-5,5.78455133808,6283.0758499914]]]],Mars:[[[[6.20347711581,
0,0],[.18656368093,5.0503710027,3340.6124266998],[.01108216816,5.40099836344,6681.2248533996],[9.1798406E-4,5.75478744667,10021.8372800994],[2.7744987E-4,5.97049513147,3.523118349],[1.0610235E-4,2.93958560338,2281.2304965106],[1.2315897E-4,.84956094002,2810.9214616052],[8.926784E-5,4.15697846427,.0172536522],[8.715691E-5,6.11005153139,13362.4497067992],[6.797556E-5,.36462229657,398.1490034082],[7.774872E-5,3.33968761376,5621.8429232104],[3.575078E-5,1.6618650571,2544.3144198834],[4.161108E-5,.22814971327,
2942.4634232916],[3.075252E-5,.85696614132,191.4482661116],[2.628117E-5,.64806124465,3337.0893083508],[2.937546E-5,6.07893711402,.0673103028],[2.389414E-5,5.03896442664,796.2980068164],[2.579844E-5,.02996736156,3344.1355450488],[1.528141E-5,1.14979301996,6151.533888305],[1.798806E-5,.65634057445,529.6909650946],[1.264357E-5,3.62275122593,5092.1519581158],[1.286228E-5,3.06796065034,2146.1654164752],[1.546404E-5,2.91579701718,1751.539531416],[1.024902E-5,3.69334099279,8962.4553499102],[8.91566E-6,.18293837498,
16703.062133499],[8.58759E-6,2.4009381194,2914.0142358238],[8.32715E-6,2.46418619474,3340.5951730476],[8.3272E-6,4.49495782139,3340.629680352],[7.12902E-6,3.66335473479,1059.3819301892],[7.48723E-6,3.82248614017,155.4203994342],[7.23861E-6,.67497311481,3738.761430108],[6.35548E-6,2.92182225127,8432.7643848156],[6.55162E-6,.48864064125,3127.3133312618],[5.50474E-6,3.81001042328,.9803210682],[5.5275E-6,4.47479317037,1748.016413067],[4.25966E-6,.55364317304,6283.0758499914],[4.15131E-6,.49662285038,
213.299095438],[4.72167E-6,3.62547124025,1194.4470102246],[3.06551E-6,.38052848348,6684.7479717486],[3.12141E-6,.99853944405,6677.7017350506],[2.93198E-6,4.22131299634,20.7753954924],[3.02375E-6,4.48618007156,3532.0606928114],[2.74027E-6,.54222167059,3340.545116397],[2.81079E-6,5.88163521788,1349.8674096588],[2.31183E-6,1.28242156993,3870.3033917944],[2.83602E-6,5.7688543494,3149.1641605882],[2.36117E-6,5.75503217933,3333.498879699],[2.74033E-6,.13372524985,3340.6797370026],[2.99395E-6,2.78323740866,
6254.6266625236]],[[3340.61242700512,0,0],[.01457554523,3.60433733236,3340.6124266998],[.00168414711,3.92318567804,6681.2248533996],[2.0622975E-4,4.26108844583,10021.8372800994],[3.452392E-5,4.7321039319,3.523118349],[2.586332E-5,4.60670058555,13362.4497067992],[8.41535E-6,4.45864030426,2281.2304965106]],[[5.8152577E-4,2.04961712429,3340.6124266998],[1.3459579E-4,2.45738706163,6681.2248533996]]],[[[.03197134986,3.76832042431,3340.6124266998],[.00298033234,4.10616996305,6681.2248533996],[.00289104742,
0,0],[3.1365539E-4,4.4465105309,10021.8372800994],[3.4841E-5,4.7881254926,13362.4497067992]],[[.00217310991,6.04472194776,3340.6124266998],[2.0976948E-4,3.14159265359,0],[1.2834709E-4,1.60810667915,6681.2248533996]]],[[[1.53033488271,0,0],[.1418495316,3.47971283528,3340.6124266998],[.00660776362,3.81783443019,6681.2248533996],[4.6179117E-4,4.15595316782,10021.8372800994],[8.109733E-5,5.55958416318,2810.9214616052],[7.485318E-5,1.77239078402,5621.8429232104],[5.523191E-5,1.3643630377,2281.2304965106],
[3.82516E-5,4.49407183687,13362.4497067992],[2.306537E-5,.09081579001,2544.3144198834],[1.999396E-5,5.36059617709,3337.0893083508],[2.484394E-5,4.9254563992,2942.4634232916],[1.960195E-5,4.74249437639,3344.1355450488],[1.167119E-5,2.11260868341,5092.1519581158],[1.102816E-5,5.00908403998,398.1490034082],[8.99066E-6,4.40791133207,529.6909650946],[9.92252E-6,5.83861961952,6151.533888305],[8.07354E-6,2.10217065501,1059.3819301892],[7.97915E-6,3.44839203899,796.2980068164],[7.40975E-6,1.49906336885,2146.1654164752]],
[[.01107433345,2.03250524857,3340.6124266998],[.00103175887,2.37071847807,6681.2248533996],[1.28772E-4,0,0],[1.081588E-4,2.70888095665,10021.8372800994]],[[4.4242249E-4,.47930604954,3340.6124266998],[8.138042E-5,.86998389204,6681.2248533996]]]],Jupiter:[[[[.59954691494,0,0],[.09695898719,5.06191793158,529.6909650946],[.00573610142,1.44406205629,7.1135470008],[.00306389205,5.41734730184,1059.3819301892],[9.7178296E-4,4.14264726552,632.7837393132],[7.2903078E-4,3.64042916389,522.5774180938],[6.4263975E-4,
3.41145165351,103.0927742186],[3.9806064E-4,2.29376740788,419.4846438752],[3.8857767E-4,1.27231755835,316.3918696566],[2.7964629E-4,1.7845459182,536.8045120954],[1.358973E-4,5.7748104079,1589.0728952838],[8.246349E-5,3.5822792584,206.1855484372],[8.768704E-5,3.63000308199,949.1756089698],[7.368042E-5,5.0810119427,735.8765135318],[6.26315E-5,.02497628807,213.299095438],[6.114062E-5,4.51319998626,1162.4747044078],[4.905396E-5,1.32084470588,110.2063212194],[5.305285E-5,1.30671216791,14.2270940016],[5.305441E-5,
4.18625634012,1052.2683831884],[4.647248E-5,4.69958103684,3.9321532631],[3.045023E-5,4.31676431084,426.598190876],[2.609999E-5,1.56667394063,846.0828347512],[2.028191E-5,1.06376530715,3.1813937377],[1.764763E-5,2.14148655117,1066.49547719],[1.722972E-5,3.88036268267,1265.5674786264],[1.920945E-5,.97168196472,639.897286314],[1.633223E-5,3.58201833555,515.463871093],[1.431999E-5,4.29685556046,625.6701923124],[9.73272E-6,4.09764549134,95.9792272178]],[[529.69096508814,0,0],[.00489503243,4.2208293947,
529.6909650946],[.00228917222,6.02646855621,7.1135470008],[3.0099479E-4,4.54540782858,1059.3819301892],[2.072092E-4,5.45943156902,522.5774180938],[1.2103653E-4,.16994816098,536.8045120954],[6.067987E-5,4.42422292017,103.0927742186],[5.433968E-5,3.98480737746,419.4846438752],[4.237744E-5,5.89008707199,14.2270940016]],[[4.7233601E-4,4.32148536482,7.1135470008],[3.0649436E-4,2.929777887,529.6909650946],[1.4837605E-4,3.14159265359,0]]],[[[.02268615702,3.55852606721,529.6909650946],[.00109971634,3.90809347197,
1059.3819301892],[.00110090358,0,0],[8.101428E-5,3.60509572885,522.5774180938],[6.043996E-5,4.25883108339,1589.0728952838],[6.437782E-5,.30627119215,536.8045120954]],[[7.8203446E-4,1.52377859742,529.6909650946]]],[[[5.20887429326,0,0],[.25209327119,3.49108639871,529.6909650946],[.00610599976,3.84115365948,1059.3819301892],[.00282029458,2.57419881293,632.7837393132],[.00187647346,2.07590383214,522.5774180938],[8.6792905E-4,.71001145545,419.4846438752],[7.2062974E-4,.21465724607,536.8045120954],[6.5517248E-4,
5.9799588479,316.3918696566],[2.9134542E-4,1.67759379655,103.0927742186],[3.0135335E-4,2.16132003734,949.1756089698],[2.3453271E-4,3.54023522184,735.8765135318],[2.2283743E-4,4.19362594399,1589.0728952838],[2.3947298E-4,.2745803748,7.1135470008],[1.3032614E-4,2.96042965363,1162.4747044078],[9.70336E-5,1.90669633585,206.1855484372],[1.2749023E-4,2.71550286592,1052.2683831884],[7.057931E-5,2.18184839926,1265.5674786264],[6.137703E-5,6.26418240033,846.0828347512],[2.616976E-5,2.00994012876,1581.959348283]],
[[.0127180152,2.64937512894,529.6909650946],[6.1661816E-4,3.00076460387,1059.3819301892],[5.3443713E-4,3.89717383175,522.5774180938],[3.1185171E-4,4.88276958012,536.8045120954],[4.1390269E-4,0,0]]]],Saturn:[[[[.87401354025,0,0],[.11107659762,3.96205090159,213.299095438],[.01414150957,4.58581516874,7.1135470008],[.00398379389,.52112032699,206.1855484372],[.00350769243,3.30329907896,426.598190876],[.00206816305,.24658372002,103.0927742186],[7.92713E-4,3.84007056878,220.4126424388],[2.3990355E-4,4.66976924553,
110.2063212194],[1.6573588E-4,.43719228296,419.4846438752],[1.4906995E-4,5.76903183869,316.3918696566],[1.582029E-4,.93809155235,632.7837393132],[1.4609559E-4,1.56518472,3.9321532631],[1.3160301E-4,4.44891291899,14.2270940016],[1.5053543E-4,2.71669915667,639.897286314],[1.3005299E-4,5.98119023644,11.0457002639],[1.0725067E-4,3.12939523827,202.2533951741],[5.863206E-5,.23656938524,529.6909650946],[5.227757E-5,4.20783365759,3.1813937377],[6.126317E-5,1.76328667907,277.0349937414],[5.019687E-5,3.17787728405,
433.7117378768],[4.59255E-5,.61977744975,199.0720014364],[4.005867E-5,2.24479718502,63.7358983034],[2.953796E-5,.98280366998,95.9792272178],[3.87367E-5,3.22283226966,138.5174968707],[2.461186E-5,2.03163875071,735.8765135318],[3.269484E-5,.77492638211,949.1756089698],[1.758145E-5,3.2658010994,522.5774180938],[1.640172E-5,5.5050445305,846.0828347512],[1.391327E-5,4.02333150505,323.5054166574],[1.580648E-5,4.37265307169,309.2783226558],[1.123498E-5,2.83726798446,415.5524906121],[1.017275E-5,3.71700135395,
227.5261894396],[8.48642E-6,3.1915017083,209.3669421749]],[[213.2990952169,0,0],[.01297370862,1.82834923978,213.299095438],[.00564345393,2.88499717272,7.1135470008],[9.3734369E-4,1.06311793502,426.598190876],[.00107674962,2.27769131009,206.1855484372],[4.0244455E-4,2.04108104671,220.4126424388],[1.9941774E-4,1.2795439047,103.0927742186],[1.0511678E-4,2.7488034213,14.2270940016],[6.416106E-5,.38238295041,639.897286314],[4.848994E-5,2.43037610229,419.4846438752],[4.056892E-5,2.92133209468,110.2063212194],
[3.768635E-5,3.6496533078,3.9321532631]],[[.0011644133,1.17988132879,7.1135470008],[9.1841837E-4,.0732519584,213.299095438],[3.6661728E-4,0,0],[1.5274496E-4,4.06493179167,206.1855484372]]],[[[.04330678039,3.60284428399,213.299095438],[.00240348302,2.85238489373,426.598190876],[8.4745939E-4,0,0],[3.0863357E-4,3.48441504555,220.4126424388],[3.4116062E-4,.57297307557,206.1855484372],[1.473407E-4,2.11846596715,639.897286314],[9.916667E-5,5.79003188904,419.4846438752],[6.993564E-5,4.7360468972,7.1135470008],
[4.807588E-5,5.43305312061,316.3918696566]],[[.00198927992,4.93901017903,213.299095438],[3.6947916E-4,3.14159265359,0],[1.7966989E-4,.5197943111,426.598190876]]],[[[9.55758135486,0,0],[.52921382865,2.39226219573,213.299095438],[.01873679867,5.2354960466,206.1855484372],[.01464663929,1.64763042902,426.598190876],[.00821891141,5.93520042303,316.3918696566],[.00547506923,5.0153261898,103.0927742186],[.0037168465,2.27114821115,220.4126424388],[.00361778765,3.13904301847,7.1135470008],[.00140617506,5.70406606781,
632.7837393132],[.00108974848,3.29313390175,110.2063212194],[6.9006962E-4,5.94099540992,419.4846438752],[6.1053367E-4,.94037691801,639.897286314],[4.8913294E-4,1.55733638681,202.2533951741],[3.4143772E-4,.19519102597,277.0349937414],[3.2401773E-4,5.47084567016,949.1756089698],[2.0936596E-4,.46349251129,735.8765135318],[9.796004E-5,5.20477537945,1265.5674786264],[1.1993338E-4,5.98050967385,846.0828347512],[2.08393E-4,1.52102476129,433.7117378768],[1.5298404E-4,3.0594381494,529.6909650946],[6.465823E-5,
.17732249942,1052.2683831884],[1.1380257E-4,1.7310542704,522.5774180938],[3.419618E-5,4.94550542171,1581.959348283]],[[.0618298134,.2584351148,213.299095438],[.00506577242,.71114625261,206.1855484372],[.00341394029,5.79635741658,426.598190876],[.00188491195,.47215589652,220.4126424388],[.00186261486,3.14159265359,0],[.00143891146,1.40744822888,7.1135470008]],[[.00436902572,4.78671677509,213.299095438]]]],Uranus:[[[[5.48129294297,0,0],[.09260408234,.89106421507,74.7815985673],[.01504247898,3.6271926092,
1.4844727083],[.00365981674,1.89962179044,73.297125859],[.00272328168,3.35823706307,149.5631971346],[7.0328461E-4,5.39254450063,63.7358983034],[6.8892678E-4,6.09292483287,76.2660712756],[6.1998615E-4,2.26952066061,2.9689454166],[6.1950719E-4,2.85098872691,11.0457002639],[2.646877E-4,3.14152083966,71.8126531507],[2.5710476E-4,6.11379840493,454.9093665273],[2.107885E-4,4.36059339067,148.0787244263],[1.7818647E-4,1.74436930289,36.6485629295],[1.4613507E-4,4.73732166022,3.9321532631],[1.1162509E-4,5.8268179635,
224.3447957019],[1.099791E-4,.48865004018,138.5174968707],[9.527478E-5,2.95516862826,35.1640902212],[7.545601E-5,5.236265824,109.9456887885],[4.220241E-5,3.23328220918,70.8494453042],[4.0519E-5,2.277550173,151.0476698429],[3.354596E-5,1.0654900738,4.4534181249],[2.926718E-5,4.62903718891,9.5612275556],[3.49034E-5,5.48306144511,146.594251718],[3.144069E-5,4.75199570434,77.7505439839],[2.922333E-5,5.35235361027,85.8272988312],[2.272788E-5,4.36600400036,70.3281804424],[2.051219E-5,1.51773566586,.1118745846],
[2.148602E-5,.60745949945,38.1330356378],[1.991643E-5,4.92437588682,277.0349937414],[1.376226E-5,2.04283539351,65.2203710117],[1.666902E-5,3.62744066769,380.12776796],[1.284107E-5,3.11347961505,202.2533951741],[1.150429E-5,.93343589092,3.1813937377],[1.533221E-5,2.58594681212,52.6901980395],[1.281604E-5,.54271272721,222.8603229936],[1.372139E-5,4.19641530878,111.4301614968],[1.221029E-5,.1990065003,108.4612160802],[9.46181E-6,1.19253165736,127.4717966068],[1.150989E-5,4.17898916639,33.6796175129]],
[[74.7815986091,0,0],[.00154332863,5.24158770553,74.7815985673],[2.4456474E-4,1.71260334156,1.4844727083],[9.258442E-5,.4282973235,11.0457002639],[8.265977E-5,1.50218091379,63.7358983034],[9.15016E-5,1.41213765216,149.5631971346]]],[[[.01346277648,2.61877810547,74.7815985673],[6.23414E-4,5.08111189648,149.5631971346],[6.1601196E-4,3.14159265359,0],[9.963722E-5,1.61603805646,76.2660712756],[9.92616E-5,.57630380333,73.297125859]],[[3.4101978E-4,.01321929936,74.7815985673]]],[[[19.21264847206,0,0],[.88784984413,
5.60377527014,74.7815985673],[.03440836062,.32836099706,73.297125859],[.0205565386,1.7829515933,149.5631971346],[.0064932241,4.52247285911,76.2660712756],[.00602247865,3.86003823674,63.7358983034],[.00496404167,1.40139935333,454.9093665273],[.00338525369,1.58002770318,138.5174968707],[.00243509114,1.57086606044,71.8126531507],[.00190522303,1.99809394714,1.4844727083],[.00161858838,2.79137786799,148.0787244263],[.00143706183,1.38368544947,11.0457002639],[9.3192405E-4,.17437220467,36.6485629295],[7.1424548E-4,
4.24509236074,224.3447957019],[8.9806014E-4,3.66105364565,109.9456887885],[3.9009723E-4,1.66971401684,70.8494453042],[4.6677296E-4,1.39976401694,35.1640902212],[3.9025624E-4,3.36234773834,277.0349937414],[3.6755274E-4,3.88649278513,146.594251718],[3.0348723E-4,.70100838798,151.0476698429],[2.9156413E-4,3.180563367,77.7505439839],[2.2637073E-4,.72518687029,529.6909650946],[1.1959076E-4,1.7504339214,984.6003316219],[2.5620756E-4,5.25656086672,380.12776796]],[[.01479896629,3.67205697578,74.7815985673]]]],
Neptune:[[[[5.31188633046,0,0],[.0179847553,2.9010127389,38.1330356378],[.01019727652,.48580922867,1.4844727083],[.00124531845,4.83008090676,36.6485629295],[4.2064466E-4,5.41054993053,2.9689454166],[3.7714584E-4,6.09221808686,35.1640902212],[3.3784738E-4,1.24488874087,76.2660712756],[1.6482741E-4,7.727998E-5,491.5579294568],[9.198584E-5,4.93747051954,39.6175083461],[8.99425E-5,.27462171806,175.1660598002]],[[38.13303563957,0,0],[1.6604172E-4,4.86323329249,1.4844727083],[1.5744045E-4,2.27887427527,
38.1330356378]]],[[[.03088622933,1.44104372644,38.1330356378],[2.7780087E-4,5.91271884599,76.2660712756],[2.7623609E-4,0,0],[1.5355489E-4,2.52123799551,36.6485629295],[1.5448133E-4,3.50877079215,39.6175083461]]],[[[30.07013205828,0,0],[.27062259632,1.32999459377,38.1330356378],[.01691764014,3.25186135653,36.6485629295],[.00807830553,5.18592878704,1.4844727083],[.0053776051,4.52113935896,35.1640902212],[.00495725141,1.5710564165,491.5579294568],[.00274571975,1.84552258866,175.1660598002],[1.201232E-4,
1.92059384991,1021.2488945514],[.00121801746,5.79754470298,76.2660712756],[.00100896068,.3770272493,73.297125859],[.00135134092,3.37220609835,39.6175083461],[7.571796E-5,1.07149207335,388.4651552382]]]]};
function DeltaT_EspenakMeeus(a){var b=2E3+(a-14)/DAYS_PER_TROPICAL_YEAR;if(-500>b)return a=(b-1820)/100,-20+32*a*a;if(500>b){a=b/100;b=a*a;var c=a*b;return 10583.6-1014.41*a+33.78311*b-5.952053*c-.1798452*b*b+.022174192*b*c+.0090316521*c*c}if(1600>b)return a=(b-1E3)/100,b=a*a,c=a*b,1574.2-556.01*a+71.23472*b+.319781*c-.8503463*b*b-.005050998*b*c+.0083572073*c*c;if(1700>b)return a=b-1600,b=a*a,120-.9808*a-.01532*b+a*b/7129;if(1800>b)return a=b-1700,b=a*a,8.83+.1603*a-.0059285*b+1.3336E-4*a*b-b*b/1174E3;
if(1860>b){a=b-1800;b=a*a;c=a*b;var d=b*b;return 13.72-.332447*a+.0068612*b+.0041116*c-3.7436E-4*d+1.21272E-5*b*c-1.699E-7*c*c+8.75E-10*c*d}if(1900>b)return a=b-1860,b=a*a,c=a*b,7.62+.5737*a-.251754*b+.01680668*c-4.473624E-4*b*b+b*c/233174;if(1920>b)return a=b-1900,b=a*a,-2.79+1.494119*a-.0598939*b+.0061966*a*b-1.97E-4*b*b;if(1941>b)return a=b-1920,b=a*a,21.2+.84493*a-.0761*b+.0020936*a*b;if(1961>b)return a=b-1950,b=a*a,29.07+.407*a-b/233+a*b/2547;if(1986>b)return a=b-1975,b=a*a,45.45+1.067*a-b/260-
a*b/718;if(2005>b)return a=b-2E3,b=a*a,c=a*b,63.86+.3345*a-.060374*b+.0017275*c+6.51814E-4*b*b+2.373599E-5*b*c;if(2050>b)return a=b-2E3,62.92+.32217*a+.005589*a*a;if(2150>b)return a=(b-1820)/100,-20+32*a*a-.5628*(2150-b);a=(b-1820)/100;return-20+32*a*a}exports.DeltaT_EspenakMeeus=DeltaT_EspenakMeeus;function DeltaT_JplHorizons(a){return DeltaT_EspenakMeeus(Math.min(a,17*DAYS_PER_TROPICAL_YEAR))}exports.DeltaT_JplHorizons=DeltaT_JplHorizons;var DeltaT=DeltaT_EspenakMeeus;
function SetDeltaTFunction(a){DeltaT=a}exports.SetDeltaTFunction=SetDeltaTFunction;function TerrestrialTime(a){return a+DeltaT(a)/86400}
var AstroTime=function(a){if(a instanceof AstroTime)this.date=a.date,this.ut=a.ut,this.tt=a.tt;else if(a instanceof Date&&Number.isFinite(a.getTime()))this.date=a,this.ut=(a.getTime()-J2000.getTime())/864E5,this.tt=TerrestrialTime(this.ut);else if(Number.isFinite(a))this.date=new Date(J2000.getTime()+864E5*a),this.ut=a,this.tt=TerrestrialTime(this.ut);else throw"Argument must be a Date object, an AstroTime object, or a numeric UTC Julian date.";};
AstroTime.FromTerrestrialTime=function(a){for(var b=new AstroTime(a);;){var c=a-b.tt;if(1E-12>Math.abs(c))return b;b=b.AddDays(c)}};AstroTime.prototype.toString=function(){return this.date.toISOString()};AstroTime.prototype.AddDays=function(a){return new AstroTime(this.ut+a)};exports.AstroTime=AstroTime;function InterpolateTime(a,b,c){return new AstroTime(a.ut+c*(b.ut-a.ut))}function MakeTime(a){return a instanceof AstroTime?a:new AstroTime(a)}exports.MakeTime=MakeTime;
function iau2000b(a){a=a.tt/36525;var b=(1287104.79305+1.295965810481E8*a)%ASEC360*ASEC2RAD,c=(335779.526232+1.7395272628478E9*a)%ASEC360*ASEC2RAD,d=(450160.398036-6962890.5431*a)%ASEC360*ASEC2RAD,e=Math.sin(d),f=Math.cos(d),g=(-172064161-174666*a)*e+33386*f,k=(92052331+9086*a)*f+15377*e;f=2*(c-(1072260.70369+1.602961601209E9*a)%ASEC360*ASEC2RAD+d);e=Math.sin(f);f=Math.cos(f);g+=(-13170906-1675*a)*e-13696*f;k+=(5730336-3015*a)*f-4587*e;f=2*(c+d);e=Math.sin(f);f=Math.cos(f);g+=(-2276413-234*a)*e+2796*
f;k+=(978459-485*a)*f+1374*e;f=2*d;e=Math.sin(f);f=Math.cos(f);g+=(2074554+207*a)*e-698*f;k+=(-897492+470*a)*f-291*e;e=Math.sin(b);f=Math.cos(b);return{dpsi:-1.35E-4+1E-7*(g+((1475877-3633*a)*e+11817*f)),deps:3.88E-4+1E-7*(k+((73871-184*a)*f-1924*e))}}function mean_obliq(a){a=a.tt/36525;return(((((-4.34E-8*a-5.76E-7)*a+.0020034)*a-1.831E-4)*a-46.836769)*a+84381.406)/3600}var cache_e_tilt;
function e_tilt(a){if(!cache_e_tilt||1E-6<Math.abs(cache_e_tilt.tt-a.tt)){var b=iau2000b(a),c=mean_obliq(a);cache_e_tilt={tt:a.tt,dpsi:b.dpsi,deps:b.deps,ee:b.dpsi*Math.cos(c*exports.DEG2RAD)/15,mobl:c,tobl:c+b.deps/3600}}return cache_e_tilt}exports.e_tilt=e_tilt;function obl_ecl2equ_vec(a,b){var c=a*exports.DEG2RAD;a=Math.cos(c);c=Math.sin(c);return[b[0],b[1]*a-b[2]*c,b[1]*c+b[2]*a]}function ecl2equ_vec(a,b){return obl_ecl2equ_vec(mean_obliq(a),b)}exports.CalcMoonCount=0;
function CalcMoon(a){function b(u,v,x,A){for(var w=[],D=0;D<=v-u;++D){var E=w,L=E.push,M,O=x,Q=A,P=[];for(M=0;M<=Q-O;++M)P.push(0);L.call(E,{min:O,array:P})}return{min:u,array:w}}function c(u,v,x){u=u.array[v-u.min];return u.array[x-u.min]}function d(u,v,x){u=r.array[u-r.min];u.array[v-u.min]=x}function e(u,v,x){u=q.array[u-q.min];u.array[v-u.min]=x}function f(u,v,x,A,w){w(u*x-v*A,v*x+u*A)}function g(u){return Math.sin(PI2*u)}function k(u,v,x,A){var w={x:1,y:0};u=[0,u,v,x,A];for(v=1;4>=v;++v)0!==
u[v]&&f(w.x,w.y,c(r,u[v],v),c(q,u[v],v),function(D,E){return w.x=D,w.y=E});return w}function h(u,v,x,A,w,D,E,L){w=k(w,D,E,L);n+=u*w.y;p+=v*w.y;H+=x*w.x;F+=A*w.x}++exports.CalcMoonCount;a=a.tt/36525;var l,m,n,p,r=b(-6,6,1,4),q=b(-6,6,1,4);var t=a*a;var H=p=n=0;var F=3422.7;var C=g(.19833+.05611*a);var B=g(.27869+.04508*a);var y=g(.16827-.36903*a);var z=g(.34734-5.37261*a);var G=g(.10498-5.37899*a);var I=g(.42681-.41855*a),R=g(.14943-5.37511*a);var J=.84*C+.31*B+14.27*y+7.26*z+.28*G+.24*I;var N=2.94*
C+.31*B+14.27*y+9.34*z+1.12*G+.83*I;var K=-6.4*C-1.89*I;B=.21*C+.31*B+14.27*y-88.7*z-15.3*G+.24*I-1.86*R;y=J-K;C=-3.332E-6*g(.59734-5.37261*a)-5.39E-7*g(.35498-5.37899*a)-6.4E-8*g(.39943-5.37511*a);J=PI2*Frac(.60643382+1336.85522467*a-3.13E-6*t)+J/ARC;N=PI2*Frac(.37489701+1325.55240982*a+2.565E-5*t)+N/ARC;K=PI2*Frac(.99312619+99.99735956*a-4.4E-7*t)+K/ARC;B=PI2*Frac(.25909118+1342.2278298*a-8.92E-6*t)+B/ARC;G=PI2*Frac(.82736186+1236.85308708*a-3.97E-6*t)+y/ARC;for(l=1;4>=l;++l){switch(l){case 1:y=
N;t=4;z=1.000002208;break;case 2:y=K;t=3;z=.997504612-.002495388*a;break;case 3:y=B;t=4;z=1.000002708+139.978*C;break;case 4:y=G;t=6;z=1;break;default:throw"Internal error: I = "+l;}d(0,l,1);d(1,l,Math.cos(y)*z);e(0,l,0);e(1,l,Math.sin(y)*z);for(m=2;m<=t;++m)f(c(r,m-1,l),c(q,m-1,l),c(r,1,l),c(q,1,l),function(u,v){return d(m,l,u),e(m,l,v)});for(m=1;m<=t;++m)d(-m,l,c(r,m,l)),e(-m,l,-c(q,m,l))}h(13.902,14.06,-.001,.2607,0,0,0,4);h(.403,-4.01,.394,.0023,0,0,0,3);h(2369.912,2373.36,.601,28.2333,0,0,0,
2);h(-125.154,-112.79,-.725,-.9781,0,0,0,1);h(1.979,6.98,-.445,.0433,1,0,0,4);h(191.953,192.72,.029,3.0861,1,0,0,2);h(-8.466,-13.51,.455,-.1093,1,0,0,1);h(22639.5,22609.07,.079,186.5398,1,0,0,0);h(18.609,3.59,-.094,.0118,1,0,0,-1);h(-4586.465,-4578.13,-.077,34.3117,1,0,0,-2);h(3.215,5.44,.192,-.0386,1,0,0,-3);h(-38.428,-38.64,.001,.6008,1,0,0,-4);h(-.393,-1.43,-.092,.0086,1,0,0,-6);h(-.289,-1.59,.123,-.0053,0,1,0,4);h(-24.42,-25.1,.04,-.3,0,1,0,2);h(18.023,17.93,.007,.1494,0,1,0,1);h(-668.146,-126.98,
-1.302,-.3997,0,1,0,0);h(.56,.32,-.001,-.0037,0,1,0,-1);h(-165.145,-165.06,.054,1.9178,0,1,0,-2);h(-1.877,-6.46,-.416,.0339,0,1,0,-4);h(.213,1.02,-.074,.0054,2,0,0,4);h(14.387,14.78,-.017,.2833,2,0,0,2);h(-.586,-1.2,.054,-.01,2,0,0,1);h(769.016,767.96,.107,10.1657,2,0,0,0);h(1.75,2.01,-.018,.0155,2,0,0,-1);h(-211.656,-152.53,5.679,-.3039,2,0,0,-2);h(1.225,.91,-.03,-.0088,2,0,0,-3);h(-30.773,-34.07,-.308,.3722,2,0,0,-4);h(-.57,-1.4,-.074,.0109,2,0,0,-6);h(-2.921,-11.75,.787,-.0484,1,1,0,2);h(1.267,
1.52,-.022,.0164,1,1,0,1);h(-109.673,-115.18,.461,-.949,1,1,0,0);h(-205.962,-182.36,2.056,1.4437,1,1,0,-2);h(.233,.36,.012,-.0025,1,1,0,-3);h(-4.391,-9.66,-.471,.0673,1,1,0,-4);h(.283,1.53,-.111,.006,1,-1,0,4);h(14.577,31.7,-1.54,.2302,1,-1,0,2);h(147.687,138.76,.679,1.1528,1,-1,0,0);h(-1.089,.55,.021,0,1,-1,0,-1);h(28.475,23.59,-.443,-.2257,1,-1,0,-2);h(-.276,-.38,-.006,-.0036,1,-1,0,-3);h(.636,2.27,.146,-.0102,1,-1,0,-4);h(-.189,-1.68,.131,-.0028,0,2,0,2);h(-7.486,-.66,-.037,-.0086,0,2,0,0);h(-8.096,
-16.35,-.74,.0918,0,2,0,-2);h(-5.741,-.04,0,-9E-4,0,0,2,2);h(.255,0,0,0,0,0,2,1);h(-411.608,-.2,0,-.0124,0,0,2,0);h(.584,.84,0,.0071,0,0,2,-1);h(-55.173,-52.14,0,-.1052,0,0,2,-2);h(.254,.25,0,-.0017,0,0,2,-3);h(.025,-1.67,0,.0031,0,0,2,-4);h(1.06,2.96,-.166,.0243,3,0,0,2);h(36.124,50.64,-1.3,.6215,3,0,0,0);h(-13.193,-16.4,.258,-.1187,3,0,0,-2);h(-1.187,-.74,.042,.0074,3,0,0,-4);h(-.293,-.31,-.002,.0046,3,0,0,-6);h(-.29,-1.45,.116,-.0051,2,1,0,2);h(-7.649,-10.56,.259,-.1038,2,1,0,0);h(-8.627,-7.59,
.078,-.0192,2,1,0,-2);h(-2.74,-2.54,.022,.0324,2,1,0,-4);h(1.181,3.32,-.212,.0213,2,-1,0,2);h(9.703,11.67,-.151,.1268,2,-1,0,0);h(-.352,-.37,.001,-.0028,2,-1,0,-1);h(-2.494,-1.17,-.003,-.0017,2,-1,0,-2);h(.36,.2,-.012,-.0043,2,-1,0,-4);h(-1.167,-1.25,.008,-.0106,1,2,0,0);h(-7.412,-6.12,.117,.0484,1,2,0,-2);h(-.311,-.65,-.032,.0044,1,2,0,-4);h(.757,1.82,-.105,.0112,1,-2,0,2);h(2.58,2.32,.027,.0196,1,-2,0,0);h(2.533,2.4,-.014,-.0212,1,-2,0,-2);h(-.344,-.57,-.025,.0036,0,3,0,-2);h(-.992,-.02,0,0,1,0,
2,2);h(-45.099,-.02,0,-.001,1,0,2,0);h(-.179,-9.52,0,-.0833,1,0,2,-2);h(-.301,-.33,0,.0014,1,0,2,-4);h(-6.382,-3.37,0,-.0481,1,0,-2,2);h(39.528,85.13,0,-.7136,1,0,-2,0);h(9.366,.71,0,-.0112,1,0,-2,-2);h(.202,.02,0,0,1,0,-2,-4);h(.415,.1,0,.0013,0,1,2,0);h(-2.152,-2.26,0,-.0066,0,1,2,-2);h(-1.44,-1.3,0,.0014,0,1,-2,2);h(.384,-.04,0,0,0,1,-2,-2);h(1.938,3.6,-.145,.0401,4,0,0,0);h(-.952,-1.58,.052,-.013,4,0,0,-2);h(-.551,-.94,.032,-.0097,3,1,0,0);h(-.482,-.57,.005,-.0045,3,1,0,-2);h(.681,.96,-.026,.0115,
3,-1,0,0);h(-.297,-.27,.002,-9E-4,2,2,0,-2);h(.254,.21,-.003,0,2,-2,0,-2);h(-.25,-.22,.004,.0014,1,3,0,-2);h(-3.996,0,0,4E-4,2,0,2,0);h(.557,-.75,0,-.009,2,0,2,-2);h(-.459,-.38,0,-.0053,2,0,-2,2);h(-1.298,.74,0,4E-4,2,0,-2,0);h(.538,1.14,0,-.0141,2,0,-2,-2);h(.263,.02,0,0,1,1,2,0);h(.426,.07,0,-6E-4,1,1,-2,-2);h(-.304,.03,0,3E-4,1,-1,2,0);h(-.372,-.19,0,-.0027,1,-1,-2,2);h(.418,0,0,0,0,0,4,0);h(-.33,-.04,0,0,3,0,2,0);t=-526.069*k(0,0,1,-2).y;t+=-3.352*k(0,0,1,-4).y;t+=44.297*k(1,0,1,-2).y;t+=-6*k(1,
0,1,-4).y;t+=20.599*k(-1,0,1,0).y;t+=-30.598*k(-1,0,1,-2).y;t+=-24.649*k(-2,0,1,0).y;t+=-2*k(-2,0,1,-2).y;t+=-22.571*k(0,1,1,-2).y;t+=10.985*k(0,-1,1,-2).y;n+=.82*g(.7736-62.5512*a)+.31*g(.0466-125.1025*a)+.35*g(.5785-25.1042*a)+.66*g(.4591+1335.8075*a)+.64*g(.313-91.568*a)+1.14*g(.148+1331.2898*a)+.21*g(.5918+1056.5859*a)+.44*g(.5784+1322.8595*a)+.24*g(.2275-5.7374*a)+.28*g(.2965+2.6929*a)+.33*g(.3132+6.3368*a);a=B+p/ARC;a=(1.000002708+139.978*C)*(18518.511+1.189+H)*Math.sin(a)-6.24*Math.sin(3*a)+
t;return{geo_eclip_lon:PI2*Frac((J+n/ARC)/PI2),geo_eclip_lat:Math.PI/648E3*a,distance_au:ARC*EARTH_EQUATORIAL_RADIUS_AU/(.999953253*F)}}var LibrationInfo=function(a,b,c,d,e,f){this.elat=a;this.elon=b;this.mlat=c;this.mlon=d;this.dist_km=e;this.diam_deg=f};exports.LibrationInfo=LibrationInfo;
function Libration(a){var b=MakeTime(a);a=b.tt/36525;var c=a*a,d=c*a,e=c*c,f=CalcMoon(b);b=f.geo_eclip_lon;var g=f.geo_eclip_lat;f=f.distance_au*exports.KM_PER_AU;var k=1.543*exports.DEG2RAD,h=exports.DEG2RAD*NormalizeLongitude(93.272095+483202.0175233*a-.0036539*c-d/3526E3+e/86331E4),l=exports.DEG2RAD*NormalizeLongitude(125.0445479-1934.1362891*a+.0020754*c+d/467441-e/60616E3),m=exports.DEG2RAD*NormalizeLongitude(357.5291092+35999.0502909*a-1.536E-4*c+d/2449E4),n=exports.DEG2RAD*NormalizeLongitude(134.9633964+
477198.8675055*a+.0087414*c+d/69699-e/14712E3);d=exports.DEG2RAD*NormalizeLongitude(297.8501921+445267.1114034*a-.0018819*c+d/545868-e/113065E3);c=1-.002516*a-7.4E-6*c;var p=b-l;e=Math.atan2(Math.sin(p)*Math.cos(g)*Math.cos(k)-Math.sin(g)*Math.sin(k),Math.cos(p)*Math.cos(g));var r=LongitudeOffset(exports.RAD2DEG*(e-h));k=Math.asin(-Math.sin(p)*Math.cos(g)*Math.sin(k)-Math.sin(g)*Math.cos(k));p=-.02752*Math.cos(n)+-.02245*Math.sin(h)+.00684*Math.cos(n-2*h)+-.00293*Math.cos(2*h)+-8.5E-4*Math.cos(2*
h-2*d)+-5.4E-4*Math.cos(n-2*d)+-2E-4*Math.sin(n+h)+-2E-4*Math.cos(n+2*h)+-2E-4*Math.cos(n-h)+1.4E-4*Math.cos(n+2*h-2*d);var q=-.02816*Math.sin(n)+.02244*Math.cos(h)+-.00682*Math.sin(n-2*h)+-.00279*Math.sin(2*h)+-8.3E-4*Math.sin(2*h-2*d)+6.9E-4*Math.sin(n-2*d)+4E-4*Math.cos(n+h)+-2.5E-4*Math.sin(2*n)+-2.3E-4*Math.sin(n+2*h)+2E-4*Math.cos(n-h)+1.9E-4*Math.sin(n-h)+1.3E-4*Math.sin(n+2*h-2*d)+-1E-4*Math.cos(n-3*h);return new LibrationInfo(exports.RAD2DEG*k+(q*Math.cos(e)-p*Math.sin(e)),r+(-(.0252*c*Math.sin(m)+
.00473*Math.sin(2*n-2*h)+-.00467*Math.sin(n)+.00396*Math.sin(exports.DEG2RAD*(119.75+131.849*a))+.00276*Math.sin(2*n-2*d)+.00196*Math.sin(l)+-.00183*Math.cos(n-h)+.00115*Math.sin(n-2*d)+-9.6E-4*Math.sin(n-d)+4.6E-4*Math.sin(2*h-2*d)+-3.9E-4*Math.sin(n-h)+-3.2E-4*Math.sin(n-m-d)+2.7E-4*Math.sin(2*n-m-2*d)+2.3E-4*Math.sin(exports.DEG2RAD*(72.56+20.186*a))+-1.4E-4*Math.sin(2*d)+1.4E-4*Math.cos(2*n-2*h)+-1.2E-4*Math.sin(n-2*h)+-1.2E-4*Math.sin(2*n)+1.1E-4*Math.sin(2*n-2*m-2*d))+(p*Math.cos(e)+q*Math.sin(e))*
Math.tan(k)),exports.RAD2DEG*g,exports.RAD2DEG*b,f,2*exports.RAD2DEG*Math.atan(MOON_MEAN_RADIUS_KM/Math.sqrt(f*f-MOON_MEAN_RADIUS_KM*MOON_MEAN_RADIUS_KM)))}exports.Libration=Libration;function rotate(a,b){return[a.rot[0][0]*b[0]+a.rot[1][0]*b[1]+a.rot[2][0]*b[2],a.rot[0][1]*b[0]+a.rot[1][1]*b[1]+a.rot[2][1]*b[2],a.rot[0][2]*b[0]+a.rot[1][2]*b[1]+a.rot[2][2]*b[2]]}function precession(a,b,c){b=precession_rot(b,c);return rotate(b,a)}
function precession_posvel(a,b,c){b=precession_rot(b,c);return RotateState(b,a)}
function precession_rot(a,b){a=a.tt/36525;var c=84381.406,d=((((3.337E-7*a-4.67E-7)*a-.00772503)*a+.0512623)*a-.025754)*a+c;c*=ASEC2RAD;var e=((((-9.51E-8*a+1.32851E-4)*a-.00114045)*a-1.0790069)*a+5038.481507)*a*ASEC2RAD;d*=ASEC2RAD;var f=((((-5.6E-8*a+1.70663E-4)*a-.00121197)*a-2.3814292)*a+10.556403)*a*ASEC2RAD;a=Math.sin(c);c=Math.cos(c);var g=Math.sin(-e);e=Math.cos(-e);var k=Math.sin(-d);d=Math.cos(-d);var h=Math.sin(f),l=Math.cos(f);f=l*e-g*h*d;var m=l*g*c+h*d*e*c-a*h*k,n=l*g*a+h*d*e*a+c*h*
k,p=-h*e-g*l*d,r=-h*g*c+l*d*e*c-a*l*k;h=-h*g*a+l*d*e*a+c*l*k;g*=k;l=-k*e*c-a*d;a=-k*e*a+d*c;if(b===PrecessDirection.Into2000)return new RotationMatrix([[f,m,n],[p,r,h],[g,l,a]]);if(b===PrecessDirection.From2000)return new RotationMatrix([[f,p,g],[m,r,l],[n,h,a]]);throw"Invalid precess direction";}function era(a){a=(.779057273264+.00273781191135448*a.ut+a.ut%1)%1*360;0>a&&(a+=360);return a}var sidereal_time_cache;
function sidereal_time(a){if(!sidereal_time_cache||sidereal_time_cache.tt!==a.tt){var b=a.tt/36525,c=15*e_tilt(a).ee,d=era(a);b=((c+.014506+((((-3.68E-8*b-2.9956E-5)*b-4.4E-7)*b+1.3915817)*b+4612.156534)*b)/3600+d)%360/15;0>b&&(b+=24);sidereal_time_cache={tt:a.tt,st:b}}return sidereal_time_cache.st}function SiderealTime(a){a=MakeTime(a);return sidereal_time(a)}exports.SiderealTime=SiderealTime;
function inverse_terra(a,b){var c=a[0]*exports.KM_PER_AU,d=a[1]*exports.KM_PER_AU;a=a[2]*exports.KM_PER_AU;var e=Math.hypot(c,d);if(1E-6>e){b=0;var f=0<a?90:-90;a=Math.abs(a)-EARTH_POLAR_RADIUS_KM}else{for(b=exports.RAD2DEG*Math.atan2(d,c)-15*b;-180>=b;)b+=360;for(;180<b;)b-=360;f=Math.atan2(a,e);for(var g,k=0;;){if(10<++k)throw"inverse_terra failed to converge.";c=Math.cos(f);d=Math.sin(f);var h=(EARTH_FLATTENING_SQUARED-1)*EARTH_EQUATORIAL_RADIUS_KM,l=c*c,m=d*d,n=l+EARTH_FLATTENING_SQUARED*m;g=
Math.sqrt(n);var p=h*d*c/g-a*c+e*d;if(1E-8>Math.abs(p))break;f-=p/(h*((l-m)/g-m*l*(EARTH_FLATTENING_SQUARED-1)/(h*n))+a*d+e*c)}f*=exports.RAD2DEG;g=EARTH_EQUATORIAL_RADIUS_KM/g;a=Math.abs(d)>Math.abs(c)?a/d-EARTH_FLATTENING_SQUARED*g:e/c-g}return new Observer(f,b,1E3*a)}
function terra(a,b){var c=a.latitude*exports.DEG2RAD,d=Math.sin(c);c=Math.cos(c);var e=1/Math.hypot(c,EARTH_FLATTENING*d),f=a.height/1E3,g=EARTH_EQUATORIAL_RADIUS_KM*e+f;b=(15*b+a.longitude)*exports.DEG2RAD;a=Math.sin(b);b=Math.cos(b);return{pos:[g*c*b/exports.KM_PER_AU,g*c*a/exports.KM_PER_AU,(EARTH_EQUATORIAL_RADIUS_KM*EARTH_FLATTENING_SQUARED*e+f)*d/exports.KM_PER_AU],vel:[-ANGVEL*g*c*a*86400/exports.KM_PER_AU,ANGVEL*g*c*b*86400/exports.KM_PER_AU,0]}}
function nutation(a,b,c){b=nutation_rot(b,c);return rotate(b,a)}function nutation_posvel(a,b,c){b=nutation_rot(b,c);return RotateState(b,a)}
function nutation_rot(a,b){a=e_tilt(a);var c=a.mobl*exports.DEG2RAD,d=a.tobl*exports.DEG2RAD,e=a.dpsi*ASEC2RAD;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(d),g=Math.sin(d);d=Math.cos(e);var k=Math.sin(e);e=-k*a;var h=-k*c,l=k*f,m=d*a*f+c*g,n=d*c*f-a*g;k*=g;var p=d*a*g-c*f;a=d*c*g+a*f;if(b===PrecessDirection.From2000)return new RotationMatrix([[d,l,k],[e,m,p],[h,n,a]]);if(b===PrecessDirection.Into2000)return new RotationMatrix([[d,e,h],[l,m,n],[k,p,a]]);throw"Invalid precess direction";}
function gyration(a,b,c){return c===PrecessDirection.Into2000?precession(nutation(a,b,c),b,c):nutation(precession(a,b,c),b,c)}function gyration_posvel(a,b,c){return c===PrecessDirection.Into2000?precession_posvel(nutation_posvel(a,b,c),b,c):nutation_posvel(precession_posvel(a,b,c),b,c)}function geo_pos(a,b){var c=sidereal_time(a);b=terra(b,c).pos;return gyration(b,a,PrecessDirection.Into2000)}var Vector=function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.t=d};
Vector.prototype.Length=function(){return Math.hypot(this.x,this.y,this.z)};exports.Vector=Vector;var StateVector=function(a,b,c,d,e,f,g){this.x=a;this.y=b;this.z=c;this.vx=d;this.vy=e;this.vz=f;this.t=g};exports.StateVector=StateVector;var Spherical=function(a,b,c){this.lat=VerifyNumber(a);this.lon=VerifyNumber(b);this.dist=VerifyNumber(c)};exports.Spherical=Spherical;var EquatorialCoordinates=function(a,b,c,d){this.ra=VerifyNumber(a);this.dec=VerifyNumber(b);this.dist=VerifyNumber(c);this.vec=d};
exports.EquatorialCoordinates=EquatorialCoordinates;function IsValidRotationArray(a){if(!(a instanceof Array)||3!==a.length)return!1;for(var b=0;3>b;++b){if(!(a[b]instanceof Array)||3!==a[b].length)return!1;for(var c=0;3>c;++c)if(!Number.isFinite(a[b][c]))return!1}return!0}var RotationMatrix=function(a){this.rot=a};exports.RotationMatrix=RotationMatrix;function MakeRotation(a){if(!IsValidRotationArray(a))throw"Argument must be a [3][3] array of numbers";return new RotationMatrix(a)}
exports.MakeRotation=MakeRotation;var HorizontalCoordinates=function(a,b,c,d){this.azimuth=VerifyNumber(a);this.altitude=VerifyNumber(b);this.ra=VerifyNumber(c);this.dec=VerifyNumber(d)};exports.HorizontalCoordinates=HorizontalCoordinates;var EclipticCoordinates=function(a,b,c){this.vec=a;this.elat=VerifyNumber(b);this.elon=VerifyNumber(c)};exports.EclipticCoordinates=EclipticCoordinates;function VectorFromArray(a,b){return new Vector(a[0],a[1],a[2],b)}
function vector2radec(a,b){b=VectorFromArray(a,b);var c=b.x*b.x+b.y*b.y,d=Math.sqrt(c+b.z*b.z);if(0===c){if(0===b.z)throw"Indeterminate sky coordinates";return new EquatorialCoordinates(0,0>b.z?-90:90,d,b)}var e=exports.RAD2HOUR*Math.atan2(b.y,b.x);0>e&&(e+=24);return new EquatorialCoordinates(e,exports.RAD2DEG*Math.atan2(a[2],Math.sqrt(c)),d,b)}function spin(a,b){var c=a*exports.DEG2RAD;a=Math.cos(c);c=Math.sin(c);return[a*b[0]+c*b[1],a*b[1]-c*b[0],b[2]]}
function Horizon(a,b,c,d,e){a=MakeTime(a);VerifyObserver(b);VerifyNumber(c);VerifyNumber(d);var f=Math.sin(b.latitude*exports.DEG2RAD),g=Math.cos(b.latitude*exports.DEG2RAD),k=Math.sin(b.longitude*exports.DEG2RAD),h=Math.cos(b.longitude*exports.DEG2RAD);b=Math.sin(d*exports.DEG2RAD);var l=Math.cos(d*exports.DEG2RAD),m=Math.sin(c*exports.HOUR2RAD),n=Math.cos(c*exports.HOUR2RAD),p=[g*h,g*k,f];f=[-f*h,-f*k,g];k=[k,-h,0];g=-15*sidereal_time(a);a=spin(g,p);p=spin(g,f);k=spin(g,k);b=[l*n,l*m,b];m=b[0]*
a[0]+b[1]*a[1]+b[2]*a[2];l=b[0]*p[0]+b[1]*p[1]+b[2]*p[2];p=b[0]*k[0]+b[1]*k[1]+b[2]*k[2];n=Math.hypot(l,p);0<n?(l=-exports.RAD2DEG*Math.atan2(p,l),0>l&&(l+=360)):l=0;m=exports.RAD2DEG*Math.atan2(n,m);n=d;if(e&&(d=m,e=Refraction(e,90-m),m-=e,0<e&&3E-4<m)){c=Math.sin(m*exports.DEG2RAD);n=Math.cos(m*exports.DEG2RAD);p=Math.sin(d*exports.DEG2RAD);d=Math.cos(d*exports.DEG2RAD);e=[];for(k=0;3>k;++k)e.push((b[k]-d*a[k])/p*c+a[k]*n);n=Math.hypot(e[0],e[1]);0<n?(c=exports.RAD2HOUR*Math.atan2(e[1],e[0]),0>
c&&(c+=24)):c=0;n=exports.RAD2DEG*Math.atan2(e[2],n)}return new HorizontalCoordinates(l,90-m,c,n)}exports.Horizon=Horizon;function VerifyObserver(a){if(!(a instanceof Observer))throw"Not an instance of the Observer class: "+a;VerifyNumber(a.latitude);VerifyNumber(a.longitude);VerifyNumber(a.height);if(-90>a.latitude||90<a.latitude)throw"Latitude "+a.latitude+" is out of range. Must be -90..+90.";return a}var Observer=function(a,b,c){this.latitude=a;this.longitude=b;this.height=c;VerifyObserver(this)};
exports.Observer=Observer;function SunPosition(a){a=MakeTime(a).AddDays(-1/exports.C_AUDAY);var b=CalcVsop(vsop.Earth,a),c=$jscomp.makeIterator(gyration([-b.x,-b.y,-b.z],a,PrecessDirection.From2000));b=c.next().value;var d=c.next().value,e=c.next().value,f=exports.DEG2RAD*e_tilt(a).tobl;c=Math.cos(f);f=Math.sin(f);a=new Vector(b,d,e,a);return RotateEquatorialToEcliptic(a,c,f)}exports.SunPosition=SunPosition;
function Equator(a,b,c,d,e){VerifyObserver(c);VerifyBoolean(d);VerifyBoolean(e);b=MakeTime(b);c=geo_pos(b,c);a=GeoVector(a,b,e);a=[a.x-c[0],a.y-c[1],a.z-c[2]];if(!d)return vector2radec(a,b);d=gyration(a,b,PrecessDirection.From2000);return vector2radec(d,b)}exports.Equator=Equator;function ObserverVector(a,b,c){a=MakeTime(a);var d=sidereal_time(a);b=terra(b,d).pos;c||(b=gyration(b,a,PrecessDirection.Into2000));return VectorFromArray(b,a)}exports.ObserverVector=ObserverVector;
function ObserverState(a,b,c){a=MakeTime(a);var d=sidereal_time(a);b=terra(b,d);b=new StateVector(b.pos[0],b.pos[1],b.pos[2],b.vel[0],b.vel[1],b.vel[2],a);return c?b:gyration_posvel(b,a,PrecessDirection.Into2000)}exports.ObserverState=ObserverState;function VectorObserver(a,b){var c=sidereal_time(a.t),d=[a.x,a.y,a.z];b||(d=precession(d,a.t,PrecessDirection.From2000),d=nutation(d,a.t,PrecessDirection.From2000));return inverse_terra(d,c)}exports.VectorObserver=VectorObserver;
function ObserverGravity(a,b){a=Math.sin(a*exports.DEG2RAD);a*=a;return 9.7803253359*(1+.00193185265241*a)/Math.sqrt(1-.00669437999013*a)*(1-(3.15704E-7-2.10269E-9*a)*b+7.37452E-14*b*b)}exports.ObserverGravity=ObserverGravity;function RotateEquatorialToEcliptic(a,b,c){var d=a.x,e=a.y*b+a.z*c;c=-a.y*c+a.z*b;var f=Math.hypot(d,e);b=0;0<f&&(b=exports.RAD2DEG*Math.atan2(e,d),0>b&&(b+=360));f=exports.RAD2DEG*Math.atan2(c,f);a=new Vector(d,e,c,a.t);return new EclipticCoordinates(a,f,b)}
function Ecliptic(a){var b=e_tilt(a.t),c=precession([a.x,a.y,a.z],a.t,PrecessDirection.From2000),d=$jscomp.makeIterator(nutation(c,a.t,PrecessDirection.From2000));c=d.next().value;var e=d.next().value;d=d.next().value;a=new Vector(c,e,d,a.t);b=b.tobl*exports.DEG2RAD;return RotateEquatorialToEcliptic(a,Math.cos(b),Math.sin(b))}exports.Ecliptic=Ecliptic;
function GeoMoon(a){a=MakeTime(a);var b=CalcMoon(a),c=b.distance_au*Math.cos(b.geo_eclip_lat);b=ecl2equ_vec(a,[c*Math.cos(b.geo_eclip_lon),c*Math.sin(b.geo_eclip_lon),b.distance_au*Math.sin(b.geo_eclip_lat)]);b=precession(b,a,PrecessDirection.Into2000);return new Vector(b[0],b[1],b[2],a)}exports.GeoMoon=GeoMoon;
function EclipticGeoMoon(a){var b=MakeTime(a);a=CalcMoon(b);var c=a.distance_au*Math.cos(a.geo_eclip_lat),d=[c*Math.cos(a.geo_eclip_lon),c*Math.sin(a.geo_eclip_lon),a.distance_au*Math.sin(a.geo_eclip_lat)];c=e_tilt(b);d=obl_ecl2equ_vec(c.mobl,d);d=nutation(d,b,PrecessDirection.From2000);b=VectorFromArray(d,b);c=c.tobl*exports.DEG2RAD;b=RotateEquatorialToEcliptic(b,Math.cos(c),Math.sin(c));return new Spherical(b.elat,b.elon,a.distance_au)}exports.EclipticGeoMoon=EclipticGeoMoon;
function GeoMoonState(a){a=MakeTime(a);var b=a.AddDays(-1E-5),c=a.AddDays(1E-5);b=GeoMoon(b);c=GeoMoon(c);return new StateVector((b.x+c.x)/2,(b.y+c.y)/2,(b.z+c.z)/2,(c.x-b.x)/2E-5,(c.y-b.y)/2E-5,(c.z-b.z)/2E-5,a)}exports.GeoMoonState=GeoMoonState;function GeoEmbState(a){a=MakeTime(a);var b=GeoMoonState(a),c=1+EARTH_MOON_MASS_RATIO;return new StateVector(b.x/c,b.y/c,b.z/c,b.vx/c,b.vy/c,b.vz/c,a)}exports.GeoEmbState=GeoEmbState;
function VsopFormula(a,b,c){var d=1,e=0;a=$jscomp.makeIterator(a);for(var f=a.next();!f.done;f=a.next()){var g=0;f=$jscomp.makeIterator(f.value);for(var k=f.next();!k.done;k=f.next()){var h=$jscomp.makeIterator(k.value);k=h.next().value;var l=h.next().value;h=h.next().value;g+=k*Math.cos(l+b*h)}g*=d;c&&(g%=PI2);e+=g;d*=b}return e}
function VsopDeriv(a,b){var c=1,d=0,e=0,f=0;a=$jscomp.makeIterator(a);for(var g=a.next();!g.done;g=a.next()){var k=0,h=0;g=$jscomp.makeIterator(g.value);for(var l=g.next();!l.done;l=g.next()){var m=$jscomp.makeIterator(l.value);l=m.next().value;var n=m.next().value;m=m.next().value;n+=b*m;k+=l*m*Math.sin(n);0<f&&(h+=l*Math.cos(n))}e+=f*d*h-c*k;d=c;c*=b;++f}return e}var DAYS_PER_MILLENNIUM=365250,LON_INDEX=0,LAT_INDEX=1,RAD_INDEX=2;
function VsopRotate(a){return new TerseVector(a[0]+4.4036E-7*a[1]-1.90919E-7*a[2],-4.79966E-7*a[0]+.917482137087*a[1]-.397776982902*a[2],.397776982902*a[1]+.917482137087*a[2])}function VsopSphereToRect(a,b,c){var d=c*Math.cos(b);return[d*Math.cos(a),d*Math.sin(a),c*Math.sin(b)]}function CalcVsop(a,b){var c=b.tt/DAYS_PER_MILLENNIUM,d=VsopFormula(a[LON_INDEX],c,!0),e=VsopFormula(a[LAT_INDEX],c,!1);a=VsopFormula(a[RAD_INDEX],c,!1);d=VsopSphereToRect(d,e,a);return VsopRotate(d).ToAstroVector(b)}
function CalcVsopPosVel(a,b){var c=b/DAYS_PER_MILLENNIUM,d=VsopFormula(a[LON_INDEX],c,!0),e=VsopFormula(a[LAT_INDEX],c,!1),f=VsopFormula(a[RAD_INDEX],c,!1),g=VsopDeriv(a[LON_INDEX],c),k=VsopDeriv(a[LAT_INDEX],c);c=VsopDeriv(a[RAD_INDEX],c);var h=Math.cos(d),l=Math.sin(d),m=Math.cos(e),n=Math.sin(e);a=+(c*m*h)-f*n*h*k-f*m*l*g;g=+(c*m*l)-f*n*l*k+f*m*h*g;k=+(c*n)+f*m*k;d=VsopSphereToRect(d,e,f);e=[a/DAYS_PER_MILLENNIUM,g/DAYS_PER_MILLENNIUM,k/DAYS_PER_MILLENNIUM];d=VsopRotate(d);e=VsopRotate(e);return new body_state_t(b,
d,e)}function AdjustBarycenter(a,b,c,d){d/=d+SUN_GM;b=CalcVsop(vsop[c],b);a.x+=d*b.x;a.y+=d*b.y;a.z+=d*b.z}function CalcSolarSystemBarycenter(a){var b=new Vector(0,0,0,a);AdjustBarycenter(b,a,Body.Jupiter,JUPITER_GM);AdjustBarycenter(b,a,Body.Saturn,SATURN_GM);AdjustBarycenter(b,a,Body.Uranus,URANUS_GM);AdjustBarycenter(b,a,Body.Neptune,NEPTUNE_GM);return b}
var PLUTO_NUM_STATES=51,PLUTO_TIME_STEP=29200,PLUTO_DT=146,PLUTO_NSTEPS=201,PlutoStateTable=[[-73E4,[-26.118207232108,-14.376168177825,3.384402515299],[.0016339372163656,-.0027861699588508,-.0013585880229445]],[-700800,[41.974905202127,-.448502952929,-12.770351505989],[7.3458569351457E-4,.0022785014891658,4.8619778602049E-4]],[-671600,[14.706930780744,44.269110540027,9.353698474772],[-.00210001479998,2.2295915939915E-4,7.0143443551414E-4]],[-642400,[-29.441003929957,-6.43016153057,6.858481011305],
[8.4495803960544E-4,-.0030783914758711,-.0012106305981192]],[-613200,[39.444396946234,-6.557989760571,-13.913760296463],[.0011480029005873,.0022400006880665,3.5168075922288E-4]],[-584E3,[20.2303809507,43.266966657189,7.382966091923],[-.0019754081700585,5.3457141292226E-4,7.5929169129793E-4]],[-554800,[-30.65832536462,2.093818874552,9.880531138071],[6.1010603013347E-5,-.0031326500935382,-9.9346125151067E-4]],[-525600,[35.737703251673,-12.587706024764,-14.677847247563],[.0015802939375649,.0021347678412429,
1.9074436384343E-4]],[-496400,[25.466295188546,41.367478338417,5.216476873382],[-.0018054401046468,8.328308359951E-4,8.0260156912107E-4]],[-467200,[-29.847174904071,10.636426313081,12.297904180106],[-6.3257063052907E-4,-.0029969577578221,-7.4476074151596E-4]],[-438E3,[30.774692107687,-18.236637015304,-14.945535879896],[.0020113162005465,.0019353827024189,-2.0937793168297E-6]],[-408800,[30.243153324028,38.656267888503,2.938501750218],[-.0016052508674468,.0011183495337525,8.3333973416824E-4]],[-379600,
[-27.288984772533,18.643162147874,14.023633623329],[-.0011856388898191,-.0027170609282181,-4.9015526126399E-4]],[-350400,[24.519605196774,-23.245756064727,-14.626862367368],[.0024322321483154,.0016062008146048,-2.3369181613312E-4]],[-321200,[34.505274805875,35.125338586954,.557361475637],[-.0013824391637782,.0013833397561817,8.4823598806262E-4]],[-292E3,[-23.275363915119,25.818514298769,15.055381588598],[-.0016062295460975,-.0023395961498533,-2.4377362639479E-4]],[-262800,[17.050384798092,-27.180376290126,
-13.608963321694],[.0028175521080578,.0011358749093955,-4.9548725258825E-4]],[-233600,[38.093671910285,30.880588383337,-1.843688067413],[-.0011317697153459,.0016128814698472,8.4177586176055E-4]],[-204400,[-18.197852930878,31.932869934309,15.438294826279],[-.0019117272501813,-.0019146495909842,-1.9657304369835E-5]],[-175200,[8.528924039997,-29.618422200048,-11.805400994258],[.0031034370787005,5.139363329243E-4,-7.7293066202546E-4]],[-146E3,[40.94685725864,25.904973592021,-4.256336240499],[-8.3652705194051E-4,
.0018129497136404,8.156422827306E-4]],[-116800,[-12.326958895325,36.881883446292,15.217158258711],[-.0021166103705038,-.001481442003599,1.7401209844705E-4]],[-87600,[-.633258375909,-30.018759794709,-9.17193287495],[.0032016994581737,-2.5279858672148E-4,-.0010411088271861]],[-58400,[42.936048423883,20.344685584452,-6.588027007912],[-5.0525450073192E-4,.0019910074335507,7.7440196540269E-4]],[-29200,[-5.975910552974,40.61180995846,14.470131723673],[-.0022184202156107,-.0010562361130164,3.3652250216211E-4]],
[0,[-9.875369580774,-27.978926224737,-5.753711824704],[.0030287533248818,-.0011276087003636,-.0012651326732361]],[29200,[43.958831986165,14.214147973292,-8.808306227163],[-1.4717608981871E-4,.0021404187242141,7.1486567806614E-4]],[58400,[.67813676352,43.094461639362,13.243238780721],[-.0022358226110718,-6.3233636090933E-4,4.7664798895648E-4]],[87600,[-18.282602096834,-23.30503958666,-1.766620508028],[.0025567245263557,-.0019902940754171,-.0013943491701082]],[116800,[43.873338744526,7.700705617215,
-10.814273666425],[2.3174803055677E-4,.0022402163127924,6.2988756452032E-4]],[146E3,[7.392949027906,44.382678951534,11.629500214854],[-.002193281545383,-2.1751799585364E-4,5.9556516201114E-4]],[175200,[-24.981690229261,-16.204012851426,2.466457544298],[.001819398914958,-.0026765419531201,-.0013848283502247]],[204400,[42.530187039511,.845935508021,-12.554907527683],[6.5059779150669E-4,.0022725657282262,5.1133743202822E-4]],[233600,[13.999526486822,44.462363044894,9.669418486465],[-.0021079296569252,
1.7533423831993E-4,6.9128485798076E-4]],[262800,[-29.184024803031,-7.371243995762,6.493275957928],[9.3581363109681E-4,-.0030610357109184,-.0012364201089345]],[292E3,[39.831980671753,-6.078405766765,-13.909815358656],[.0011117769689167,.0022362097830152,3.6230548231153E-4]],[321200,[20.294955108476,43.417190420251,7.450091985932],[-.0019742157451535,5.3102050468554E-4,7.5938408813008E-4]],[350400,[-30.66999230216,2.318743558955,9.973480913858],[4.5605107450676E-5,-.0031308219926928,-9.9066533301924E-4]],
[379600,[35.626122155983,-12.897647509224,-14.777586508444],[.0016015684949743,.0021171931182284,1.8002516202204E-4]],[408800,[26.133186148561,41.232139187599,5.00640132622],[-.0017857704419579,8.6046232702817E-4,8.0614690298954E-4]],[438E3,[-29.57674022923,11.863535943587,12.631323039872],[-7.2292830060955E-4,-.0029587820140709,-7.08242964503E-4]],[467200,[29.910805787391,-19.159019294,-15.013363865194],[.0020871080437997,.0018848372554514,-3.8528655083926E-5]],[496400,[31.375957451819,38.050372720763,
2.433138343754],[-.0015546055556611,.0011699815465629,8.3565439266001E-4]],[525600,[-26.360071336928,20.662505904952,14.414696258958],[-.0013142373118349,-.0026236647854842,-4.2542017598193E-4]],[554800,[22.599441488648,-24.508879898306,-14.484045731468],[.0025454108304806,.0014917058755191,-3.0243665086079E-4]],[584E3,[35.877864013014,33.894226366071,-.224524636277],[-.0012941245730845,.0014560427668319,8.4762160640137E-4]],[613200,[-21.538149762417,28.204068269761,15.321973799534],[-.001731211740901,
-.0021939631314577,-1.631691327518E-4]],[642400,[13.971521374415,-28.339941764789,-13.083792871886],[.0029334630526035,9.1860931752944E-4,-5.9939422488627E-4]],[671600,[39.526942044143,28.93989736011,-2.872799527539],[-.0010068481658095,.001702113288809,8.3578230511981E-4]],[700800,[-15.576200701394,34.399412961275,15.466033737854],[-.0020098814612884,-.0017191109825989,7.0414782780416E-5]],[73E4,[4.24325283709,-30.118201690825,-10.707441231349],[.0031725847067411,1.609846120227E-4,-9.0672150593868E-4]]],
TerseVector=function(a,b,c){this.x=a;this.y=b;this.z=c};TerseVector.prototype.clone=function(){return new TerseVector(this.x,this.y,this.z)};TerseVector.prototype.ToAstroVector=function(a){return new Vector(this.x,this.y,this.z,a)};TerseVector.zero=function(){return new TerseVector(0,0,0)};TerseVector.prototype.quadrature=function(){return this.x*this.x+this.y*this.y+this.z*this.z};TerseVector.prototype.add=function(a){return new TerseVector(this.x+a.x,this.y+a.y,this.z+a.z)};
TerseVector.prototype.sub=function(a){return new TerseVector(this.x-a.x,this.y-a.y,this.z-a.z)};TerseVector.prototype.incr=function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z};TerseVector.prototype.decr=function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z};TerseVector.prototype.mul=function(a){return new TerseVector(a*this.x,a*this.y,a*this.z)};TerseVector.prototype.div=function(a){return new TerseVector(this.x/a,this.y/a,this.z/a)};
TerseVector.prototype.mean=function(a){return new TerseVector((this.x+a.x)/2,(this.y+a.y)/2,(this.z+a.z)/2)};TerseVector.prototype.neg=function(){return new TerseVector(-this.x,-this.y,-this.z)};var body_state_t=function(a,b,c){this.tt=a;this.r=b;this.v=c};body_state_t.prototype.clone=function(){return new body_state_t(this.tt,this.r,this.v)};body_state_t.prototype.sub=function(a){return new body_state_t(this.tt,this.r.sub(a.r),this.v.sub(a.v))};
function BodyStateFromTable(a){var b=$jscomp.makeIterator(a);a=b.next().value;var c=$jscomp.makeIterator(b.next().value),d=c.next().value,e=c.next().value;c=c.next().value;var f=$jscomp.makeIterator(b.next().value);b=f.next().value;var g=f.next().value;f=f.next().value;return new body_state_t(a,new TerseVector(d,e,c),new TerseVector(b,g,f))}function AdjustBarycenterPosVel(a,b,c,d){d/=d+SUN_GM;b=CalcVsopPosVel(vsop[c],b);a.r.incr(b.r.mul(d));a.v.incr(b.v.mul(d));return b}
function AccelerationIncrement(a,b,c){a=c.sub(a);c=a.quadrature();return a.mul(b/(c*Math.sqrt(c)))}
var major_bodies_t=function(a){var b=new body_state_t(a,new TerseVector(0,0,0),new TerseVector(0,0,0));this.Jupiter=AdjustBarycenterPosVel(b,a,Body.Jupiter,JUPITER_GM);this.Saturn=AdjustBarycenterPosVel(b,a,Body.Saturn,SATURN_GM);this.Uranus=AdjustBarycenterPosVel(b,a,Body.Uranus,URANUS_GM);this.Neptune=AdjustBarycenterPosVel(b,a,Body.Neptune,NEPTUNE_GM);this.Jupiter.r.decr(b.r);this.Jupiter.v.decr(b.v);this.Saturn.r.decr(b.r);this.Saturn.v.decr(b.v);this.Uranus.r.decr(b.r);this.Uranus.v.decr(b.v);
this.Neptune.r.decr(b.r);this.Neptune.v.decr(b.v);this.Sun=new body_state_t(a,b.r.mul(-1),b.v.mul(-1))};major_bodies_t.prototype.Acceleration=function(a){var b=AccelerationIncrement(a,SUN_GM,this.Sun.r);b.incr(AccelerationIncrement(a,JUPITER_GM,this.Jupiter.r));b.incr(AccelerationIncrement(a,SATURN_GM,this.Saturn.r));b.incr(AccelerationIncrement(a,URANUS_GM,this.Uranus.r));b.incr(AccelerationIncrement(a,NEPTUNE_GM,this.Neptune.r));return b};
var body_grav_calc_t=function(a,b,c,d){this.tt=a;this.r=b;this.v=c;this.a=d};body_grav_calc_t.prototype.clone=function(){return new body_grav_calc_t(this.tt,this.r.clone(),this.v.clone(),this.a.clone())};var grav_sim_t=function(a,b){this.bary=a;this.grav=b};function UpdatePosition(a,b,c,d){return new TerseVector(b.x+a*(c.x+a*d.x/2),b.y+a*(c.y+a*d.y/2),b.z+a*(c.z+a*d.z/2))}function UpdateVelocity(a,b,c){return new TerseVector(b.x+a*c.x,b.y+a*c.y,b.z+a*c.z)}
function GravSim(a,b){var c=a-b.tt,d=new major_bodies_t(a),e=UpdatePosition(c,b.r,b.v,b.a),f=d.Acceleration(e).mean(b.a);e=UpdatePosition(c,b.r,b.v,f);b=b.v.add(f.mul(c));c=d.Acceleration(e);a=new body_grav_calc_t(a,e,b,c);return new grav_sim_t(d,a)}var pluto_cache=[];function ClampIndex(a,b){a=Math.floor(a);return 0>a?0:a>=b?b-1:a}
function GravFromState(a){var b=BodyStateFromTable(a);a=new major_bodies_t(b.tt);var c=b.r.add(a.Sun.r),d=b.v.add(a.Sun.v),e=a.Acceleration(c);b=new body_grav_calc_t(b.tt,c,d,e);return new grav_sim_t(a,b)}
function GetSegment(a,b){var c=PlutoStateTable[0][0];if(b<c||b>PlutoStateTable[PLUTO_NUM_STATES-1][0])return null;b=ClampIndex((b-c)/PLUTO_TIME_STEP,PLUTO_NUM_STATES-1);if(!a[b]){c=a[b]=[];c[0]=GravFromState(PlutoStateTable[b]).grav;c[PLUTO_NSTEPS-1]=GravFromState(PlutoStateTable[b+1]).grav;var d,e=c[0].tt;for(d=1;d<PLUTO_NSTEPS-1;++d)c[d]=GravSim(e+=PLUTO_DT,c[d-1]).grav;e=c[PLUTO_NSTEPS-1].tt;var f=[];f[PLUTO_NSTEPS-1]=c[PLUTO_NSTEPS-1];for(d=PLUTO_NSTEPS-2;0<d;--d)f[d]=GravSim(e-=PLUTO_DT,f[d+
1]).grav;for(d=PLUTO_NSTEPS-2;0<d;--d)e=d/(PLUTO_NSTEPS-1),c[d].r=c[d].r.mul(1-e).add(f[d].r.mul(e)),c[d].v=c[d].v.mul(1-e).add(f[d].v.mul(e)),c[d].a=c[d].a.mul(1-e).add(f[d].a.mul(e))}return a[b]}function CalcPlutoOneWay(a,b,c){a=GravFromState(a);for(var d=Math.ceil((b-a.grav.tt)/c),e=0;e<d;++e)a=GravSim(e+1===d?b:a.grav.tt+c,a.grav);return a}
function CalcPluto(a,b){var c;if(c=GetSegment(pluto_cache,a.tt)){var d=ClampIndex((a.tt-c[0].tt)/PLUTO_DT,PLUTO_NSTEPS-1);var e=c[d];var f=c[d+1],g=e.a.mean(f.a);d=UpdatePosition(a.tt-e.tt,e.r,e.v,g);c=UpdateVelocity(a.tt-e.tt,e.v,g);var k=UpdatePosition(a.tt-f.tt,f.r,f.v,g);f=UpdateVelocity(a.tt-f.tt,f.v,g);g=(a.tt-e.tt)/PLUTO_DT;e=d.mul(1-g).add(k.mul(g));c=c.mul(1-g).add(f.mul(g))}else{var h=a.tt<PlutoStateTable[0][0]?CalcPlutoOneWay(PlutoStateTable[0],a.tt,-PLUTO_DT):CalcPlutoOneWay(PlutoStateTable[PLUTO_NUM_STATES-
1],a.tt,+PLUTO_DT);e=h.grav.r;c=h.grav.v;h=h.bary}b&&(h||(h=new major_bodies_t(a.tt)),e=e.sub(h.Sun.r),c=c.sub(h.Sun.v));return new StateVector(e.x,e.y,e.z,c.x,c.y,c.z,a)}
var Rotation_JUP_EQJ=new RotationMatrix([[.999432765338654,-.0336771074697641,0],[.0303959428906285,.902057912352809,.430543388542295],[-.0144994559663353,-.430299169409101,.902569881273754]]),JupiterMoonModel=[{mu:2.82489428433814E-7,al:[1.446213296021224,3.5515522861824],a:[[.0028210960212903,0,0]],l:[[-1.925258348666E-4,4.9369589722645,.01358483658305],[-9.70803596076E-5,4.3188796477322,.01303413843243],[-8.988174165E-5,1.9080016428617,.00305064867158],[-5.53101050262E-5,1.4936156681569,.01293892891155]],
z:[[.0041510849668155,4.089939635545,-.01290686414666],[6.260521444113E-4,1.446188898627,3.5515522949802],[3.52747346169E-5,2.1256287034578,1.2727416567E-4]],zeta:[[3.142172466014E-4,2.7964219722923,-.002315096098],[9.04169207946E-5,1.0477061879627,-5.6920638196E-4]]},{mu:2.82483274392893E-7,al:[-.3735263437471362,1.76932271112347],a:[[.0044871037804314,0,0],[4.324367498E-7,1.819645606291,1.7822295777568]],l:[[8.576433172936E-4,4.3188693178264,.01303413830805],[4.549582875086E-4,1.4936531751079,.01293892881962],
[3.248939825174E-4,1.8196494533458,1.7822295777568],[-3.074250079334E-4,4.9377037005911,.01358483286724],[1.982386144784E-4,1.907986905476,.00305101212869],[1.834063551804E-4,2.1402853388529,.00145009789338],[-1.434383188452E-4,5.622214036663,.89111478887838],[-7.71939140944E-5,4.300272437235,2.6733443704266]],z:[[-.0093589104136341,4.0899396509039,-.01290686414666],[2.988994545555E-4,5.9097265185595,1.7693227079462],[2.13903639035E-4,2.1256289300016,1.2727418407E-4],[1.980963564781E-4,2.743516829265,
6.7797343009E-4],[1.210388158965E-4,5.5839943711203,3.20566149E-5],[8.37042048393E-5,1.6094538368039,-.90402165808846],[8.23525166369E-5,1.4461887708689,3.5515522949802]],zeta:[[.0040404917832303,1.0477063169425,-5.692064054E-4],[2.200421034564E-4,3.3368857864364,-1.2491307307E-4],[1.662544744719E-4,2.4134862374711,0],[5.90282470983E-5,5.9719930968366,-3.056160225E-5]]},{mu:2.82498184184723E-7,al:[.2874089391143348,.878207923589328],a:[[.0071566594572575,0,0],[1.393029911E-6,1.1586745884981,2.6733443704266]],
l:[[2.310797886226E-4,2.1402987195942,.00145009784384],[-1.828635964118E-4,4.3188672736968,.01303413828263],[1.512378778204E-4,4.9373102372298,.01358483481252],[-1.163720969778E-4,4.300265986149,2.6733443704266],[-9.55478069846E-5,1.4936612842567,.01293892879857],[8.15246854464E-5,5.6222137132535,.89111478887838],[-8.01219679602E-5,1.2995922951532,1.0034433456729],[-6.07017260182E-5,.64978769669238,.50172167043264]],z:[[.0014289811307319,2.1256295942739,1.2727413029E-4],[7.71093122676E-4,5.5836330003496,
3.20643411E-5],[5.925911780766E-4,4.0899396636448,-.01290686414666],[2.045597496146E-4,5.2713683670372,-.12523544076106],[1.785118648258E-4,.28743156721063,.8782079244252],[1.131999784893E-4,1.4462127277818,3.5515522949802],[-6.5877816921E-5,2.2702423990985,-1.7951364394537],[4.97058888328E-5,5.9096792204858,1.7693227129285]],zeta:[[.0015932721570848,3.3368862796665,-1.2491307058E-4],[8.533093128905E-4,2.4133881688166,0],[3.513347911037E-4,5.9720789850127,-3.056101771E-5],[-1.441929255483E-4,1.0477061764435,
-5.6920632124E-4]]},{mu:2.82492144889909E-7,al:[-.3620341291375704,.376486233433828],a:[[.0125879701715314,0,0],[3.595204947E-6,.64965776007116,.50172168165034],[2.7580210652E-6,1.808423578151,3.1750660413359]],l:[[5.586040123824E-4,2.1404207189815,.00145009793231],[-3.805813868176E-4,2.7358844897853,2.972965062E-5],[2.205152863262E-4,.649796525964,.5017216724358],[1.877895151158E-4,1.8084787604005,3.1750660413359],[7.66916975242E-5,6.2720114319755,1.3928364636651],[7.47056855106E-5,1.2995916202344,
1.0034433456729]],z:[[.0073755808467977,5.5836071576084,3.206509914E-5],[2.065924169942E-4,5.9209831565786,.37648624194703],[1.589869764021E-4,.28744006242623,.8782079244252],[-1.561131605348E-4,2.1257397865089,1.2727441285E-4],[1.486043380971E-4,1.4462134301023,3.5515522949802],[6.35073108731E-5,5.9096803285954,1.7693227129285],[5.99351698525E-5,4.1125517584798,-2.7985797954589],[5.40660842731E-5,5.5390350845569,.00286834082283],[-4.89596900866E-5,4.6218149483338,-.62695712529519]],zeta:[[.0038422977898495,
2.4133922085557,0],[.0022453891791894,5.9721736773277,-3.056125525E-5],[-2.604479450559E-4,3.3368746306409,-1.2491309972E-4],[3.3211214323E-5,5.5604137742337,.00290037688507]]}],JupiterMoonsInfo=function(a,b,c,d){this.io=a;this.europa=b;this.ganymede=c;this.callisto=d};exports.JupiterMoonsInfo=JupiterMoonsInfo;
function JupiterMoon_elem2pv(a,b,c){var d=c[0],e=c[1],f=c[2],g=c[3],k=c[4];c=c[5];var h=Math.sqrt(b/(d*d*d));b=e+f*Math.sin(e)-g*Math.cos(e);do{var l=Math.cos(b);var m=Math.sin(b);l=(e-b+f*m-g*l)/(1-f*l-g*m);b+=l}while(1E-12<=Math.abs(l));l=Math.cos(b);m=Math.sin(b);b=g*l-f*m;var n=-f*l-g*m,p=1/(1+n),r=1/(1+Math.sqrt(1-f*f-g*g));e=d*(l-f-r*g*b);b=d*(m-g+r*f*b);g=h*p*d*(-m-r*g*n);d=h*p*d*(+l+r*f*n);f=2*Math.sqrt(1-k*k-c*c);h=1-2*c*c;l=1-2*k*k;m=2*c*k;return new StateVector(e*h+b*m,e*m+b*l,(k*b-e*c)*
f,g*h+d*m,g*m+d*l,(k*d-g*c)*f,a)}
function CalcJupiterMoon(a,b){for(var c=a.tt+18262.5,d=[0,b.al[0]+c*b.al[1],0,0,0,0],e=$jscomp.makeIterator(b.a),f=e.next();!f.done;f=e.next()){var g=$jscomp.makeIterator(f.value);f=g.next().value;var k=g.next().value;g=g.next().value;d[0]+=f*Math.cos(k+c*g)}e=$jscomp.makeIterator(b.l);for(f=e.next();!f.done;f=e.next())g=$jscomp.makeIterator(f.value),f=g.next().value,k=g.next().value,g=g.next().value,d[1]+=f*Math.sin(k+c*g);d[1]%=PI2;0>d[1]&&(d[1]+=PI2);e=$jscomp.makeIterator(b.z);for(f=e.next();!f.done;f=
e.next())g=$jscomp.makeIterator(f.value),f=g.next().value,k=g.next().value,g=g.next().value,k+=c*g,d[2]+=f*Math.cos(k),d[3]+=f*Math.sin(k);e=$jscomp.makeIterator(b.zeta);for(f=e.next();!f.done;f=e.next())g=$jscomp.makeIterator(f.value),f=g.next().value,k=g.next().value,g=g.next().value,k+=c*g,d[4]+=f*Math.cos(k),d[5]+=f*Math.sin(k);a=JupiterMoon_elem2pv(a,b.mu,d);return RotateState(Rotation_JUP_EQJ,a)}
function JupiterMoons(a){a=new AstroTime(a);return new JupiterMoonsInfo(CalcJupiterMoon(a,JupiterMoonModel[0]),CalcJupiterMoon(a,JupiterMoonModel[1]),CalcJupiterMoon(a,JupiterMoonModel[2]),CalcJupiterMoon(a,JupiterMoonModel[3]))}exports.JupiterMoons=JupiterMoons;
function HelioVector(a,b){b=MakeTime(b);if(a in vsop)return CalcVsop(vsop[a],b);if(a===Body.Pluto)return a=CalcPluto(b,!0),new Vector(a.x,a.y,a.z,b);if(a===Body.Sun)return new Vector(0,0,0,b);if(a===Body.Moon){a=CalcVsop(vsop.Earth,b);var c=GeoMoon(b);return new Vector(a.x+c.x,a.y+c.y,a.z+c.z,b)}if(a===Body.EMB){a=CalcVsop(vsop.Earth,b);c=GeoMoon(b);var d=1+EARTH_MOON_MASS_RATIO;return new Vector(a.x+c.x/d,a.y+c.y/d,a.z+c.z/d,b)}if(a===Body.SSB)return CalcSolarSystemBarycenter(b);if(c=UserDefinedStar(a))return a=
new Spherical(c.dec,15*c.ra,c.dist),VectorFromSphere(a,b);throw'HelioVector: Unknown body "'+a+'"';}exports.HelioVector=HelioVector;function HelioDistance(a,b){var c=UserDefinedStar(a);if(c)return c.dist;b=MakeTime(b);return a in vsop?VsopFormula(vsop[a][RAD_INDEX],b.tt/DAYS_PER_MILLENNIUM,!1):HelioVector(a,b).Length()}exports.HelioDistance=HelioDistance;
function CorrectLightTravel(a,b){for(var c=b,d=0,e=0;10>e;++e){var f=a(c);d=f.Length()/exports.C_AUDAY;if(1<d)throw"Object is too distant for light-travel solver.";var g=b.AddDays(-d);d=Math.abs(g.tt-c.tt);if(1E-9>d)return f;c=g}throw"Light-travel time solver did not converge: dt = "+d;}exports.CorrectLightTravel=CorrectLightTravel;var BodyPosition=function(a,b,c,d){this.observerBody=a;this.targetBody=b;this.aberration=c;this.observerPos=d};
BodyPosition.prototype.Position=function(a){this.aberration&&(this.observerPos=HelioVector(this.observerBody,a));var b=HelioVector(this.targetBody,a);return new Vector(b.x-this.observerPos.x,b.y-this.observerPos.y,b.z-this.observerPos.z,a)};
function BackdatePosition(a,b,c,d){VerifyBoolean(d);a=MakeTime(a);if(UserDefinedStar(c)){c=HelioVector(c,a);if(d)return b=HelioState(b,a),d=new Vector(c.x-b.x,c.y-b.y,c.z-b.z,a),c=exports.C_AUDAY/d.Length(),new Vector(d.x+b.vx/c,d.y+b.vy/c,d.z+b.vz/c,a);b=HelioVector(b,a);return new Vector(c.x-b.x,c.y-b.y,c.z-b.z,a)}var e=d?new Vector(0,0,0,a):HelioVector(b,a);var f=new BodyPosition(b,c,d,e);return CorrectLightTravel(function(g){return f.Position(g)},a)}exports.BackdatePosition=BackdatePosition;
function GeoVector(a,b,c){VerifyBoolean(c);b=MakeTime(b);switch(a){case Body.Earth:return new Vector(0,0,0,b);case Body.Moon:return GeoMoon(b);default:return a=BackdatePosition(b,Body.Earth,a,c),a.t=b,a}}exports.GeoVector=GeoVector;function ExportState(a,b){return new StateVector(a.r.x,a.r.y,a.r.z,a.v.x,a.v.y,a.v.z,b)}
function BaryState(a,b){b=MakeTime(b);if(a===Body.SSB)return new StateVector(0,0,0,0,0,0,b);if(a===Body.Pluto)return CalcPluto(b,!1);var c=new major_bodies_t(b.tt);switch(a){case Body.Sun:return ExportState(c.Sun,b);case Body.Jupiter:return ExportState(c.Jupiter,b);case Body.Saturn:return ExportState(c.Saturn,b);case Body.Uranus:return ExportState(c.Uranus,b);case Body.Neptune:return ExportState(c.Neptune,b);case Body.Moon:case Body.EMB:var d=CalcVsopPosVel(vsop[Body.Earth],b.tt);a=a===Body.Moon?
GeoMoonState(b):GeoEmbState(b);return new StateVector(a.x+c.Sun.r.x+d.r.x,a.y+c.Sun.r.y+d.r.y,a.z+c.Sun.r.z+d.r.z,a.vx+c.Sun.v.x+d.v.x,a.vy+c.Sun.v.y+d.v.y,a.vz+c.Sun.v.z+d.v.z,b)}if(a in vsop)return a=CalcVsopPosVel(vsop[a],b.tt),new StateVector(c.Sun.r.x+a.r.x,c.Sun.r.y+a.r.y,c.Sun.r.z+a.r.z,c.Sun.v.x+a.v.x,c.Sun.v.y+a.v.y,c.Sun.v.z+a.v.z,b);throw'BaryState: Unsupported body "'+a+'"';}exports.BaryState=BaryState;
function HelioState(a,b){b=MakeTime(b);switch(a){case Body.Sun:return new StateVector(0,0,0,0,0,0,b);case Body.SSB:return a=new major_bodies_t(b.tt),new StateVector(-a.Sun.r.x,-a.Sun.r.y,-a.Sun.r.z,-a.Sun.v.x,-a.Sun.v.y,-a.Sun.v.z,b);case Body.Mercury:case Body.Venus:case Body.Earth:case Body.Mars:case Body.Jupiter:case Body.Saturn:case Body.Uranus:case Body.Neptune:return a=CalcVsopPosVel(vsop[a],b.tt),ExportState(a,b);case Body.Pluto:return CalcPluto(b,!0);case Body.Moon:case Body.EMB:var c=CalcVsopPosVel(vsop.Earth,
b.tt);a=a==Body.Moon?GeoMoonState(b):GeoEmbState(b);return new StateVector(a.x+c.r.x,a.y+c.r.y,a.z+c.r.z,a.vx+c.v.x,a.vy+c.v.y,a.vz+c.v.z,b);default:if(UserDefinedStar(a))return a=HelioVector(a,b),new StateVector(a.x,a.y,a.z,0,0,0,b);throw'HelioState: Unsupported body "'+a+'"';}}exports.HelioState=HelioState;
function QuadInterp(a,b,c,d,e){var f=(e+c)/2-d;c=(e-c)/2;if(0==f){if(0==c)return null;d=-d/c;if(-1>d||1<d)return null}else{d=c*c-4*f*d;if(0>=d)return null;e=Math.sqrt(d);d=(-c+e)/(2*f);e=(-c-e)/(2*f);if(-1<=d&&1>=d){if(-1<=e&&1>=e)return null}else if(-1<=e&&1>=e)d=e;else return null}return{t:a+d*b,df_dt:(2*f*d+c)/b}}
function Search(a,b,c,d){var e=VerifyNumber(d&&d.dt_tolerance_seconds||1);e=Math.abs(e/SECONDS_PER_DAY);var f=d&&d.init_f1||a(b),g=d&&d.init_f2||a(c),k=NaN,h=0;d=d&&d.iter_limit||20;for(var l=!0;;){if(++h>d)throw"Excessive iteration in Search()";var m=InterpolateTime(b,c,.5),n=m.ut-b.ut;if(Math.abs(n)<e)return m;l?k=a(m):l=!0;var p=QuadInterp(m.ut,c.ut-m.ut,f,k,g);if(p){var r=MakeTime(p.t),q=a(r);if(0!==p.df_dt){if(Math.abs(q/p.df_dt)<e)return r;p=1.2*Math.abs(q/p.df_dt);if(p<n/10&&(n=r.AddDays(-p),
r=r.AddDays(+p),0>(n.ut-b.ut)*(n.ut-c.ut)&&0>(r.ut-b.ut)*(r.ut-c.ut))){p=a(n);var t=a(r);if(0>p&&0<=t){f=p;g=t;b=n;c=r;k=q;l=!1;continue}}}}if(0>f&&0<=k)c=m,g=k;else if(0>k&&0<=g)b=m,f=k;else return null}}exports.Search=Search;function LongitudeOffset(a){for(;-180>=a;)a+=360;for(;180<a;)a-=360;return a}function NormalizeLongitude(a){for(;0>a;)a+=360;for(;360<=a;)a-=360;return a}
function SearchSunLongitude(a,b,c){VerifyNumber(a);VerifyNumber(c);b=MakeTime(b);c=b.AddDays(c);return Search(function(d){d=SunPosition(d);return LongitudeOffset(d.elon-a)},b,c,{dt_tolerance_seconds:.01})}exports.SearchSunLongitude=SearchSunLongitude;
function PairLongitude(a,b,c){if(a===Body.Earth||b===Body.Earth)throw"The Earth does not have a longitude as seen from itself.";c=MakeTime(c);a=GeoVector(a,c,!1);a=Ecliptic(a);b=GeoVector(b,c,!1);b=Ecliptic(b);return NormalizeLongitude(a.elon-b.elon)}exports.PairLongitude=PairLongitude;function AngleFromSun(a,b){if(a==Body.Earth)throw"The Earth does not have an angle as seen from itself.";var c=MakeTime(b);b=GeoVector(Body.Sun,c,!0);a=GeoVector(a,c,!0);return AngleBetween(b,a)}
exports.AngleFromSun=AngleFromSun;function EclipticLongitude(a,b){if(a===Body.Sun)throw"Cannot calculate heliocentric longitude of the Sun.";a=HelioVector(a,b);return Ecliptic(a).elon}exports.EclipticLongitude=EclipticLongitude;
function VisualMagnitude(a,b,c,d){var e=0,f=0,g=0;switch(a){case Body.Mercury:a=-.6;e=4.98;f=-4.88;g=3.02;break;case Body.Venus:163.6>b?(a=-4.47,e=1.03,f=.57,g=.13):(a=.98,e=-1.02);break;case Body.Mars:a=-1.52;e=1.6;break;case Body.Jupiter:a=-9.4;e=.5;break;case Body.Uranus:a=-7.19;e=.25;break;case Body.Neptune:a=-6.87;break;case Body.Pluto:a=-1;e=4;break;default:throw"VisualMagnitude: unsupported body "+a;}b/=100;return a+b*(e+b*(f+b*g))+5*Math.log10(c*d)}
function SaturnMagnitude(a,b,c,d,e){d=Ecliptic(d);var f=28.06*exports.DEG2RAD,g=exports.DEG2RAD*d.elat;e=Math.asin(Math.sin(g)*Math.cos(f)-Math.cos(g)*Math.sin(f)*Math.sin(exports.DEG2RAD*d.elon-exports.DEG2RAD*(169.51+3.82E-5*e.tt)));d=Math.sin(Math.abs(e));a=-9+.044*a+d*(-2.6+1.2*d)+5*Math.log10(b*c);return{mag:a,ring_tilt:exports.RAD2DEG*e}}function MoonMagnitude(a,b,c){a*=exports.DEG2RAD;var d=a*a;a=-12.717+1.49*Math.abs(a)+.0431*d*d;return a+=5*Math.log10(c/(385000.6/exports.KM_PER_AU)*b)}
var IlluminationInfo=function(a,b,c,d,e,f,g,k){this.time=a;this.mag=b;this.phase_angle=c;this.helio_dist=d;this.geo_dist=e;this.gc=f;this.hc=g;this.ring_tilt=k;this.phase_fraction=(1+Math.cos(exports.DEG2RAD*c))/2};exports.IlluminationInfo=IlluminationInfo;
function Illumination(a,b){if(a===Body.Earth)throw"The illumination of the Earth is not defined.";var c=MakeTime(b),d=CalcVsop(vsop.Earth,c);if(a===Body.Sun){var e=new Vector(-d.x,-d.y,-d.z,c);b=new Vector(0,0,0,c);d=0}else a===Body.Moon?(e=GeoMoon(c),b=new Vector(d.x+e.x,d.y+e.y,d.z+e.z,c)):(b=HelioVector(a,b),e=new Vector(b.x-d.x,b.y-d.y,b.z-d.z,c)),d=AngleBetween(e,b);var f=e.Length(),g=b.Length();if(a===Body.Sun)a=SUN_MAG_1AU+5*Math.log10(f);else if(a===Body.Moon)a=MoonMagnitude(d,g,f);else if(a===
Body.Saturn){var k=SaturnMagnitude(d,g,f,e,c);a=k.mag;k=k.ring_tilt}else a=VisualMagnitude(a,d,g,f);return new IlluminationInfo(c,a,d,g,f,e,b,k)}exports.Illumination=Illumination;function SynodicPeriod(a){if(a===Body.Earth)throw"The Earth does not have a synodic period as seen from itself.";if(a===Body.Moon)return MEAN_SYNODIC_MONTH;var b=Planet[a];if(!b)throw"Not a valid planet name: "+a;a=Planet.Earth.OrbitalPeriod;return Math.abs(a/(a/b.OrbitalPeriod-1))}
function SearchRelativeLongitude(a,b,c){function d(l){var m=EclipticLongitude(a,l);l=EclipticLongitude(Body.Earth,l);return LongitudeOffset(f*(l-m)-b)}VerifyNumber(b);var e=Planet[a];if(!e)throw"Cannot search relative longitude because body is not a planet: "+a;if(a===Body.Earth)throw"Cannot search relative longitude for the Earth (it is always 0)";var f=e.OrbitalPeriod>Planet.Earth.OrbitalPeriod?1:-1;e=SynodicPeriod(a);c=MakeTime(c);var g=d(c);0<g&&(g-=360);for(var k=0;100>k;++k){var h=-g/360*e;
c=c.AddDays(h);if(1>Math.abs(h)*SECONDS_PER_DAY)return c;h=g;g=d(c);30>Math.abs(h)&&h!==g&&(h/=h-g,.5<h&&2>h&&(e*=h))}throw"Relative longitude search failed to converge for "+a+" near "+c.toString()+" (error_angle = "+g+").";}exports.SearchRelativeLongitude=SearchRelativeLongitude;function MoonPhase(a){return PairLongitude(Body.Moon,Body.Sun,a)}exports.MoonPhase=MoonPhase;
function SearchMoonPhase(a,b,c){function d(k){k=MoonPhase(k);return LongitudeOffset(k-a)}VerifyNumber(a);VerifyNumber(c);b=MakeTime(b);var e=d(b);if(0>c){0>e&&(e+=360);var f=-(MEAN_SYNODIC_MONTH*e)/360;e=f+1.5;if(e<c)return null;var g=Math.max(c,f-1.5)}else{0<e&&(e-=360);f=-(MEAN_SYNODIC_MONTH*e)/360;g=f-1.5;if(g>c)return null;e=Math.min(c,f+1.5)}c=b.AddDays(g);b=b.AddDays(e);return Search(d,c,b,{dt_tolerance_seconds:.1})}exports.SearchMoonPhase=SearchMoonPhase;
var MoonQuarter=function(a,b){this.quarter=a;this.time=b};exports.MoonQuarter=MoonQuarter;function SearchMoonQuarter(a){var b=MoonPhase(a);b=(Math.floor(b/90)+1)%4;a=SearchMoonPhase(90*b,a,10);if(!a)throw"Cannot find moon quarter";return new MoonQuarter(b,a)}exports.SearchMoonQuarter=SearchMoonQuarter;function NextMoonQuarter(a){a=new Date(a.time.date.getTime()+6*MILLIS_PER_DAY);return SearchMoonQuarter(a)}exports.NextMoonQuarter=NextMoonQuarter;
var AtmosphereInfo=function(a,b,c){this.pressure=a;this.temperature=b;this.density=c};exports.AtmosphereInfo=AtmosphereInfo;function Atmosphere(a){if(!Number.isFinite(a)||-500>a||1E5<a)throw"Invalid elevation: "+a;if(11E3>=a){var b=288.15-.0065*a;a=101325*Math.pow(288.15/b,-5.25577)}else 2E4>=a?(b=216.65,a=22632*Math.exp(-1.5768832E-4*(a-11E3))):(b=216.65+.001*(a-2E4),a=5474.87*Math.pow(216.65/b,34.16319));return new AtmosphereInfo(a,b,a/b/(101325/288.15))}exports.Atmosphere=Atmosphere;
function HorizonDipAngle(a,b){var c=a.latitude*exports.DEG2RAD,d=Math.sin(c);c=Math.cos(c);var e=1/Math.hypot(c,d*EARTH_FLATTENING),f=(a.height-b)/1E3;a=.175*Math.pow(1-.0065/283.15*(a.height-2/3*b),3.256);return exports.RAD2DEG*-(Math.sqrt(2*(1-a)*b/(1E3*Math.hypot((EARTH_EQUATORIAL_RADIUS_KM*e+f)*c,(EARTH_EQUATORIAL_RADIUS_KM*e*EARTH_FLATTENING*EARTH_FLATTENING+f)*d)))/(1-a))}
function BodyRadiusAu(a){switch(a){case Body.Sun:return SUN_RADIUS_AU;case Body.Moon:return MOON_EQUATORIAL_RADIUS_AU;default:return 0}}function SearchRiseSet(a,b,c,d,e,f){f=void 0===f?0:f;if(!Number.isFinite(f)||0>f)throw"Invalid value for metersAboveGround: "+f;var g=BodyRadiusAu(a),k=Atmosphere(b.height-f);f=HorizonDipAngle(b,f)-REFRACTION_NEAR_HORIZON*k.density;return InternalSearchAltitude(a,b,c,d,e,g,f)}exports.SearchRiseSet=SearchRiseSet;
function SearchAltitude(a,b,c,d,e,f){if(!Number.isFinite(f)||-90>f||90<f)throw"Invalid altitude angle: "+f;return InternalSearchAltitude(a,b,c,d,e,0,f)}exports.SearchAltitude=SearchAltitude;var AscentInfo=function(a,b,c,d){this.tx=a;this.ty=b;this.ax=c;this.ay=d};
function FindAscent(a,b,c,d,e,f,g){if(0>f&&0<=g)return new AscentInfo(d,e,f,g);if(0<=f&&0>g)return null;if(17<a)throw"Excessive recursion in rise/set ascent search.";var k=e.ut-d.ut;if(1>k*SECONDS_PER_DAY||Math.min(Math.abs(f),Math.abs(g))>k/2*c)return null;k=new AstroTime((d.ut+e.ut)/2);var h=b(k);return FindAscent(1+a,b,c,d,k,f,h)||FindAscent(1+a,b,c,k,e,h,g)}
function MaxAltitudeSlope(a,b){if(-90>b||90<b)throw"Invalid geographic latitude: "+b;switch(a){case Body.Moon:a=4.5;var c=8.2;break;case Body.Sun:a=.8;c=.5;break;case Body.Mercury:a=-1.6;c=1;break;case Body.Venus:a=-.8;c=.6;break;case Body.Mars:a=-.5;c=.4;break;case Body.Jupiter:case Body.Saturn:case Body.Uranus:case Body.Neptune:case Body.Pluto:a=-.2;c=.2;break;case Body.Star1:case Body.Star2:case Body.Star3:case Body.Star4:case Body.Star5:case Body.Star6:case Body.Star7:case Body.Star8:a=-.008;
c=.008;break;default:throw"Body not allowed for altitude search: "+a;}b*=exports.DEG2RAD;return Math.abs((360/SOLAR_DAYS_PER_SIDEREAL_DAY-a)*Math.cos(b))+Math.abs(c*Math.sin(b))}
function InternalSearchAltitude(a,b,c,d,e,f,g){function k(q){var t=Equator(a,q,b,!0,!0);q=Horizon(q,b,t.ra,t.dec).altitude+exports.RAD2DEG*Math.asin(f/t.dist);return c*(q-g)}VerifyObserver(b);VerifyNumber(e);VerifyNumber(f);VerifyNumber(g);if(-90>g||90<g)throw"Invalid target altitude angle: "+g;for(var h=MaxAltitudeSlope(a,b.latitude),l=d=MakeTime(d),m=d,n=k(l),p=n;;){0>e?(l=m.AddDays(-.42),n=k(l)):(m=l.AddDays(.42),p=k(m));var r=FindAscent(0,k,h,l,m,n,p);if(r){if(h=Search(k,r.tx,r.ty,{dt_tolerance_seconds:.1,
init_f1:r.ax,init_f2:r.ay})){if(0>e){if(h.ut<d.ut+e)return null}else if(h.ut>d.ut+e)return null;return h}throw"Rise/set search failed after finding ascent: t1="+l+", t2="+m+", a1="+n+", a2="+p;}if(0>e){if(l.ut<d.ut+e)return null;m=l;p=n}else{if(m.ut>d.ut+e)return null;l=m;n=p}}}var HourAngleEvent=function(a,b){this.time=a;this.hor=b};exports.HourAngleEvent=HourAngleEvent;
function SearchHourAngle(a,b,c,d,e){e=void 0===e?1:e;VerifyObserver(b);d=MakeTime(d);var f=0;if(a===Body.Earth)throw"Cannot search for hour angle of the Earth.";VerifyNumber(c);if(0>c||24<=c)throw"Invalid hour angle "+c;VerifyNumber(e);if(0===e)throw"Direction must be positive or negative.";for(;;){++f;var g=sidereal_time(d),k=Equator(a,d,b,!0,!0);g=(c+k.ra-b.longitude/15-g)%24;1===f?0<e?0>g&&(g+=24):0<g&&(g-=24):-12>g?g+=24:12<g&&(g-=24);if(.1>3600*Math.abs(g))return a=Horizon(d,b,k.ra,k.dec,"normal"),
new HourAngleEvent(d,a);d=d.AddDays(g/24*SOLAR_DAYS_PER_SIDEREAL_DAY)}}exports.SearchHourAngle=SearchHourAngle;function HourAngle(a,b,c){var d=MakeTime(b);b=SiderealTime(d);a=Equator(a,d,c,!0,!0);c=(c.longitude/15+b-a.ra)%24;0>c&&(c+=24);return c}exports.HourAngle=HourAngle;var SeasonInfo=function(a,b,c,d){this.mar_equinox=a;this.jun_solstice=b;this.sep_equinox=c;this.dec_solstice=d};exports.SeasonInfo=SeasonInfo;
function Seasons(a){function b(g,k,h){k=new Date(Date.UTC(a,k-1,h));g=SearchSunLongitude(g,k,20);if(!g)throw"Cannot find season change near "+k.toISOString();return g}a instanceof Date&&Number.isFinite(a.getTime())&&(a=a.getUTCFullYear());if(!Number.isSafeInteger(a))throw"Cannot calculate seasons because year argument "+a+" is neither a Date nor a safe integer.";var c=b(0,3,10),d=b(90,6,10),e=b(180,9,10),f=b(270,12,10);return new SeasonInfo(c,d,e,f)}exports.Seasons=Seasons;
var ElongationEvent=function(a,b,c,d){this.time=a;this.visibility=b;this.elongation=c;this.ecliptic_separation=d};exports.ElongationEvent=ElongationEvent;function Elongation(a,b){b=MakeTime(b);var c=PairLongitude(a,Body.Sun,b);if(180<c){var d="morning";c=360-c}else d="evening";a=AngleFromSun(a,b);return new ElongationEvent(b,d,a,c)}exports.Elongation=Elongation;
function SearchMaxElongation(a,b){function c(l){var m=l.AddDays(-.005);l=l.AddDays(.005);m=AngleFromSun(a,m);l=AngleFromSun(a,l);return(m-l)/.01}b=MakeTime(b);var d={Mercury:{s1:50,s2:85},Venus:{s1:40,s2:50}}[a];if(!d)throw"SearchMaxElongation works for Mercury and Venus only.";for(var e=0;2>=++e;){var f=EclipticLongitude(a,b),g=EclipticLongitude(Body.Earth,b),k=LongitudeOffset(f-g),h=f=g=void 0;k>=-d.s1&&k<+d.s1?(h=0,g=+d.s1,f=+d.s2):k>=+d.s2||k<-d.s2?(h=0,g=-d.s2,f=-d.s1):0<=k?(h=-SynodicPeriod(a)/
4,g=+d.s1,f=+d.s2):(h=-SynodicPeriod(a)/4,g=-d.s2,f=-d.s1);k=b.AddDays(h);g=SearchRelativeLongitude(a,g,k);f=SearchRelativeLongitude(a,f,g);k=c(g);if(0<=k)throw"SearchMaxElongation: internal error: m1 = "+k;h=c(f);if(0>=h)throw"SearchMaxElongation: internal error: m2 = "+h;k=Search(c,g,f,{init_f1:k,init_f2:h,dt_tolerance_seconds:10});if(!k)throw"SearchMaxElongation: failed search iter "+e+" (t1="+g.toString()+", t2="+f.toString()+")";if(k.tt>=b.tt)return Elongation(a,k);b=f.AddDays(1)}throw"SearchMaxElongation: failed to find event after 2 tries.";
}exports.SearchMaxElongation=SearchMaxElongation;
function SearchPeakMagnitude(a,b){function c(h){var l=h.AddDays(-.005);h=h.AddDays(.005);l=Illumination(a,l).mag;return(Illumination(a,h).mag-l)/.01}if(a!==Body.Venus)throw"SearchPeakMagnitude currently works for Venus only.";b=MakeTime(b);for(var d=0;2>=++d;){var e=EclipticLongitude(a,b),f=EclipticLongitude(Body.Earth,b),g=LongitudeOffset(e-f),k=e=f=void 0;-10<=g&&10>g?(k=0,f=10,e=30):30<=g||-30>g?(k=0,f=-30,e=-10):0<=g?(k=-SynodicPeriod(a)/4,f=10,e=30):(k=-SynodicPeriod(a)/4,f=-30,e=-10);g=b.AddDays(k);
f=SearchRelativeLongitude(a,f,g);e=SearchRelativeLongitude(a,e,f);g=c(f);if(0<=g)throw"SearchPeakMagnitude: internal error: m1 = "+g;k=c(e);if(0>=k)throw"SearchPeakMagnitude: internal error: m2 = "+k;g=Search(c,f,e,{init_f1:g,init_f2:k,dt_tolerance_seconds:10});if(!g)throw"SearchPeakMagnitude: failed search iter "+d+" (t1="+f.toString()+", t2="+e.toString()+")";if(g.tt>=b.tt)return Illumination(a,g);b=e.AddDays(1)}throw"SearchPeakMagnitude: failed to find event after 2 tries.";}
exports.SearchPeakMagnitude=SearchPeakMagnitude;var ApsisKind;(function(a){a[a.Pericenter=0]="Pericenter";a[a.Apocenter=1]="Apocenter"})(ApsisKind=exports.ApsisKind||(exports.ApsisKind={}));var Apsis=function(a,b,c){this.time=a;this.kind=b;this.dist_au=c;this.dist_km=c*exports.KM_PER_AU};exports.Apsis=Apsis;
function SearchLunarApsis(a){function b(k){var h=k.AddDays(-5E-4);k=k.AddDays(5E-4);h=CalcMoon(h).distance_au;return(CalcMoon(k).distance_au-h)/.001}function c(k){return-b(k)}a=MakeTime(a);for(var d=b(a),e=0;5*e<2*MEAN_SYNODIC_MONTH;++e){var f=a.AddDays(5),g=b(f);if(0>=d*g){if(0>d||0<g){a=Search(b,a,f,{init_f1:d,init_f2:g});if(!a)throw"SearchLunarApsis INTERNAL ERROR: perigee search failed!";d=CalcMoon(a).distance_au;return new Apsis(a,0,d)}if(0<d||0>g){a=Search(c,a,f,{init_f1:-d,init_f2:-g});if(!a)throw"SearchLunarApsis INTERNAL ERROR: apogee search failed!";
d=CalcMoon(a).distance_au;return new Apsis(a,1,d)}throw"SearchLunarApsis INTERNAL ERROR: cannot classify apsis event!";}a=f;d=g}throw"SearchLunarApsis INTERNAL ERROR: could not find apsis within 2 synodic months of start date.";}exports.SearchLunarApsis=SearchLunarApsis;
function NextLunarApsis(a){var b=SearchLunarApsis(a.time.AddDays(11));if(1!==b.kind+a.kind)throw"NextLunarApsis INTERNAL ERROR: did not find alternating apogee/perigee: prev="+a.kind+" @ "+a.time.toString()+", next="+b.kind+" @ "+b.time.toString();return b}exports.NextLunarApsis=NextLunarApsis;
function PlanetExtreme(a,b,c,d){for(var e=b===ApsisKind.Apocenter?1:-1;;){d/=9;if(d<1/1440)return c=c.AddDays(d/2),a=HelioDistance(a,c),new Apsis(c,b,a);for(var f=-1,g=0,k=0;10>k;++k){var h=c.AddDays(k*d);h=e*HelioDistance(a,h);if(0==k||h>g)f=k,g=h}c=c.AddDays((f-1)*d);d*=2}}
function BruteSearchPlanetApsis(a,b){var c=b.AddDays(-30/360*Planet[a].OrbitalPeriod),d=b.AddDays(.75*Planet[a].OrbitalPeriod),e=c,f=c,g=-1,k=-1;d=(d.ut-c.ut)/99;for(var h=0;100>h;++h){var l=c.AddDays(h*d),m=HelioDistance(a,l);0===h?k=g=m:(m>k&&(k=m,f=l),m<g&&(g=m,e=l))}c=PlanetExtreme(a,0,e.AddDays(-2*d),4*d);a=PlanetExtreme(a,1,f.AddDays(-2*d),4*d);if(c.time.tt>=b.tt)return a.time.tt>=b.tt&&a.time.tt<c.time.tt?a:c;if(a.time.tt>=b.tt)return a;throw"Internal error: failed to find Neptune apsis.";
}
function SearchPlanetApsis(a,b){function c(m){var n=m.AddDays(-5E-4);m=m.AddDays(5E-4);n=HelioDistance(a,n);return(HelioDistance(a,m)-n)/.001}function d(m){return-c(m)}b=MakeTime(b);if(a===Body.Neptune||a===Body.Pluto)return BruteSearchPlanetApsis(a,b);for(var e=Planet[a].OrbitalPeriod,f=e/6,g=c(b),k=0;k*f<2*e;++k){var h=b.AddDays(f),l=c(h);if(0>=g*l){e=f=void 0;if(0>g||0<l)f=c,e=ApsisKind.Pericenter;else if(0<g||0>l)f=d,e=ApsisKind.Apocenter;else throw"Internal error with slopes in SearchPlanetApsis";b=
Search(f,b,h);if(!b)throw"Failed to find slope transition in planetary apsis search.";g=HelioDistance(a,b);return new Apsis(b,e,g)}b=h;g=l}throw"Internal error: should have found planetary apsis within 2 orbital periods.";}exports.SearchPlanetApsis=SearchPlanetApsis;
function NextPlanetApsis(a,b){if(b.kind!==ApsisKind.Pericenter&&b.kind!==ApsisKind.Apocenter)throw"Invalid apsis kind: "+b.kind;var c=b.time.AddDays(.25*Planet[a].OrbitalPeriod);a=SearchPlanetApsis(a,c);if(1!==a.kind+b.kind)throw"Internal error: previous apsis was "+b.kind+", but found "+a.kind+" for next apsis.";return a}exports.NextPlanetApsis=NextPlanetApsis;
function InverseRotation(a){return new RotationMatrix([[a.rot[0][0],a.rot[1][0],a.rot[2][0]],[a.rot[0][1],a.rot[1][1],a.rot[2][1]],[a.rot[0][2],a.rot[1][2],a.rot[2][2]]])}exports.InverseRotation=InverseRotation;
function CombineRotation(a,b){return new RotationMatrix([[b.rot[0][0]*a.rot[0][0]+b.rot[1][0]*a.rot[0][1]+b.rot[2][0]*a.rot[0][2],b.rot[0][1]*a.rot[0][0]+b.rot[1][1]*a.rot[0][1]+b.rot[2][1]*a.rot[0][2],b.rot[0][2]*a.rot[0][0]+b.rot[1][2]*a.rot[0][1]+b.rot[2][2]*a.rot[0][2]],[b.rot[0][0]*a.rot[1][0]+b.rot[1][0]*a.rot[1][1]+b.rot[2][0]*a.rot[1][2],b.rot[0][1]*a.rot[1][0]+b.rot[1][1]*a.rot[1][1]+b.rot[2][1]*a.rot[1][2],b.rot[0][2]*a.rot[1][0]+b.rot[1][2]*a.rot[1][1]+b.rot[2][2]*a.rot[1][2]],[b.rot[0][0]*
a.rot[2][0]+b.rot[1][0]*a.rot[2][1]+b.rot[2][0]*a.rot[2][2],b.rot[0][1]*a.rot[2][0]+b.rot[1][1]*a.rot[2][1]+b.rot[2][1]*a.rot[2][2],b.rot[0][2]*a.rot[2][0]+b.rot[1][2]*a.rot[2][1]+b.rot[2][2]*a.rot[2][2]]])}exports.CombineRotation=CombineRotation;function IdentityMatrix(){return new RotationMatrix([[1,0,0],[0,1,0],[0,0,1]])}exports.IdentityMatrix=IdentityMatrix;
function Pivot(a,b,c){if(0!==b&&1!==b&&2!==b)throw"Invalid axis "+b+". Must be [0, 1, 2].";var d=VerifyNumber(c)*exports.DEG2RAD;c=Math.cos(d);d=Math.sin(d);var e=(b+1)%3,f=(b+2)%3,g=[[0,0,0],[0,0,0],[0,0,0]];g[e][e]=c*a.rot[e][e]-d*a.rot[e][f];g[e][f]=d*a.rot[e][e]+c*a.rot[e][f];g[e][b]=a.rot[e][b];g[f][e]=c*a.rot[f][e]-d*a.rot[f][f];g[f][f]=d*a.rot[f][e]+c*a.rot[f][f];g[f][b]=a.rot[f][b];g[b][e]=c*a.rot[b][e]-d*a.rot[b][f];g[b][f]=d*a.rot[b][e]+c*a.rot[b][f];g[b][b]=a.rot[b][b];return new RotationMatrix(g)}
exports.Pivot=Pivot;function VectorFromSphere(a,b){b=MakeTime(b);var c=a.lat*exports.DEG2RAD,d=a.lon*exports.DEG2RAD,e=a.dist*Math.cos(c);return new Vector(e*Math.cos(d),e*Math.sin(d),a.dist*Math.sin(c),b)}exports.VectorFromSphere=VectorFromSphere;function EquatorFromVector(a){var b=SphereFromVector(a);return new EquatorialCoordinates(b.lon/15,b.lat,b.dist,a)}exports.EquatorFromVector=EquatorFromVector;
function SphereFromVector(a){var b=a.x*a.x+a.y*a.y,c=Math.sqrt(b+a.z*a.z);if(0===b){if(0===a.z)throw"Zero-length vector not allowed.";var d=0;a=0>a.z?-90:90}else d=exports.RAD2DEG*Math.atan2(a.y,a.x),0>d&&(d+=360),a=exports.RAD2DEG*Math.atan2(a.z,Math.sqrt(b));return new Spherical(a,d,c)}exports.SphereFromVector=SphereFromVector;function ToggleAzimuthDirection(a){a=360-a;360<=a?a-=360:0>a&&(a+=360);return a}
function HorizonFromVector(a,b){a=SphereFromVector(a);a.lon=ToggleAzimuthDirection(a.lon);a.lat+=Refraction(b,a.lat);return a}exports.HorizonFromVector=HorizonFromVector;function VectorFromHorizon(a,b,c){b=MakeTime(b);var d=ToggleAzimuthDirection(a.lon);c=a.lat+InverseRefraction(c,a.lat);a=new Spherical(c,d,a.dist);return VectorFromSphere(a,b)}exports.VectorFromHorizon=VectorFromHorizon;
function Refraction(a,b){VerifyNumber(b);if(-90>b||90<b)return 0;if("normal"===a||"jplhor"===a){var c=b;-1>c&&(c=-1);c=1.02/Math.tan((c+10.3/(c+5.11))*exports.DEG2RAD)/60;"normal"===a&&-1>b&&(c*=(b+90)/89)}else{if(a)throw"Invalid refraction option: "+a;c=0}return c}exports.Refraction=Refraction;function InverseRefraction(a,b){if(-90>b||90<b)return 0;for(var c=b-Refraction(a,b);;){var d=c+Refraction(a,c)-b;if(1E-14>Math.abs(d))return c-b;c-=d}}exports.InverseRefraction=InverseRefraction;
function RotateVector(a,b){return new Vector(a.rot[0][0]*b.x+a.rot[1][0]*b.y+a.rot[2][0]*b.z,a.rot[0][1]*b.x+a.rot[1][1]*b.y+a.rot[2][1]*b.z,a.rot[0][2]*b.x+a.rot[1][2]*b.y+a.rot[2][2]*b.z,b.t)}exports.RotateVector=RotateVector;
function RotateState(a,b){return new StateVector(a.rot[0][0]*b.x+a.rot[1][0]*b.y+a.rot[2][0]*b.z,a.rot[0][1]*b.x+a.rot[1][1]*b.y+a.rot[2][1]*b.z,a.rot[0][2]*b.x+a.rot[1][2]*b.y+a.rot[2][2]*b.z,a.rot[0][0]*b.vx+a.rot[1][0]*b.vy+a.rot[2][0]*b.vz,a.rot[0][1]*b.vx+a.rot[1][1]*b.vy+a.rot[2][1]*b.vz,a.rot[0][2]*b.vx+a.rot[1][2]*b.vy+a.rot[2][2]*b.vz,b.t)}exports.RotateState=RotateState;
function Rotation_EQJ_ECL(){return new RotationMatrix([[1,0,0],[0,.9174821430670688,-.3977769691083922],[0,.3977769691083922,.9174821430670688]])}exports.Rotation_EQJ_ECL=Rotation_EQJ_ECL;function Rotation_ECL_EQJ(){return new RotationMatrix([[1,0,0],[0,.9174821430670688,.3977769691083922],[0,-.3977769691083922,.9174821430670688]])}exports.Rotation_ECL_EQJ=Rotation_ECL_EQJ;
function Rotation_EQJ_EQD(a){a=MakeTime(a);var b=precession_rot(a,PrecessDirection.From2000);a=nutation_rot(a,PrecessDirection.From2000);return CombineRotation(b,a)}exports.Rotation_EQJ_EQD=Rotation_EQJ_EQD;function Rotation_EQJ_ECT(a){var b=MakeTime(a);a=Rotation_EQJ_EQD(b);b=Rotation_EQD_ECT(b);return CombineRotation(a,b)}exports.Rotation_EQJ_ECT=Rotation_EQJ_ECT;function Rotation_ECT_EQJ(a){var b=MakeTime(a);a=Rotation_ECT_EQD(b);b=Rotation_EQD_EQJ(b);return CombineRotation(a,b)}
exports.Rotation_ECT_EQJ=Rotation_ECT_EQJ;function Rotation_EQD_EQJ(a){a=MakeTime(a);var b=nutation_rot(a,PrecessDirection.Into2000);a=precession_rot(a,PrecessDirection.Into2000);return CombineRotation(b,a)}exports.Rotation_EQD_EQJ=Rotation_EQD_EQJ;
function Rotation_EQD_HOR(a,b){a=MakeTime(a);var c=Math.sin(b.latitude*exports.DEG2RAD),d=Math.cos(b.latitude*exports.DEG2RAD),e=Math.sin(b.longitude*exports.DEG2RAD),f=Math.cos(b.longitude*exports.DEG2RAD);b=[d*f,d*e,c];c=[-c*f,-c*e,d];e=[e,-f,0];a=-15*sidereal_time(a);b=spin(a,b);c=spin(a,c);a=spin(a,e);return new RotationMatrix([[c[0],a[0],b[0]],[c[1],a[1],b[1]],[c[2],a[2],b[2]]])}exports.Rotation_EQD_HOR=Rotation_EQD_HOR;
function Rotation_HOR_EQD(a,b){a=Rotation_EQD_HOR(a,b);return InverseRotation(a)}exports.Rotation_HOR_EQD=Rotation_HOR_EQD;function Rotation_HOR_EQJ(a,b){a=MakeTime(a);b=Rotation_HOR_EQD(a,b);a=Rotation_EQD_EQJ(a);return CombineRotation(b,a)}exports.Rotation_HOR_EQJ=Rotation_HOR_EQJ;function Rotation_EQJ_HOR(a,b){a=Rotation_HOR_EQJ(a,b);return InverseRotation(a)}exports.Rotation_EQJ_HOR=Rotation_EQJ_HOR;
function Rotation_EQD_ECL(a){a=Rotation_EQD_EQJ(a);var b=Rotation_EQJ_ECL();return CombineRotation(a,b)}exports.Rotation_EQD_ECL=Rotation_EQD_ECL;function Rotation_ECL_EQD(a){a=Rotation_EQD_ECL(a);return InverseRotation(a)}exports.Rotation_ECL_EQD=Rotation_ECL_EQD;function Rotation_ECL_HOR(a,b){a=MakeTime(a);var c=Rotation_ECL_EQD(a);a=Rotation_EQD_HOR(a,b);return CombineRotation(c,a)}exports.Rotation_ECL_HOR=Rotation_ECL_HOR;
function Rotation_HOR_ECL(a,b){a=Rotation_ECL_HOR(a,b);return InverseRotation(a)}exports.Rotation_HOR_ECL=Rotation_HOR_ECL;function Rotation_EQJ_GAL(){return new RotationMatrix([[-.0548624779711344,.4941095946388765,-.8676668813529025],[-.8734572784246782,-.4447938112296831,-.1980677870294097],[-.483800052994852,.7470034631630423,.4559861124470794]])}exports.Rotation_EQJ_GAL=Rotation_EQJ_GAL;
function Rotation_GAL_EQJ(){return new RotationMatrix([[-.0548624779711344,-.8734572784246782,-.483800052994852],[.4941095946388765,-.4447938112296831,.7470034631630423],[-.8676668813529025,-.1980677870294097,.4559861124470794]])}exports.Rotation_GAL_EQJ=Rotation_GAL_EQJ;function Rotation_ECT_EQD(a){var b=e_tilt(MakeTime(a)).tobl*exports.DEG2RAD;a=Math.cos(b);b=Math.sin(b);return new RotationMatrix([[1,0,0],[0,+a,+b],[0,-b,+a]])}exports.Rotation_ECT_EQD=Rotation_ECT_EQD;
function Rotation_EQD_ECT(a){var b=e_tilt(MakeTime(a)).tobl*exports.DEG2RAD;a=Math.cos(b);b=Math.sin(b);return new RotationMatrix([[1,0,0],[0,+a,-b],[0,+b,+a]])}exports.Rotation_EQD_ECT=Rotation_EQD_ECT;
var ConstelNames=[["And","Andromeda"],["Ant","Antila"],["Aps","Apus"],["Aql","Aquila"],["Aqr","Aquarius"],["Ara","Ara"],["Ari","Aries"],["Aur","Auriga"],["Boo","Bootes"],["Cae","Caelum"],["Cam","Camelopardis"],["Cap","Capricornus"],["Car","Carina"],["Cas","Cassiopeia"],["Cen","Centaurus"],["Cep","Cepheus"],["Cet","Cetus"],["Cha","Chamaeleon"],["Cir","Circinus"],["CMa","Canis Major"],["CMi","Canis Minor"],["Cnc","Cancer"],["Col","Columba"],["Com","Coma Berenices"],["CrA","Corona Australis"],["CrB",
"Corona Borealis"],["Crt","Crater"],["Cru","Crux"],["Crv","Corvus"],["CVn","Canes Venatici"],["Cyg","Cygnus"],["Del","Delphinus"],["Dor","Dorado"],["Dra","Draco"],["Equ","Equuleus"],["Eri","Eridanus"],["For","Fornax"],["Gem","Gemini"],["Gru","Grus"],["Her","Hercules"],["Hor","Horologium"],["Hya","Hydra"],["Hyi","Hydrus"],["Ind","Indus"],["Lac","Lacerta"],["Leo","Leo"],["Lep","Lepus"],["Lib","Libra"],["LMi","Leo Minor"],["Lup","Lupus"],["Lyn","Lynx"],["Lyr","Lyra"],["Men","Mensa"],["Mic","Microscopium"],
["Mon","Monoceros"],["Mus","Musca"],["Nor","Norma"],["Oct","Octans"],["Oph","Ophiuchus"],["Ori","Orion"],["Pav","Pavo"],["Peg","Pegasus"],["Per","Perseus"],["Phe","Phoenix"],["Pic","Pictor"],["PsA","Pisces Austrinus"],["Psc","Pisces"],["Pup","Puppis"],["Pyx","Pyxis"],["Ret","Reticulum"],["Scl","Sculptor"],["Sco","Scorpius"],["Sct","Scutum"],["Ser","Serpens"],["Sex","Sextans"],["Sge","Sagitta"],["Sgr","Sagittarius"],["Tau","Taurus"],["Tel","Telescopium"],["TrA","Triangulum Australe"],["Tri","Triangulum"],
["Tuc","Tucana"],["UMa","Ursa Major"],["UMi","Ursa Minor"],["Vel","Vela"],["Vir","Virgo"],["Vol","Volans"],["Vul","Vulpecula"]],ConstelBounds=[[83,0,8640,2112],[83,2880,5220,2076],[83,7560,8280,2068],[83,6480,7560,2064],[15,0,2880,2040],[10,3300,3840,1968],[15,0,1800,1920],[10,3840,5220,1920],[83,6300,6480,1920],[33,7260,7560,1920],[15,0,1263,1848],[10,4140,4890,1848],[83,5952,6300,1800],[15,7260,7440,1800],[10,2868,3300,1764],[33,3300,4080,1764],[83,4680,5952,1680],[13,1116,1230,1632],[33,7350,7440,
1608],[33,4080,4320,1596],[15,0,120,1584],[83,5040,5640,1584],[15,8490,8640,1584],[33,4320,4860,1536],[33,4860,5190,1512],[15,8340,8490,1512],[10,2196,2520,1488],[33,7200,7350,1476],[15,7393.2,7416,1462],[10,2520,2868,1440],[82,2868,3030,1440],[33,7116,7200,1428],[15,7200,7393.2,1428],[15,8232,8340,1418],[13,0,876,1404],[33,6990,7116,1392],[13,612,687,1380],[13,876,1116,1368],[10,1116,1140,1368],[15,8034,8232,1350],[10,1800,2196,1344],[82,5052,5190,1332],[33,5190,6990,1332],[10,1140,1200,1320],[15,
7968,8034,1320],[15,7416,7908,1316],[13,0,612,1296],[50,2196,2340,1296],[82,4350,4860,1272],[33,5490,5670,1272],[15,7908,7968,1266],[10,1200,1800,1260],[13,8232,8400,1260],[33,5670,6120,1236],[62,735,906,1212],[33,6120,6564,1212],[13,0,492,1200],[62,492,600,1200],[50,2340,2448,1200],[13,8400,8640,1200],[82,4860,5052,1164],[13,0,402,1152],[13,8490,8640,1152],[39,6543,6564,1140],[33,6564,6870,1140],[30,6870,6900,1140],[62,600,735,1128],[82,3030,3300,1128],[13,60,312,1104],[82,4320,4350,1080],[50,2448,
2652,1068],[30,7887,7908,1056],[30,7875,7887,1050],[30,6900,6984,1044],[82,3300,3660,1008],[82,3660,3882,960],[8,5556,5670,960],[39,5670,5880,960],[50,3330,3450,954],[0,0,906,882],[62,906,924,882],[51,6969,6984,876],[62,1620,1689,864],[30,7824,7875,864],[44,7875,7920,864],[7,2352,2652,852],[50,2652,2790,852],[0,0,720,840],[44,7920,8214,840],[44,8214,8232,828],[0,8232,8460,828],[62,924,978,816],[82,3882,3960,816],[29,4320,4440,816],[50,2790,3330,804],[48,3330,3558,804],[0,258,507,792],[8,5466,5556,
792],[0,8460,8550,770],[29,4440,4770,768],[0,8550,8640,752],[29,5025,5052,738],[80,870,978,736],[62,978,1620,736],[7,1620,1710,720],[51,6543,6969,720],[82,3960,4320,696],[30,7080,7530,696],[7,1710,2118,684],[48,3558,3780,684],[29,4770,5025,684],[0,0,24,672],[80,507,600,672],[7,2118,2352,672],[37,2838,2880,672],[30,7530,7824,672],[30,6933,7080,660],[80,690,870,654],[25,5820,5880,648],[8,5430,5466,624],[25,5466,5820,624],[51,6612,6792,624],[48,3870,3960,612],[51,6792,6933,612],[80,600,690,600],[66,
258,306,570],[48,3780,3870,564],[87,7650,7710,564],[77,2052,2118,548],[0,24,51,528],[73,5730,5772,528],[37,2118,2238,516],[87,7140,7290,510],[87,6792,6930,506],[0,51,306,504],[87,7290,7404,492],[37,2811,2838,480],[87,7404,7650,468],[87,6930,7140,460],[6,1182,1212,456],[75,6792,6840,444],[59,2052,2076,432],[37,2238,2271,420],[75,6840,7140,388],[77,1788,1920,384],[39,5730,5790,384],[75,7140,7290,378],[77,1662,1788,372],[77,1920,2016,372],[23,4620,4860,360],[39,6210,6570,344],[23,4272,4620,336],[37,
2700,2811,324],[39,6030,6210,308],[61,0,51,300],[77,2016,2076,300],[37,2520,2700,300],[61,7602,7680,300],[37,2271,2496,288],[39,6570,6792,288],[31,7515,7578,284],[61,7578,7602,284],[45,4146,4272,264],[59,2247,2271,240],[37,2496,2520,240],[21,2811,2853,240],[61,8580,8640,240],[6,600,1182,238],[31,7251,7308,204],[8,4860,5430,192],[61,8190,8580,180],[21,2853,3330,168],[45,3330,3870,168],[58,6570,6718.4,150],[3,6718.4,6792,150],[31,7500,7515,144],[20,2520,2526,132],[73,6570,6633,108],[39,5790,6030,96],
[58,6570,6633,72],[61,7728,7800,66],[66,0,720,48],[73,6690,6792,48],[31,7308,7500,48],[34,7500,7680,48],[61,7680,7728,48],[61,7920,8190,48],[61,7800,7920,42],[20,2526,2592,36],[77,1290,1662,0],[59,1662,1680,0],[20,2592,2910,0],[85,5280,5430,0],[58,6420,6570,0],[16,954,1182,-42],[77,1182,1290,-42],[73,5430,5856,-78],[59,1680,1830,-96],[59,2100,2247,-96],[73,6420,6468,-96],[73,6570,6690,-96],[3,6690,6792,-96],[66,8190,8580,-96],[45,3870,4146,-144],[85,4146,4260,-144],[66,0,120,-168],[66,8580,8640,-168],
[85,5130,5280,-192],[58,5730,5856,-192],[3,7200,7392,-216],[4,7680,7872,-216],[58,6180,6468,-240],[54,2100,2910,-264],[35,1770,1830,-264],[59,1830,2100,-264],[41,2910,3012,-264],[74,3450,3870,-264],[85,4260,4620,-264],[58,6330,6360,-280],[3,6792,7200,-288.8],[35,1740,1770,-348],[4,7392,7680,-360],[73,6180,6570,-384],[72,6570,6792,-384],[41,3012,3090,-408],[58,5856,5895,-438],[41,3090,3270,-456],[26,3870,3900,-456],[71,5856,5895,-462],[47,5640,5730,-480],[28,4530,4620,-528],[85,4620,5130,-528],[41,
3270,3510,-576],[16,600,954,-585.2],[35,954,1350,-585.2],[26,3900,4260,-588],[28,4260,4530,-588],[47,5130,5370,-588],[58,5856,6030,-590],[16,0,600,-612],[11,7680,7872,-612],[4,7872,8580,-612],[16,8580,8640,-612],[41,3510,3690,-636],[35,1692,1740,-654],[46,1740,2202,-654],[11,7200,7680,-672],[41,3690,3810,-700],[41,4530,5370,-708],[47,5370,5640,-708],[71,5640,5760,-708],[35,1650,1692,-720],[58,6030,6336,-720],[76,6336,6420,-720],[41,3810,3900,-748],[19,2202,2652,-792],[41,4410,4530,-792],[41,3900,
4410,-840],[36,1260,1350,-864],[68,3012,3372,-882],[35,1536,1650,-888],[76,6420,6900,-888],[65,7680,8280,-888],[70,8280,8400,-888],[36,1080,1260,-950],[1,3372,3960,-954],[70,0,600,-960],[36,600,1080,-960],[35,1392,1536,-960],[70,8400,8640,-960],[14,5100,5370,-1008],[49,5640,5760,-1008],[71,5760,5911.5,-1008],[9,1740,1800,-1032],[22,1800,2370,-1032],[67,2880,3012,-1032],[35,1230,1392,-1056],[71,5911.5,6420,-1092],[24,6420,6900,-1092],[76,6900,7320,-1092],[53,7320,7680,-1092],[35,1080,1230,-1104],[9,
1620,1740,-1116],[49,5520,5640,-1152],[63,0,840,-1156],[35,960,1080,-1176],[40,1470,1536,-1176],[9,1536,1620,-1176],[38,7680,7920,-1200],[67,2160,2880,-1218],[84,2880,2940,-1218],[35,870,960,-1224],[40,1380,1470,-1224],[63,0,660,-1236],[12,2160,2220,-1260],[84,2940,3042,-1272],[40,1260,1380,-1276],[32,1380,1440,-1276],[63,0,570,-1284],[35,780,870,-1296],[64,1620,1800,-1296],[49,5418,5520,-1296],[84,3042,3180,-1308],[12,2220,2340,-1320],[14,4260,4620,-1320],[49,5100,5418,-1320],[56,5418,5520,-1320],
[32,1440,1560,-1356],[84,3180,3960,-1356],[14,3960,4050,-1356],[5,6300,6480,-1368],[78,6480,7320,-1368],[38,7920,8400,-1368],[40,1152,1260,-1380],[64,1800,1980,-1380],[12,2340,2460,-1392],[63,0,480,-1404],[35,480,780,-1404],[63,8400,8640,-1404],[32,1560,1650,-1416],[56,5520,5911.5,-1440],[43,7320,7680,-1440],[64,1980,2160,-1464],[18,5460,5520,-1464],[5,5911.5,5970,-1464],[18,5370,5460,-1526],[5,5970,6030,-1526],[64,2160,2460,-1536],[12,2460,3252,-1536],[14,4050,4260,-1536],[27,4260,4620,-1536],[14,
4620,5232,-1536],[18,4860,4920,-1560],[5,6030,6060,-1560],[40,780,1152,-1620],[69,1152,1650,-1620],[18,5310,5370,-1620],[5,6060,6300,-1620],[60,6300,6480,-1620],[81,7920,8400,-1620],[32,1650,2370,-1680],[18,4920,5310,-1680],[79,5310,6120,-1680],[81,0,480,-1800],[42,1260,1650,-1800],[86,2370,3252,-1800],[12,3252,4050,-1800],[55,4050,4920,-1800],[60,6480,7680,-1800],[43,7680,8400,-1800],[81,8400,8640,-1800],[81,270,480,-1824],[42,0,1260,-1980],[17,2760,4920,-1980],[2,4920,6480,-1980],[52,1260,2760,
-2040],[57,0,8640,-2160]],ConstelRot,Epoch2000,ConstellationInfo=function(a,b,c,d){this.symbol=a;this.name=b;this.ra1875=c;this.dec1875=d};exports.ConstellationInfo=ConstellationInfo;
function Constellation(a,b){VerifyNumber(a);VerifyNumber(b);if(-90>b||90<b)throw"Invalid declination angle. Must be -90..+90.";a%=24;0>a&&(a+=24);ConstelRot||(ConstelRot=Rotation_EQJ_EQD(new AstroTime(-45655.74141261017)),Epoch2000=new AstroTime(0));a=new Spherical(b,15*a,1);a=VectorFromSphere(a,Epoch2000);a=RotateVector(ConstelRot,a);a=EquatorFromVector(a);b=10/240;for(var c=b/15,d=$jscomp.makeIterator(ConstelBounds),e=d.next();!e.done;e=d.next()){e=e.value;var f=e[1]*c,g=e[2]*c;if(e[3]*b<=a.dec&&
f<=a.ra&&a.ra<g)return b=ConstelNames[e[0]],new ConstellationInfo(b[0],b[1],a.ra,a.dec)}throw"Unable to find constellation for given coordinates.";}exports.Constellation=Constellation;var EclipseKind;(function(a){a.Penumbral="penumbral";a.Partial="partial";a.Annular="annular";a.Total="total"})(EclipseKind=exports.EclipseKind||(exports.EclipseKind={}));var LunarEclipseInfo=function(a,b,c,d,e,f){this.kind=a;this.obscuration=b;this.peak=c;this.sd_penum=d;this.sd_partial=e;this.sd_total=f};
exports.LunarEclipseInfo=LunarEclipseInfo;var ShadowInfo=function(a,b,c,d,e,f,g){this.time=a;this.u=b;this.r=c;this.k=d;this.p=e;this.target=f;this.dir=g};function CalcShadow(a,b,c,d){var e=(d.x*c.x+d.y*c.y+d.z*c.z)/(d.x*d.x+d.y*d.y+d.z*d.z);return new ShadowInfo(b,e,exports.KM_PER_AU*Math.hypot(e*d.x-c.x,e*d.y-c.y,e*d.z-c.z),+SUN_RADIUS_KM-(1+e)*(SUN_RADIUS_KM-a),-SUN_RADIUS_KM+(1+e)*(SUN_RADIUS_KM+a),c,d)}
function EarthShadow(a){var b=GeoVector(Body.Sun,a,!0);b=new Vector(-b.x,-b.y,-b.z,b.t);var c=GeoMoon(a);return CalcShadow(EARTH_ECLIPSE_RADIUS_KM,a,c,b)}function MoonShadow(a){var b=GeoVector(Body.Sun,a,!0),c=GeoMoon(a),d=new Vector(-c.x,-c.y,-c.z,c.t);c.x-=b.x;c.y-=b.y;c.z-=b.z;return CalcShadow(MOON_MEAN_RADIUS_KM,a,d,c)}
function LocalMoonShadow(a,b){var c=geo_pos(a,b);b=GeoVector(Body.Sun,a,!0);var d=GeoMoon(a);c=new Vector(c[0]-d.x,c[1]-d.y,c[2]-d.z,a);d.x-=b.x;d.y-=b.y;d.z-=b.z;return CalcShadow(MOON_MEAN_RADIUS_KM,a,c,d)}function PlanetShadow(a,b,c){a=GeoVector(a,c,!0);var d=GeoVector(Body.Sun,c,!0),e=new Vector(a.x-d.x,a.y-d.y,a.z-d.z,c);d.x=-a.x;d.y=-a.y;d.z=-a.z;return CalcShadow(b,c,d,e)}function ShadowDistanceSlope(a,b){var c=1/86400,d=b.AddDays(-c);b=b.AddDays(+c);d=a(d);return(a(b).r-d.r)/c}
function PlanetShadowSlope(a,b,c){var d=1/86400,e=PlanetShadow(a,b,c.AddDays(-d));return(PlanetShadow(a,b,c.AddDays(+d)).r-e.r)/d}function PeakEarthShadow(a){var b=a.AddDays(-.03);a=a.AddDays(.03);b=Search(function(c){return ShadowDistanceSlope(EarthShadow,c)},b,a);if(!b)throw"Failed to find peak Earth shadow time.";return EarthShadow(b)}
function PeakMoonShadow(a){var b=a.AddDays(-.03);a=a.AddDays(.03);b=Search(function(c){return ShadowDistanceSlope(MoonShadow,c)},b,a);if(!b)throw"Failed to find peak Moon shadow time.";return MoonShadow(b)}function PeakPlanetShadow(a,b,c){var d=c.AddDays(-1);c=c.AddDays(1);d=Search(function(e){return PlanetShadowSlope(a,b,e)},d,c);if(!d)throw"Failed to find peak planet shadow time.";return PlanetShadow(a,b,d)}
function PeakLocalMoonShadow(a,b){function c(f){return LocalMoonShadow(f,b)}var d=a.AddDays(-.2),e=a.AddDays(.2);d=Search(function(f){return ShadowDistanceSlope(c,f)},d,e);if(!d)throw"PeakLocalMoonShadow: search failure for search_center_time = "+a;return LocalMoonShadow(d,b)}
function ShadowSemiDurationMinutes(a,b,c){var d=c/1440;c=a.AddDays(-d);d=a.AddDays(+d);c=Search(function(e){return-(EarthShadow(e).r-b)},c,a);a=Search(function(e){return+(EarthShadow(e).r-b)},a,d);if(!c||!a)throw"Failed to find shadow semiduration";return 720*(a.ut-c.ut)}function MoonEclipticLatitudeDegrees(a){a=CalcMoon(a);return exports.RAD2DEG*a.geo_eclip_lat}
function Obscuration(a,b,c){if(0>=a)throw"Radius of first disc must be positive.";if(0>=b)throw"Radius of second disc must be positive.";if(0>c)throw"Distance between discs is not allowed to be negative.";if(c>=a+b)return 0;if(0==c)return a<=b?1:b*b/(a*a);var d=(a*a-b*b+c*c)/(2*c),e=a*a-d*d;if(0>=e)return a<=b?1:b*b/(a*a);e=Math.sqrt(e);return(a*a*Math.acos(d/a)-d*e+(b*b*Math.acos((c-d)/b)-(c-d)*e))/(Math.PI*a*a)}
function SolarEclipseObscuration(a,b){var c=new Vector(a.x+b.x,a.y+b.y,a.z+b.z,a.t);a=Math.asin(SUN_RADIUS_AU/c.Length());var d=Math.asin(MOON_POLAR_RADIUS_AU/b.Length());b=AngleBetween(b,c);b=Obscuration(a,d,b*exports.DEG2RAD);return Math.min(.9999,b)}
function SearchLunarEclipse(a){a=MakeTime(a);for(var b=0;12>b;++b){var c=SearchMoonPhase(180,a,40);if(!c)throw"Cannot find full moon.";a=MoonEclipticLatitudeDegrees(c);if(1.8>Math.abs(a)&&(a=PeakEarthShadow(c),a.r<a.p+MOON_MEAN_RADIUS_KM)){b=EclipseKind.Penumbral;var d=c=0,e=0,f=ShadowSemiDurationMinutes(a.time,a.p+MOON_MEAN_RADIUS_KM,200);a.r<a.k+MOON_MEAN_RADIUS_KM&&(b=EclipseKind.Partial,e=ShadowSemiDurationMinutes(a.time,a.k+MOON_MEAN_RADIUS_KM,f),a.r+MOON_MEAN_RADIUS_KM<a.k?(b=EclipseKind.Total,
c=1,d=ShadowSemiDurationMinutes(a.time,a.k-MOON_MEAN_RADIUS_KM,e)):c=Obscuration(MOON_MEAN_RADIUS_KM,a.k,a.r));return new LunarEclipseInfo(b,c,a.time,f,e,d)}a=c.AddDays(10)}throw"Failed to find lunar eclipse within 12 full moons.";}exports.SearchLunarEclipse=SearchLunarEclipse;var GlobalSolarEclipseInfo=function(a,b,c,d,e,f){this.kind=a;this.obscuration=b;this.peak=c;this.distance=d;this.latitude=e;this.longitude=f};exports.GlobalSolarEclipseInfo=GlobalSolarEclipseInfo;
function EclipseKindFromUmbra(a){return.014<a?EclipseKind.Total:EclipseKind.Annular}
function GeoidIntersect(a){var b=EclipseKind.Partial,c=a.time,d=a.r,e=Rotation_EQJ_EQD(a.time),f=RotateVector(e,a.dir),g=RotateVector(e,a.target);f.x*=exports.KM_PER_AU;f.y*=exports.KM_PER_AU;f.z*=exports.KM_PER_AU/EARTH_FLATTENING;g.x*=exports.KM_PER_AU;g.y*=exports.KM_PER_AU;g.z*=exports.KM_PER_AU/EARTH_FLATTENING;var k=EARTH_EQUATORIAL_RADIUS_KM,h=f.x*f.x+f.y*f.y+f.z*f.z,l=-2*(f.x*g.x+f.y*g.y+f.z*g.z);k=l*l-4*h*(g.x*g.x+g.y*g.y+g.z*g.z-k*k);if(0<k){var m=(-l-Math.sqrt(k))/(2*h);b=m*f.x-g.x;h=m*
f.y-g.y;f=(m*f.z-g.z)*EARTH_FLATTENING;m=Math.hypot(b,h)*EARTH_FLATTENING_SQUARED;m=0==m?0<f?90:-90:exports.RAD2DEG*Math.atan(f/m);var n=sidereal_time(c);n=(exports.RAD2DEG*Math.atan2(h,b)-15*n)%360;-180>=n?n+=360:180<n&&(n-=360);e=InverseRotation(e);f=new Vector(b/exports.KM_PER_AU,h/exports.KM_PER_AU,f/exports.KM_PER_AU,a.time);f=RotateVector(e,f);f.x+=a.target.x;f.y+=a.target.y;f.z+=a.target.z;e=CalcShadow(MOON_POLAR_RADIUS_KM,a.time,f,a.dir);if(1E-9<e.r||0>e.r)throw"Unexpected shadow distance from geoid intersection = "+
e.r;b=EclipseKindFromUmbra(e.k);a=b===EclipseKind.Total?1:SolarEclipseObscuration(a.dir,f)}else a=void 0;return new GlobalSolarEclipseInfo(b,a,c,d,m,n)}function NextLunarEclipse(a){a=MakeTime(a);a=a.AddDays(10);return SearchLunarEclipse(a)}exports.NextLunarEclipse=NextLunarEclipse;
function SearchGlobalSolarEclipse(a){var b=a=MakeTime(a);for(a=0;12>a;++a){b=SearchMoonPhase(0,b,40);if(!b)throw"Cannot find new moon";var c=MoonEclipticLatitudeDegrees(b);if(1.8>Math.abs(c)&&(c=PeakMoonShadow(b),c.r<c.p+EARTH_MEAN_RADIUS_KM))return GeoidIntersect(c);b=b.AddDays(10)}throw"Failed to find solar eclipse within 12 full moons.";}exports.SearchGlobalSolarEclipse=SearchGlobalSolarEclipse;
function NextGlobalSolarEclipse(a){a=MakeTime(a);a=a.AddDays(10);return SearchGlobalSolarEclipse(a)}exports.NextGlobalSolarEclipse=NextGlobalSolarEclipse;var EclipseEvent=function(a,b){this.time=a;this.altitude=b};exports.EclipseEvent=EclipseEvent;var LocalSolarEclipseInfo=function(a,b,c,d,e,f,g){this.kind=a;this.obscuration=b;this.partial_begin=c;this.total_begin=d;this.peak=e;this.total_end=f;this.partial_end=g};exports.LocalSolarEclipseInfo=LocalSolarEclipseInfo;
function local_partial_distance(a){return a.p-a.r}function local_total_distance(a){return Math.abs(a.k)-a.r}
function LocalEclipse(a,b){var c=CalcEvent(b,a.time),d=a.time.AddDays(-.2),e=a.time.AddDays(.2),f=LocalEclipseTransition(b,1,local_partial_distance,d,a.time),g=LocalEclipseTransition(b,-1,local_partial_distance,a.time,e);if(a.r<Math.abs(a.k)){d=a.time.AddDays(-.01);e=a.time.AddDays(.01);var k=LocalEclipseTransition(b,1,local_total_distance,d,a.time);var h=LocalEclipseTransition(b,-1,local_total_distance,a.time,e);b=EclipseKindFromUmbra(a.k)}else b=EclipseKind.Partial;a=b===EclipseKind.Total?1:SolarEclipseObscuration(a.dir,
a.target);return new LocalSolarEclipseInfo(b,a,f,k,c,h,g)}function LocalEclipseTransition(a,b,c,d,e){d=Search(function(f){f=LocalMoonShadow(f,a);return b*c(f)},d,e);if(!d)throw"Local eclipse transition search failed.";return CalcEvent(a,d)}function CalcEvent(a,b){a=SunAltitude(b,a);return new EclipseEvent(b,a)}function SunAltitude(a,b){var c=Equator(Body.Sun,a,b,!0,!0);return Horizon(a,b,c.ra,c.dec,"normal").altitude}
function SearchLocalSolarEclipse(a,b){a=MakeTime(a);for(VerifyObserver(b);;){a=SearchMoonPhase(0,a,40);if(!a)throw"Cannot find next new moon";var c=MoonEclipticLatitudeDegrees(a);if(1.8>Math.abs(c)&&(c=PeakLocalMoonShadow(a,b),c.r<c.p&&(c=LocalEclipse(c,b),0<c.partial_begin.altitude||0<c.partial_end.altitude)))return c;a=a.AddDays(10)}}exports.SearchLocalSolarEclipse=SearchLocalSolarEclipse;function NextLocalSolarEclipse(a,b){a=MakeTime(a);a=a.AddDays(10);return SearchLocalSolarEclipse(a,b)}
exports.NextLocalSolarEclipse=NextLocalSolarEclipse;var TransitInfo=function(a,b,c,d){this.start=a;this.peak=b;this.finish=c;this.separation=d};exports.TransitInfo=TransitInfo;function PlanetShadowBoundary(a,b,c,d){a=PlanetShadow(b,c,a);return d*(a.r-a.p)}function PlanetTransitBoundary(a,b,c,d,e){c=Search(function(f){return PlanetShadowBoundary(f,a,b,e)},c,d);if(!c)throw"Planet transit boundary search failed";return c}
function SearchTransit(a,b){b=MakeTime(b);switch(a){case Body.Mercury:var c=2439.7;break;case Body.Venus:c=6051.8;break;default:throw"Invalid body: "+a;}for(;;){var d=SearchRelativeLongitude(a,0,b);if(.4>AngleFromSun(a,d)&&(b=PeakPlanetShadow(a,c,d),b.r<b.p)){d=b.time.AddDays(-1);d=PlanetTransitBoundary(a,c,d,b.time,-1);var e=b.time.AddDays(1);c=PlanetTransitBoundary(a,c,b.time,e,1);a=60*AngleFromSun(a,b.time);return new TransitInfo(d,b.time,c,a)}b=d.AddDays(10)}}exports.SearchTransit=SearchTransit;
function NextTransit(a,b){b=MakeTime(b);b=b.AddDays(100);return SearchTransit(a,b)}exports.NextTransit=NextTransit;var NodeEventKind;(function(a){a[a.Invalid=0]="Invalid";a[a.Ascending=1]="Ascending";a[a.Descending=-1]="Descending"})(NodeEventKind=exports.NodeEventKind||(exports.NodeEventKind={}));var NodeEventInfo=function(a,b){this.kind=a;this.time=b};exports.NodeEventInfo=NodeEventInfo;var MoonNodeStepDays=10;
function SearchMoonNode(a){var b=MakeTime(a),c=EclipticGeoMoon(b);for(a={};;a={$jscomp$loop$prop$kind$33:a.$jscomp$loop$prop$kind$33}){var d=b.AddDays(MoonNodeStepDays),e=EclipticGeoMoon(d);if(0>=c.lat*e.lat){a.$jscomp$loop$prop$kind$33=e.lat>c.lat?NodeEventKind.Ascending:NodeEventKind.Descending;b=Search(function(f){return function(g){return f.$jscomp$loop$prop$kind$33*EclipticGeoMoon(g).lat}}(a),b,d);if(!b)throw"Could not find moon node.";return new NodeEventInfo(a.$jscomp$loop$prop$kind$33,b)}b=
d;c=e}}exports.SearchMoonNode=SearchMoonNode;
function NextMoonNode(a){var b=a.time.AddDays(MoonNodeStepDays);b=SearchMoonNode(b);switch(a.kind){case NodeEventKind.Ascending:if(b.kind!==NodeEventKind.Descending)throw"Internal error: previous node was ascending, but this node was: "+b.kind;break;case NodeEventKind.Descending:if(b.kind!==NodeEventKind.Ascending)throw"Internal error: previous node was descending, but this node was: "+b.kind;break;default:throw"Previous node has an invalid node kind: "+a.kind;}return b}exports.NextMoonNode=NextMoonNode;
var AxisInfo=function(a,b,c,d){this.ra=a;this.dec=b;this.spin=c;this.north=d};exports.AxisInfo=AxisInfo;function EarthRotationAxis(a){var b=nutation([0,0,1],a,PrecessDirection.Into2000);b=precession(b,a,PrecessDirection.Into2000);b=new Vector(b[0],b[1],b[2],a);var c=EquatorFromVector(b);return new AxisInfo(c.ra,c.dec,190.41375788700253+360.9856122880876*a.ut,b)}
function RotationAxis(a,b){b=MakeTime(b);var c=b.tt,d=c/36525;switch(a){case Body.Sun:a=286.13;var e=63.87;c=84.176+14.1844*c;break;case Body.Mercury:a=281.0103-.0328*d;e=61.4155-.0049*d;c=329.5988+6.1385108*c+.01067257*Math.sin(exports.DEG2RAD*(174.7910857+4.092335*c))-.00112309*Math.sin(exports.DEG2RAD*(349.5821714+8.18467*c))-1.104E-4*Math.sin(exports.DEG2RAD*(164.3732571+12.277005*c))-2.539E-5*Math.sin(exports.DEG2RAD*(339.1643429+16.36934*c))-5.71E-6*Math.sin(exports.DEG2RAD*(153.9554286+20.461675*
c));break;case Body.Venus:a=272.76;e=67.16;c=160.2-1.4813688*c;break;case Body.Earth:return EarthRotationAxis(b);case Body.Moon:var f=exports.DEG2RAD*(125.045-.0529921*c),g=exports.DEG2RAD*(250.089-.1059842*c),k=exports.DEG2RAD*(260.008+13.0120009*c),h=exports.DEG2RAD*(176.625+13.3407154*c),l=exports.DEG2RAD*(357.529+.9856003*c),m=exports.DEG2RAD*(311.589+26.4057084*c),n=exports.DEG2RAD*(134.963+13.064993*c),p=exports.DEG2RAD*(276.617+.3287146*c),r=exports.DEG2RAD*(34.226+1.7484877*c),q=exports.DEG2RAD*
(15.134-.1589763*c),t=exports.DEG2RAD*(119.743+.0036096*c),H=exports.DEG2RAD*(239.961+.1643573*c),F=exports.DEG2RAD*(25.053+12.9590088*c);a=269.9949+.0031*d-3.8787*Math.sin(f)-.1204*Math.sin(g)+.07*Math.sin(k)-.0172*Math.sin(h)+.0072*Math.sin(m)-.0052*Math.sin(q)+.0043*Math.sin(F);e=66.5392+.013*d+1.5419*Math.cos(f)+.0239*Math.cos(g)-.0278*Math.cos(k)+.0068*Math.cos(h)-.0029*Math.cos(m)+9E-4*Math.cos(n)+8E-4*Math.cos(q)-9E-4*Math.cos(F);c=38.3213+(13.17635815-1.4E-12*c)*c+3.561*Math.sin(f)+.1208*
Math.sin(g)-.0642*Math.sin(k)+.0158*Math.sin(h)+.0252*Math.sin(l)-.0066*Math.sin(m)-.0047*Math.sin(n)-.0046*Math.sin(p)+.0028*Math.sin(r)+.0052*Math.sin(q)+.004*Math.sin(t)+.0019*Math.sin(H)-.0044*Math.sin(F);break;case Body.Mars:a=317.269202-.10927547*d+6.8E-5*Math.sin(exports.DEG2RAD*(198.991226+19139.4819985*d))+2.38E-4*Math.sin(exports.DEG2RAD*(226.292679+38280.8511281*d))+5.2E-5*Math.sin(exports.DEG2RAD*(249.663391+57420.7251593*d))+9E-6*Math.sin(exports.DEG2RAD*(266.18351+76560.636795*d))+.419057*
Math.sin(exports.DEG2RAD*(79.398797+.5042615*d));e=54.432516-.05827105*d+5.1E-5*Math.cos(exports.DEG2RAD*(122.433576+19139.9407476*d))+1.41E-4*Math.cos(exports.DEG2RAD*(43.058401+38280.8753272*d))+3.1E-5*Math.cos(exports.DEG2RAD*(57.663379+57420.7517205*d))+5E-6*Math.cos(exports.DEG2RAD*(79.476401+76560.6495004*d))+1.591274*Math.cos(exports.DEG2RAD*(166.325722+.5042615*d));c=176.049863+350.891982443297*c+1.45E-4*Math.sin(exports.DEG2RAD*(129.071773+19140.0328244*d))+1.57E-4*Math.sin(exports.DEG2RAD*
(36.352167+38281.0473591*d))+4E-5*Math.sin(exports.DEG2RAD*(56.668646+57420.929536*d))+1E-6*Math.sin(exports.DEG2RAD*(67.364003+76560.2552215*d))+1E-6*Math.sin(exports.DEG2RAD*(104.79268+95700.4387578*d))+.584542*Math.sin(exports.DEG2RAD*(95.391654+.5042615*d));break;case Body.Jupiter:e=exports.DEG2RAD*(99.360714+4850.4046*d);f=exports.DEG2RAD*(175.895369+1191.9605*d);g=exports.DEG2RAD*(300.323162+262.5475*d);k=exports.DEG2RAD*(114.012305+6070.2476*d);h=exports.DEG2RAD*(49.511251+64.3*d);a=268.056595-
.006499*d+1.17E-4*Math.sin(e)+9.38E-4*Math.sin(f)+.001432*Math.sin(g)+3E-5*Math.sin(k)+.00215*Math.sin(h);e=64.495303+.002413*d+5E-5*Math.cos(e)+4.04E-4*Math.cos(f)+6.17E-4*Math.cos(g)-1.3E-5*Math.cos(k)+9.26E-4*Math.cos(h);c=284.95+870.536*c;break;case Body.Saturn:a=40.589-.036*d;e=83.537-.004*d;c=38.9+810.7939024*c;break;case Body.Uranus:a=257.311;e=-15.175;c=203.81-501.1600928*c;break;case Body.Neptune:d=exports.DEG2RAD*(357.85+52.316*d);a=299.36+.7*Math.sin(d);e=43.46-.51*Math.cos(d);c=249.978+
541.1397757*c-.48*Math.sin(d);break;case Body.Pluto:a=132.993;e=-6.163;c=302.695+56.3625225*c;break;default:throw"Invalid body: "+a;}d=e*exports.DEG2RAD;f=a*exports.DEG2RAD;g=Math.cos(d);b=new Vector(g*Math.cos(f),g*Math.sin(f),Math.sin(d),b);return new AxisInfo(a/15,e,c,b)}exports.RotationAxis=RotationAxis;
function LagrangePoint(a,b,c,d){var e=MakeTime(b);b=MassProduct(c);var f=MassProduct(d);c===Body.Earth&&d===Body.Moon?(c=new StateVector(0,0,0,0,0,0,e),d=GeoMoonState(e)):(c=HelioState(c,e),d=HelioState(d,e));return LagrangePointFast(a,c,b,d,f)}exports.LagrangePoint=LagrangePoint;
function LagrangePointFast(a,b,c,d,e){if(1>a||5<a)throw"Invalid lagrange point "+a;if(!Number.isFinite(c)||0>=c)throw"Major mass must be a positive number.";if(!Number.isFinite(e)||0>=e)throw"Minor mass must be a negative number.";var f=d.x-b.x,g=d.y-b.y,k=d.z-b.z,h=f*f+g*g+k*k,l=Math.sqrt(h),m=d.vx-b.vx,n=d.vy-b.vy;d=d.vz-b.vz;if(4===a||5===a){h=g*d-k*n;c=k*m-f*d;var p=f*n-g*m,r=c*k-p*g;p=p*f-h*k;h=h*g-c*f;c=Math.sqrt(r*r+p*p+h*h);r/=c;p/=c;h/=c;f/=l;g/=l;k/=l;a=4==a?.8660254037844386:-.8660254037844386;
c=.5*f+a*r;e=.5*g+a*p;var q=.5*k+a*h,t=m*f+n*g+d*k;m=m*r+n*p+d*h;b=new StateVector(l*c,l*e,l*q,t*c+m*(.5*r-a*f),t*e+m*(.5*p-a*g),t*q+m*(.5*h-a*k),b.t)}else{r=e/(c+e)*-l;p=c/(c+e)*+l;h=(c+e)/(h*l);if(1===a||2===a)q=c/(c+e)*Math.cbrt(e/(3*c)),c=-c,1==a?(q=1-q,a=+e):(q=1+q,a=-e);else if(3===a)q=(7/12*e-c)/(e+c),c=+c,a=+e;else throw"Invalid Langrage point "+a+". Must be an integer 1..5.";e=l*q-r;do q=e-r,t=e-p,q=(h*e+c/(q*q)+a/(t*t))/(h-2*c/(q*q*q)-2*a/(t*t*t)),e-=q;while(1E-14<Math.abs(q/l));q=(e-r)/
l;b=new StateVector(q*f,q*g,q*k,q*m,q*n,q*d,b.t)}return b}exports.LagrangePointFast=LagrangePointFast;
var GravitySimulator=function(a,b,c){b=MakeTime(b);this.originBody=a;for(var d=$jscomp.makeIterator(c),e=d.next();!e.done;e=d.next())if(e.value.t.tt!==b.tt)throw"Inconsistent times in bodyStates";d=[];e=GravitySimulator.CalcSolarSystem(b);this.curr=new GravSimEndpoint(b,e,d);a=this.InternalBodyState(a);c=$jscomp.makeIterator(c);for(e=c.next();!e.done;e=c.next()){var f=e.value;e=new TerseVector(f.x+a.r.x,f.y+a.r.y,f.z+a.r.z);f=new TerseVector(f.vx+a.v.x,f.vy+a.v.y,f.vz+a.v.z);var g=TerseVector.zero();
d.push(new body_grav_calc_t(b.tt,e,f,g))}this.CalcBodyAccelerations();this.prev=this.Duplicate()};
GravitySimulator.prototype.Update=function(a){a=MakeTime(a);var b=a.tt-this.curr.time.tt;if(0===b)this.prev=this.Duplicate();else{this.Swap();this.curr.time=a;this.curr.gravitators=GravitySimulator.CalcSolarSystem(a);for(var c=0;c<this.curr.bodies.length;++c){var d=this.prev.bodies[c];this.curr.bodies[c].r=UpdatePosition(b,d.r,d.v,d.a)}this.CalcBodyAccelerations();for(c=0;c<this.curr.bodies.length;++c){d=this.prev.bodies[c];var e=this.curr.bodies[c],f=d.a.mean(e.a);e.tt=a.tt;e.r=UpdatePosition(b,
d.r,d.v,f);e.v=UpdateVelocity(b,d.v,f)}this.CalcBodyAccelerations()}b=[];c=this.InternalBodyState(this.originBody);d=$jscomp.makeIterator(this.curr.bodies);for(e=d.next();!e.done;e=d.next())e=e.value,b.push(new StateVector(e.r.x-c.r.x,e.r.y-c.r.y,e.r.z-c.r.z,e.v.x-c.v.x,e.v.y-c.v.y,e.v.z-c.v.z,a));return b};GravitySimulator.prototype.Swap=function(){var a=this.curr;this.curr=this.prev;this.prev=a};
GravitySimulator.prototype.SolarSystemBodyState=function(a){a=this.InternalBodyState(a);var b=this.InternalBodyState(this.originBody);return ExportState(a.sub(b),this.curr.time)};GravitySimulator.prototype.InternalBodyState=function(a){if(a===Body.SSB)return new body_state_t(this.curr.time.tt,TerseVector.zero(),TerseVector.zero());var b=this.curr.gravitators[a];if(b)return b;throw"Invalid body: "+a;};
GravitySimulator.CalcSolarSystem=function(a){var b={},c=new body_state_t(a.tt,TerseVector.zero(),TerseVector.zero());b[Body.Mercury]=AdjustBarycenterPosVel(c,a.tt,Body.Mercury,MERCURY_GM);b[Body.Venus]=AdjustBarycenterPosVel(c,a.tt,Body.Venus,VENUS_GM);b[Body.Earth]=AdjustBarycenterPosVel(c,a.tt,Body.Earth,EARTH_GM+MOON_GM);b[Body.Mars]=AdjustBarycenterPosVel(c,a.tt,Body.Mars,MARS_GM);b[Body.Jupiter]=AdjustBarycenterPosVel(c,a.tt,Body.Jupiter,JUPITER_GM);b[Body.Saturn]=AdjustBarycenterPosVel(c,a.tt,
Body.Saturn,SATURN_GM);b[Body.Uranus]=AdjustBarycenterPosVel(c,a.tt,Body.Uranus,URANUS_GM);b[Body.Neptune]=AdjustBarycenterPosVel(c,a.tt,Body.Neptune,NEPTUNE_GM);for(var d in b)b[d].r.decr(c.r),b[d].v.decr(c.v);b[Body.Sun]=new body_state_t(a.tt,c.r.neg(),c.v.neg());return b};
GravitySimulator.prototype.CalcBodyAccelerations=function(){for(var a=$jscomp.makeIterator(this.curr.bodies),b=a.next();!b.done;b=a.next())b=b.value,b.a=TerseVector.zero(),GravitySimulator.AddAcceleration(b.a,b.r,this.curr.gravitators[Body.Sun].r,SUN_GM),GravitySimulator.AddAcceleration(b.a,b.r,this.curr.gravitators[Body.Mercury].r,MERCURY_GM),GravitySimulator.AddAcceleration(b.a,b.r,this.curr.gravitators[Body.Venus].r,VENUS_GM),GravitySimulator.AddAcceleration(b.a,b.r,this.curr.gravitators[Body.Earth].r,
EARTH_GM+MOON_GM),GravitySimulator.AddAcceleration(b.a,b.r,this.curr.gravitators[Body.Mars].r,MARS_GM),GravitySimulator.AddAcceleration(b.a,b.r,this.curr.gravitators[Body.Jupiter].r,JUPITER_GM),GravitySimulator.AddAcceleration(b.a,b.r,this.curr.gravitators[Body.Saturn].r,SATURN_GM),GravitySimulator.AddAcceleration(b.a,b.r,this.curr.gravitators[Body.Uranus].r,URANUS_GM),GravitySimulator.AddAcceleration(b.a,b.r,this.curr.gravitators[Body.Neptune].r,NEPTUNE_GM)};
GravitySimulator.AddAcceleration=function(a,b,c,d){var e=c.x-b.x,f=c.y-b.y;b=c.z-b.z;c=e*e+f*f+b*b;d/=c*Math.sqrt(c);a.x+=e*d;a.y+=f*d;a.z+=b*d};GravitySimulator.prototype.Duplicate=function(){var a={};for(b in this.curr.gravitators)a[b]=this.curr.gravitators[b].clone();var b=[];for(var c=$jscomp.makeIterator(this.curr.bodies),d=c.next();!d.done;d=c.next())b.push(d.value.clone());return new GravSimEndpoint(this.curr.time,a,b)};
$jscomp.global.Object.defineProperties(GravitySimulator.prototype,{OriginBody:{configurable:!0,enumerable:!0,get:function(){return this.originBody}},Time:{configurable:!0,enumerable:!0,get:function(){return this.curr.time}}});exports.GravitySimulator=GravitySimulator;var GravSimEndpoint=function(a,b,c){this.time=a;this.gravitators=b;this.bodies=c};
+9674
View File
File diff suppressed because it is too large Load Diff
+50
View File
@@ -0,0 +1,50 @@
{
"name": "astronomy-engine",
"version": "2.1.19",
"description": "Astronomy calculation for Sun, Moon, and planets.",
"author": "Donald Cross",
"license": "MIT",
"homepage": "https://github.com/cosinekitty/astronomy#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/cosinekitty/astronomy.git"
},
"bugs": {
"url": "https://github.com/cosinekitty/astronomy/issues"
},
"keywords": [
"astronomy",
"ephemeris",
"planet",
"sun",
"moon",
"solar",
"system",
"sunrise",
"sunset",
"equinox",
"solstice",
"constellation",
"orbit"
],
"scripts": {},
"files": [
"esm/astronomy.js",
"astronomy.d.ts",
"astronomy.js",
"astronomy.min.js",
"astronomy.browser.js",
"astronomy.browser.min.js"
],
"exports": {
".": {
"require": "./astronomy.js",
"import": "./esm/astronomy.js",
"types": "./astronomy.d.ts"
}
},
"main": "./astronomy.js",
"module": "./esm/astronomy.js",
"types": "./astronomy.d.ts",
"sideEffects": false
}
+176
View File
@@ -0,0 +1,176 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
+21
View File
@@ -0,0 +1,21 @@
.PHONY: test release
_MOCHA=node_modules/.bin/_mocha
test:
npm run test-ci
release: test
ifeq ($(strip $(version)),)
@echo "\033[31mERROR:\033[0;39m No version provided"
@echo "\033[1;30mmake release version=1.0.0\033[0;39m"
else
ifneq ($(shell git diff --stat),)
@echo "Changes must be committed before running a release"
else
npm version $(version)
npm publish
git push origin master
git push origin --tags
endif
endif
+93
View File
@@ -0,0 +1,93 @@
# geomagnetism
[![NPM version](http://img.shields.io/npm/v/geomagnetism.svg?style=flat)](https://www.npmjs.org/package/geomagnetism)
[![Coverage Status](http://img.shields.io/coveralls/naturalatlas/geomagnetism/master.svg?style=flat)](https://coveralls.io/r/naturalatlas/geomagnetism)
`geomagnetism` provides a convenient interface for retrieving the Earth's magnetic declination (variation between magnetic north and true north) at a given location and date. It leverages NOAA's [World Magnetic Model (WMM)](https://www.ngdc.noaa.gov/geomag/WMM/) to compute properties such as declination, inclination, horizontal intensity, and more.
``` sh
$ npm install geomagnetism --save
```
### Usage
The main entry point is the `model()` function. If you pass it a Date object, it will compute results for that specific date. If you do **not** pass a date, it will default to the current date. Once you have a model, you can query it using the `point()` method, which expects an array representing latitude and longitude. Optionally, you can provide an altitude as a third element in the array.
- Latitude and longitude are required: `[lat, lon]`
- Altitude (optional) can be provided: `[lat, lon, altitude_in_kilometers]`
**Example: Current Date**
```js
const geomagnetism = require('geomagnetism');
// If no date is passed, the current date is used
const currentModel = geomagnetism.model();
const info = currentModel.point([44.53461, -109.05572]); // only lat/lon
console.log('Declination (current date):', info.decl, 'degrees');
```
**Example: Specific Date**
```js
const geomagnetism = require('geomagnetism');
// If a date is passed, that specific date is used
const specificDateModel = geomagnetism.model(new Date('2020-10-05'));
const info = specificDateModel.point([44.53461, -109.05572]);
console.log('Declination on 2020-10-05:', info.decl, 'degrees');
```
**Example: Including Altitude**
```js
const geomagnetism = require('geomagnetism');
// Provide altitude as the third array item (in kilometers above mean sea level)
const model = geomagnetism.model(new Date('2022-01-01'));
const infoWithAltitude = model.point([44.53461, -109.05572, 1.5]);
console.log('Declination at altitude:', infoWithAltitude.decl, 'degrees');
```
## Handling Out-of-Range Dates
The `geomagnetism.model()` function determines the best available World Magnetic Model for the date you provide. If the given date falls outside the known range of the WMM data files, by default (`allowOutOfBoundsModel = false`), the function will throw an error indicating that no suitable model is found for the given date.
If you would prefer that the library "fall back" to the closest available model rather than throwing an error, you can explicitly pass true to allowOutOfBoundsModel option.
```js
geomagnetism.model(date, { allowOutOfBoundsModel: true });
```
- `date`: *(optional)* A JavaScript Date object. Defaults to the current date if not specified.
- `allowOutOfBoundsModel`: *(optional)* A boolean. If not specified or false, throws an error if the date is out of range. If true, falls back to the nearest available model.
**Examples:**
```js
const geomagnetism = require('geomagnetism');
// Strict behavior (default): If the date is out of range, an error is thrown
try {
let model = geomagnetism.model(new Date('1900-01-01')); // allowOutOfBoundsModel defaults to false
let info = model.point([44.53461, -109.05572]);
} catch (err) {
console.error('Error (strict mode):', err.message);
}
// Fallback behavior: If the date is out of range, it uses the closest model
let fallbackModel = geomagnetism.model(new Date('1900-01-01'), { allowOutOfBoundsModel: true });
let fallbackInfo = fallbackModel.point([44.53461, -109.05572]);
console.log('Declination using fallback model:', fallbackInfo.decl);
```
## Available Data & Models
`geomagnetism` ships with multiple versions of the WMM data, each valid for a certain time range. The library automatically picks the correct model based on the date you supply. Older models are included to gracefully handle historical dates when using the fallback behavior.
## License
Copyright &copy; 2015–2024 [Natural Atlas, Inc.](https://naturalatlas.com/) & [Contributors](https://github.com/naturalatlas/geomagnetism/graphs/contributors)
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
+36
View File
@@ -0,0 +1,36 @@
var fs = require('fs');
var path = require('path');
/**
* Converts a coefficients file to a .json file that can be used to initialize a base model
*
* ex: node bin/convert WMM.COF wmm.json
*/
function exit(err){
console.log("Error: "+err);
process.exit(1);
}
var input_filename = process.argv[2];
var output_filename = process.argv[3];
if(!input_filename) exit("Input filename must be provided.");
if(!output_filename) exit("Output filename must be provided.");
// get parser by input file extension
var ext = path.extname(input_filename).toLowerCase().substr(1);
var parser;
try {
parser = require('../lib/parsers/'+ext);
} catch (err) {
exit("Unable to find parser for ."+ext+" file.");
}
var data = fs.readFileSync(input_filename, {encoding: 'utf8'});
var obj = parser(data);
var json = JSON.stringify(obj, null, 2);
fs.writeFileSync(output_filename, json);
console.log(output_filename + " successfully created");
+380
View File
@@ -0,0 +1,380 @@
{
"main_field_coeff_g": [
0,
-29438.5,
-1501.1,
-2445.3,
3012.5,
1676.6,
1351.1,
-2352.3,
1225.6,
581.9,
907.2,
813.7,
120.3,
-335,
70.3,
-232.6,
360.1,
192.4,
-141,
-157.4,
4.3,
69.5,
67.4,
72.8,
-129.8,
-29,
13.2,
-70.9,
81.6,
-76.1,
-6.8,
51.9,
15,
9.3,
-2.8,
6.7,
24,
8.6,
-16.9,
-3.2,
-20.6,
13.3,
11.7,
-16,
-2,
5.4,
8.8,
3.1,
-3.1,
0.6,
-13.3,
-0.1,
8.7,
-9.1,
-10.5,
-1.9,
-6.5,
0.2,
0.6,
-0.6,
1.7,
-0.7,
2.1,
2.3,
-1.8,
-3.6,
3.1,
-1.5,
-2.3,
2.1,
-0.9,
0.6,
-0.7,
0.2,
1.7,
-0.2,
0.4,
3.5,
-2,
-0.3,
0.4,
1.3,
-0.9,
0.9,
0.1,
0.5,
-0.4,
-0.4,
0.2,
-0.9,
0
],
"main_field_coeff_h": [
0,
0,
4796.2,
0,
-2845.6,
-642,
0,
-115.3,
245,
-538.3,
0,
283.4,
-188.6,
180.9,
-329.5,
0,
47.4,
196.9,
-119.4,
16.1,
100.1,
0,
-20.7,
33.2,
58.8,
-66.5,
7.3,
62.5,
0,
-54.1,
-19.4,
5.6,
24.4,
3.3,
-27.5,
-2.3,
0,
10.2,
-18.1,
13.2,
-14.6,
16.2,
5.7,
-9.1,
2.2,
0,
-21.6,
10.8,
11.7,
-6.8,
-6.9,
7.8,
1,
-3.9,
8.5,
0,
3.3,
-0.3,
4.6,
4.4,
-7.9,
-0.6,
-4.1,
-2.8,
-1.1,
-8.7,
0,
-0.1,
2.1,
-0.7,
-1.1,
0.7,
-0.2,
-2.1,
-1.5,
-2.5,
-2,
-2.3,
0,
-1,
0.5,
1.8,
-2.2,
0.3,
0.7,
-0.1,
0.3,
0.2,
-0.9,
-0.2,
0.7
],
"secular_var_coeff_g": [
0,
10.7,
17.9,
-8.6,
-3.3,
2.4,
3.1,
-6.2,
-0.4,
-10.4,
-0.4,
0.8,
-9.2,
4,
-4.2,
-0.2,
0.1,
-1.4,
0,
1.3,
3.8,
-0.5,
-0.2,
-0.6,
2.4,
-1.1,
0.3,
1.5,
0.2,
-0.2,
-0.4,
1.3,
0.2,
-0.4,
-0.9,
0.3,
0,
0.1,
-0.5,
0.5,
-0.2,
0.4,
0.2,
-0.4,
0.3,
0,
-0.1,
-0.1,
0.4,
-0.5,
-0.2,
0.1,
0,
-0.2,
-0.1,
0,
0,
-0.1,
0.3,
-0.1,
-0.1,
-0.1,
0,
-0.2,
-0.1,
-0.2,
0,
0,
-0.1,
0.1,
0,
0,
0,
0,
0,
0,
-0.1,
-0.1,
0.1,
0,
0,
0.1,
-0.1,
0,
0.1,
0,
0,
0,
0,
0,
0
],
"secular_var_coeff_h": [
0,
0,
-26.8,
0,
-27.1,
-13.3,
0,
8.4,
-0.4,
2.3,
0,
-0.6,
5.3,
3,
-5.3,
0,
0.4,
1.6,
-1.1,
3.3,
0.1,
0,
0,
-2.2,
-0.7,
0.1,
1,
1.3,
0,
0.7,
0.5,
-0.2,
-0.1,
-0.7,
0.1,
0.1,
0,
-0.3,
0.3,
0.3,
0.6,
-0.1,
-0.2,
0.3,
0,
0,
-0.2,
-0.1,
-0.2,
0.1,
0.1,
0,
-0.2,
0.4,
0.3,
0,
0.1,
-0.1,
0,
0,
-0.2,
0.1,
-0.1,
-0.2,
0.1,
-0.1,
0,
0,
0.1,
0,
0.1,
0,
0,
0.1,
0,
-0.1,
0,
-0.1,
0,
0,
0,
-0.1,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"n_max": 12,
"n_max_sec_var": 12,
"epoch": 2015,
"name": "WMM-2015",
"start_date": "2014-12-15T07:00:00.000Z",
"end_date": "2019-12-15T07:00:00.000Z"
}
+380
View File
@@ -0,0 +1,380 @@
{
"main_field_coeff_g": [
0,
-29438.2,
-1493.5,
-2444.5,
3014.7,
1679,
1351.8,
-2351.6,
1223.6,
582.3,
907.5,
814.8,
117.8,
-335.6,
69.7,
-232.9,
360.1,
191.7,
-141.3,
-157.2,
7.7,
69.4,
67.7,
72.3,
-129.1,
-28.4,
13.6,
-70.3,
81.7,
-75.9,
-7.1,
52.2,
15,
9.1,
-3,
5.9,
24.2,
8.9,
-16.9,
-3.1,
-20.7,
13.3,
11.6,
-16.3,
-2.1,
5.5,
8.8,
3,
-3.2,
0.6,
-13.2,
-0.1,
8.7,
-9.1,
-10.4,
-2,
-6.1,
0.2,
0.6,
-0.5,
1.8,
-0.7,
2.2,
2.4,
-1.8,
-3.6,
3,
-1.4,
-2.3,
2.1,
-0.8,
0.6,
-0.7,
0.1,
1.7,
-0.2,
0.4,
3.5,
-2,
-0.1,
0.5,
1.2,
-0.9,
0.9,
0.1,
0.6,
-0.4,
-0.5,
0.2,
-0.9,
0
],
"main_field_coeff_h": [
0,
0,
4796.3,
0,
-2842.4,
-638.8,
0,
-113.7,
246.5,
-537.4,
0,
283.3,
-188.6,
180.7,
-330,
0,
46.9,
196.5,
-119.9,
16,
100.6,
0,
-20.1,
32.8,
59.1,
-67.1,
8.1,
61.9,
0,
-54.3,
-19.5,
6,
24.5,
3.5,
-27.7,
-2.9,
0,
10.1,
-18.3,
13.3,
-14.5,
16.2,
6,
-9.2,
2.4,
0,
-21.8,
10.7,
11.8,
-6.8,
-6.9,
7.9,
1,
-3.9,
8.5,
0,
3.3,
-0.4,
4.6,
4.4,
-7.9,
-0.6,
-4.2,
-2.9,
-1.1,
-8.8,
0,
0,
2.1,
-0.6,
-1.1,
0.7,
-0.2,
-2.1,
-1.5,
-2.6,
-2,
-2.3,
0,
-1,
0.3,
1.8,
-2.2,
0.3,
0.7,
-0.1,
0.3,
0.2,
-0.9,
-0.2,
0.8
],
"secular_var_coeff_g": [
0,
7,
9,
-11,
-6.2,
0.3,
2.4,
-5.7,
2,
-11,
-0.8,
-0.9,
-6.5,
5.2,
-4,
-0.3,
0.6,
-0.8,
0.1,
1.2,
1.4,
-0.8,
-0.5,
-0.1,
1.6,
-1.6,
0,
1.2,
-0.3,
-0.2,
-0.3,
0.9,
0.1,
-0.6,
-0.9,
0.7,
-0.1,
0.2,
-0.2,
0.5,
-0.1,
0.4,
0.4,
-0.1,
0.4,
-0.1,
-0.1,
0,
0.4,
-0.4,
0,
0.3,
0,
0,
-0.3,
0,
0,
-0.1,
0.2,
-0.1,
-0.2,
0,
-0.1,
-0.2,
-0.1,
0,
0,
0,
0,
0,
0,
-0.1,
0,
0,
0,
-0.1,
0,
-0.1,
0,
0,
0,
0,
-0.1,
0,
0,
0,
0,
0,
0,
0,
-0.1
],
"secular_var_coeff_h": [
0,
0,
-30.2,
0,
-29.6,
-17.3,
0,
6.5,
-0.8,
-2,
0,
-0.4,
5.8,
3.8,
-3.5,
0,
0.2,
2.3,
0,
3.3,
-0.6,
0,
0.3,
-1.5,
-1.2,
0.4,
0.2,
1.3,
0,
0.6,
0.5,
-0.8,
-0.2,
-1.1,
0.1,
0.2,
0,
-0.4,
0.6,
-0.1,
0.6,
-0.2,
-0.5,
0.5,
0.1,
0,
-0.3,
0.1,
-0.4,
0.3,
0.1,
0,
-0.1,
0.5,
0.2,
0,
0,
0.1,
-0.2,
0.1,
-0.1,
0.1,
0,
-0.1,
0.2,
0,
0,
0,
0.1,
0,
0.1,
0,
0,
0.1,
0,
-0.1,
0,
-0.1,
0,
0,
0,
-0.1,
0.1,
0,
0,
0,
0,
0,
0,
0,
-0.1
],
"n_max": 12,
"n_max_sec_var": 12,
"epoch": 2015,
"name": "WMM-2015v2",
"start_date": "2018-09-18T06:00:00.000Z",
"end_date": "2023-09-18T06:00:00.000Z"
}
+380
View File
@@ -0,0 +1,380 @@
{
"main_field_coeff_g": [
0,
-29404.5,
-1450.7,
-2500,
2982,
1676.8,
1363.9,
-2381,
1236.2,
525.7,
903.1,
809.4,
86.2,
-309.4,
47.9,
-234.4,
363.1,
187.8,
-140.7,
-151.2,
13.7,
65.9,
65.6,
73,
-121.5,
-36.2,
13.5,
-64.7,
80.6,
-76.8,
-8.3,
56.5,
15.8,
6.4,
-7.2,
9.8,
23.6,
9.8,
-17.5,
-0.4,
-21.1,
15.3,
13.7,
-16.5,
-0.3,
5,
8.2,
2.9,
-1.4,
-1.1,
-13.3,
1.1,
8.9,
-9.3,
-11.9,
-1.9,
-6.2,
-0.1,
1.7,
-0.9,
0.6,
-0.9,
1.9,
1.4,
-2.4,
-3.9,
3,
-1.4,
-2.5,
2.4,
-0.9,
0.3,
-0.7,
-0.1,
1.4,
-0.6,
0.2,
3.1,
-2,
-0.1,
0.5,
1.3,
-1.2,
0.7,
0.3,
0.5,
-0.2,
-0.5,
0.1,
-1.1,
-0.3
],
"main_field_coeff_h": [
0,
0,
4652.9,
0,
-2991.6,
-734.8,
0,
-82.2,
241.8,
-542.9,
0,
282,
-158.4,
199.8,
-350.1,
0,
47.7,
208.4,
-121.3,
32.2,
99.1,
0,
-19.1,
25,
52.7,
-64.4,
9,
68.1,
0,
-51.4,
-16.8,
2.3,
23.5,
-2.2,
-27.2,
-1.9,
0,
8.4,
-15.3,
12.8,
-11.8,
14.9,
3.6,
-6.9,
2.8,
0,
-23.3,
11.1,
9.8,
-5.1,
-6.2,
7.8,
0.4,
-1.5,
9.7,
0,
3.4,
-0.2,
3.5,
4.8,
-8.6,
-0.1,
-4.2,
-3.4,
-0.1,
-8.8,
0,
0,
2.6,
-0.5,
-0.4,
0.6,
-0.2,
-1.7,
-1.6,
-3,
-2,
-2.6,
0,
-1.2,
0.5,
1.3,
-1.8,
0.1,
0.7,
-0.1,
0.6,
0.2,
-0.9,
0,
0.5
],
"secular_var_coeff_g": [
0,
6.7,
7.7,
-11.5,
-7.1,
-2.2,
2.8,
-6.2,
3.4,
-12.2,
-1.1,
-1.6,
-6,
5.4,
-5.5,
-0.3,
0.6,
-0.7,
0.1,
1.2,
1,
-0.6,
-0.4,
0.5,
1.4,
-1.4,
0,
0.8,
-0.1,
-0.3,
-0.1,
0.7,
0.2,
-0.5,
-0.8,
1,
-0.1,
0.1,
-0.1,
0.5,
-0.1,
0.4,
0.5,
0,
0.4,
-0.1,
-0.2,
0,
0.4,
-0.3,
0,
0.3,
0,
0,
-0.4,
0,
0,
0,
0.2,
-0.1,
-0.2,
0,
-0.1,
-0.2,
-0.1,
0,
0,
-0.1,
0,
0,
0,
-0.1,
0,
0,
-0.1,
-0.1,
-0.1,
-0.1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
-0.1
],
"secular_var_coeff_h": [
0,
0,
-25.1,
0,
-30.2,
-23.9,
0,
5.7,
-1,
1.1,
0,
0.2,
6.9,
3.7,
-5.6,
0,
0.1,
2.5,
-0.9,
3,
0.5,
0,
0.1,
-1.8,
-1.4,
0.9,
0.1,
1,
0,
0.5,
0.6,
-0.7,
-0.2,
-1.2,
0.2,
0.3,
0,
-0.3,
0.7,
-0.2,
0.5,
-0.3,
-0.5,
0.4,
0.1,
0,
-0.3,
0.2,
-0.4,
0.4,
0.1,
0,
-0.2,
0.5,
0.2,
0,
0,
0.1,
-0.3,
0.1,
-0.2,
0.1,
0,
-0.1,
0.2,
0,
0,
0,
0.1,
0,
0.2,
0,
0,
0.1,
0,
-0.1,
0,
0,
0,
0,
0,
-0.1,
0.1,
0,
0,
0,
0.1,
0,
0,
0,
-0.1
],
"n_max": 12,
"n_max_sec_var": 12,
"epoch": 2020,
"name": "WMM-2020",
"start_date": "2019-12-10T08:00:00.000Z",
"end_date": "2024-12-10T08:00:00.000Z"
}
+380
View File
@@ -0,0 +1,380 @@
{
"main_field_coeff_g": [
0,
-29351.8,
-1410.8,
-2556.6,
2951.1,
1649.3,
1361,
-2404.1,
1243.8,
453.6,
895,
799.5,
55.7,
-281.1,
12.1,
-233.2,
368.9,
187.2,
-138.7,
-142,
20.9,
64.4,
63.8,
76.9,
-115.7,
-40.9,
14.9,
-60.7,
79.5,
-77,
-8.8,
59.3,
15.8,
2.5,
-11.1,
14.2,
23.2,
10.8,
-17.5,
2,
-21.7,
16.9,
15,
-16.8,
0.9,
4.6,
7.8,
3,
-0.2,
-2.5,
-13.1,
2.4,
8.6,
-8.7,
-12.9,
-1.3,
-6.4,
0.2,
2,
-1,
-0.6,
-0.9,
1.5,
0.9,
-2.7,
-3.9,
2.9,
-1.5,
-2.5,
2.4,
-0.6,
-0.1,
-0.6,
-0.1,
1.1,
-1,
-0.2,
2.6,
-2,
-0.2,
0.3,
1.2,
-1.3,
0.6,
0.6,
0.5,
-0.1,
-0.4,
-0.2,
-1.3,
-0.7
],
"main_field_coeff_h": [
0,
0,
4545.4,
0,
-3133.6,
-815.1,
0,
-56.6,
237.5,
-549.5,
0,
278.6,
-133.9,
212,
-375.6,
0,
45.4,
220.2,
-122.9,
43,
106.1,
0,
-18.4,
16.8,
48.8,
-59.8,
10.9,
72.7,
0,
-48.9,
-14.4,
-1,
23.4,
-7.4,
-25.1,
-2.3,
0,
7.1,
-12.6,
11.4,
-9.7,
12.7,
0.7,
-5.2,
3.9,
0,
-24.8,
12.2,
8.3,
-3.3,
-5.2,
7.2,
-0.6,
0.8,
10,
0,
3.3,
0,
2.4,
5.3,
-9.1,
0.4,
-4.2,
-3.8,
0.9,
-9.1,
0,
0,
2.9,
-0.6,
0.2,
0.5,
-0.3,
-1.2,
-1.7,
-2.9,
-1.8,
-2.3,
0,
-1.3,
0.7,
1,
-1.4,
0,
0.6,
-0.1,
0.8,
0.1,
-1,
0.1,
0.2
],
"secular_var_coeff_g": [
0,
12,
9.7,
-11.6,
-5.2,
-8,
-1.3,
-4.2,
0.4,
-15.6,
-1.6,
-2.4,
-6,
5.6,
-7,
0.6,
1.4,
0,
0.6,
2.2,
0.9,
-0.2,
-0.4,
0.9,
1.2,
-0.9,
0.3,
0.9,
0,
-0.1,
-0.1,
0.5,
-0.1,
-0.8,
-0.8,
0.8,
-0.1,
0.2,
0,
0.5,
-0.1,
0.3,
0.2,
0,
0.2,
0,
-0.1,
0.1,
0.3,
-0.3,
0,
0.3,
-0.1,
0.1,
-0.1,
0.1,
0,
0.1,
0.1,
0,
-0.3,
0,
-0.1,
-0.1,
0,
0,
0,
0,
0,
0,
0,
-0.1,
0,
0,
-0.1,
-0.1,
-0.1,
-0.1,
0,
0,
0,
0,
0,
0,
0.1,
0,
0,
0,
-0.1,
0,
-0.1
],
"secular_var_coeff_h": [
0,
0,
-21.5,
0,
-27.7,
-12.1,
0,
4,
-0.3,
-4.1,
0,
-1.1,
4.1,
1.6,
-4.4,
0,
-0.5,
2.2,
0.4,
1.7,
1.9,
0,
0.3,
-1.6,
-0.4,
0.9,
0.7,
0.9,
0,
0.6,
0.5,
-0.8,
0,
-1,
0.6,
-0.2,
0,
-0.2,
0.5,
-0.4,
0.4,
-0.5,
-0.6,
0.3,
0.2,
0,
-0.3,
0.3,
-0.3,
0.3,
0.2,
-0.1,
-0.2,
0.4,
0.1,
0,
0,
0,
-0.2,
0.1,
-0.1,
0.1,
0,
-0.1,
0.2,
0,
0,
0,
0.1,
0,
0.1,
0,
0,
0.1,
0,
0,
0,
0,
0,
0,
0,
-0.1,
0.1,
0,
0,
0,
0,
0,
0,
0,
-0.1
],
"n_max": 12,
"n_max_sec_var": 12,
"epoch": 2025,
"name": "WMM-2025",
"start_date": "2024-11-13T03:00:00.000Z",
"end_date": "2029-11-13T03:00:00.000Z"
}
+30
View File
@@ -0,0 +1,30 @@
declare module "geomagnetism" {
export interface GeomagnetismPoint {
x: number;
y: number;
z: number;
h: number;
f: number;
incl: number;
decl: number;
}
export interface GeomagnetismModel {
epoch: number;
start_date: Date;
end_date: Date;
name: string;
main_field_coeff_g: number[];
secular_var_coeff_h: number[];
n_max: number;
n_max_sec_var: number;
num_terms: number;
point(geoPoint: number[]): GeomagnetismPoint;
}
export interface GeomagnetismOptions {
allowOutOfBoundsModel: boolean;
}
export function model(date?: Date, options?: GeomagnetismOptions): GeomagnetismModel;
}
+54
View File
@@ -0,0 +1,54 @@
const Model = require('./lib/model.js');
const geomagnetism = module.exports = {};
const modelData = [
{
file: require('./data/wmm-2025.json'),
startDate: new Date("2024-11-13T03:00:00.000Z"),
endDate: new Date("2029-11-13T03:00:00.000Z")
},
{
file: require('./data/wmm-2020.json'),
startDate: new Date("2019-12-10T08:00:00.000Z"),
endDate: new Date("2024-12-10T08:00:00.000Z")
},
{
file: require('./data/wmm-2015v2.json'),
startDate: new Date("2018-09-18T06:00:00.000Z"),
endDate: new Date("2023-09-18T06:00:00.000Z")
},
{
file: require('./data/wmm-2015.json'),
startDate: new Date("2014-12-15T07:00:00.000Z"),
endDate: new Date("2019-12-15T07:00:00.000Z")
}
];
geomagnetism.model = function (date, options = {}) {
date = date || new Date();
const ts = date.getTime();
const allowOutOfBoundsModel = (options && options.allowOutOfBoundsModel) || false;
// Get the latest matching model
let matchingModelData = modelData.find((model) => {
return ts >= model.startDate.getTime() && ts <= model.endDate.getTime();
});
// Get if the date is before the first model or after the last model
if (!matchingModelData && ts < modelData[modelData.length - 1].startDate.getTime()) {
matchingModelData = modelData[modelData.length - 1];
} else if (!matchingModelData && ts > modelData[0].endDate.getTime()) {
matchingModelData = modelData[0];
}
// If no matching model found, use the latest
if (!matchingModelData) {
matchingModelData = modelData[0]; // latest (will throw error if allowOutOfBoundsModel is true)
}
const matchingModel = new Model(matchingModelData.file);
return matchingModel.getTimedModel(date, allowOutOfBoundsModel);
};
+46
View File
@@ -0,0 +1,46 @@
var GeodeticCoord = require('./geodetic.js');
module.exports = CartesianCoord;
function CartesianCoord(options){
this.x = options.x;
this.y = options.y;
this.z = options.z;
}
CartesianCoord.prototype.toGeodetic = function(ellipsoid){
var modified_b = this.z < 0 ? -ellipsoid.b : ellipsoid.b;
var x = this.x;
var y = this.y;
var z = this.z;
var r = Math.sqr(x*x + y*y);
var e = (modified_b*z - (ellipsoid.a*ellipsoid.a - modified_b*modified_b)) / (ellipsoid.a*r);
var f = (modified_b*z + (ellipsoid.a*ellipsoid.a - modified_b*modified_b)) / (ellipsoid.a*r);
var p = (4/3) * (e*f+1);
var q = 2 * (e*e + f*f);
var d = p*p*p + q*q;
var v;
if(d > 0) {
v = Math.pow(Math.sqrt(d) - q, 1/3) - Math.pow(Math.sqrt(d) + q, 1/3);
} else {
v = 2 * Math.sqrt(-p) * Math.cos(Math.acos(q / (p * Math.sqrt(-p)) ) / 3);
}
if(v*v < Math.abs(p)) {
v = -(v*v*v + 2*q) / 3*p;
}
var g = (Math.sqrt(e*e + v) + e) / 2;
var t = Math.sqrt(g*g + (f - v*g)/(2*g - e)) - g;
var rlat = Math.atan( (ellipsoid.a*(1 - t*t)) / (2*modified_b*t) );
var zlong = Math.atan2(y, x);
if(zlong < 0) zlong += 2*Math.PI;
var height_above_ellipsoid = (r - ellipsoid.a*t) * Math.cos(rlat) + (z - modified_b) * Math.sin(rlat);
var lambda = zlong * Math.PI/180;
if(lambda > 180) lambda -= 360;
return new GeodeticCoord({
lambda: lambda,
phi: rlat * Math.PI/180,
height_above_ellipsoid: height_above_ellipsoid,
ellipsoid: ellipsoid
});
};
+31
View File
@@ -0,0 +1,31 @@
var SphericalCoord = require('./spherical.js');
var Ellipsoid = require('../ellipsoid.js');
module.exports = GeodeticCoord;
function GeodeticCoord(options){
this.options = options;
this.lambda = options.lambda || options.lon; // longitude
this.phi = options.phi || options.lat; // geodetic latitude
this.height_above_ellipsoid = options.height_above_ellipsoid || 0;
this.ellipsoid = options.ellipsoid || new Ellipsoid();
}
GeodeticCoord.prototype.toSpherical = function() {
var ellipsoid = this.ellipsoid;
var coslat = Math.cos(this.phi*Math.PI/180);
var sinlat = Math.sin(this.phi*Math.PI/180);
var rc = ellipsoid.a / Math.sqrt(1 - ellipsoid.epssq * sinlat * sinlat);
var xp = (rc + this.height_above_ellipsoid) * coslat;
var zp = (rc * (1 - ellipsoid.epssq) + this.height_above_ellipsoid) * sinlat;
var r = Math.sqrt(xp*xp + zp*zp);
return new SphericalCoord({
r: r,
phig: 180/Math.PI*Math.asin(zp / r),
lambda: this.lambda
});
};
GeodeticCoord.prototype.clone = function(){
return new GeodeticCoord(this.options);
};
+5
View File
@@ -0,0 +1,5 @@
module.exports = {
Cartesian: require('./cartesian.js'),
Spherical: require('./spherical.js'),
Geodetic: require('./geodetic.js')
};
+54
View File
@@ -0,0 +1,54 @@
var CartesianCoord = require('./cartesian.js');
var LegendreFunction = require('../legendre.js');
module.exports = SphericalCoord;
function SphericalCoord(options){
this.lambda = options.lambda; // longitude
this.phig = options.phig; // geocentric latitude
this.r = options.r; // distance from center of ellipsoid
}
SphericalCoord.prototype.toCartesian = function(){
var radphi = this.phig * Math.PI/180;
var radlambda = this.lambda * Math.PI/180;
return new CartesianCoord({
x: this.r * cos(radphi) * cos(radlambda),
y: this.r * cos(radphi) * sin(radlambda),
z: this.r * sin(radphi)
});
};
SphericalCoord.prototype.toGeodetic = function(ellipsoid){
return this.toCartesian().toGeodetic(ellipsoid);
};
SphericalCoord.prototype.getHarmonicVariables = function(ellipsoid, n_max){
var m, n;
var cos_lambda = Math.cos(Math.PI/180 * this.lambda);
var sin_lambda = Math.sin(Math.PI/180 * this.lambda);
var cos_mlambda = [1.0, cos_lambda];
var sin_mlambda = [0.0, sin_lambda];
var relative_radius_power = [
(ellipsoid.re/this.r) * (ellipsoid.re/this.r)
];
for(n = 1; n <= n_max; n++){
relative_radius_power[n] = relative_radius_power[n-1] * (ellipsoid.re/this.r);
}
for(m = 2; m <= n_max; m++){
cos_mlambda[m] = cos_mlambda[m-1]*cos_lambda - sin_mlambda[m-1]*sin_lambda;
sin_mlambda[m] = cos_mlambda[m-1]*sin_lambda + sin_mlambda[m-1]*cos_lambda;
}
return {
relative_radius_power: relative_radius_power,
cos_mlambda: cos_mlambda,
sin_mlambda: sin_mlambda
};
};
SphericalCoord.prototype.getLegendreFunction = function(n_max) {
return new LegendreFunction(this, n_max);
};
+17
View File
@@ -0,0 +1,17 @@
module.exports = Ellipsoid;
function Ellipsoid(options) {
options = options || {
a: 6378.137,
b: 6356.7523142,
fla: 1 / 298.257223563,
re: 6371.2
};
this.a = options.a; // semi-major axis
this.b = options.b; // semi-minor axis
this.fla = options.fla; // flattening
this.re = options.re; // mean radius
this.eps = Math.sqrt(1-(this.b*this.b)/(this.a*this.a)); // first eccentricity
this.epssq = this.eps*this.eps; // first eccentricity squared
}
+168
View File
@@ -0,0 +1,168 @@
module.exports = LegendreFunction;
function LegendreFunction(coord_spherical, n_max){
var sin_phi = Math.sin(Math.PI/180 * coord_spherical.phig);
var result;
if(n_max <= 16 || (1 - Math.abs(sin_phi)) < 1e-10){
result = PcupLow(sin_phi, n_max);
} else {
result = PcupHigh(sin_phi, n_max);
}
this.pcup = result.pcup;
this.dpcup = result.dpcup;
}
function PcupLow(x, n_max){
var k, z, n, m, i, i1, i2, num_terms;
var schmidt_quasi_norm = [1.0];
var pcup = [1.0];
var dpcup = [0.0];
z = Math.sqrt((1-x)*(1+x));
num_terms = (n_max+1) * (n_max+2) / 2;
for(n = 1; n <= n_max; n++) {
for(m = 0; m <= n; m++) {
i = n*(n+1)/2 + m;
if(n == m){
i1 = (n-1)*n/2 + m - 1;
pcup[i] = z*pcup[i1];
dpcup[i] = z*dpcup[i1] + x*pcup[i1];
} else if (n == 1 && m == 0) {
i1 = (n-1)*n/2 + m;
pcup[i] = x*pcup[i1];
dpcup[i] = x*dpcup[i1] - z*pcup[i1];
} else if (n > 1 && n != m) {
i1 = (n-2)*(n-1)/2 + m;
i2 = (n-1)*n/2 + m;
if(m > n - 2){
pcup[i] = x*pcup[i2];
dpcup[i] = x*dpcup[i2] - z*pcup[i2];
} else {
k = ((n-1)*(n-1) - m*m) / ((2*n-1)*(2*n-3));
pcup[i] = x*pcup[i2] - k*pcup[i1];
dpcup[i] = x*dpcup[i2] - z*pcup[i2] - k*dpcup[i1];
}
}
}
}
for(n = 1; n <= n_max; n++) {
i = n*(n+1)/2;
i1 = (n-1)*n/2;
schmidt_quasi_norm[i] = schmidt_quasi_norm[i1] * (2*n-1) / n;
for(m = 1; m <= n; m++){
i = n*(n+1)/2 + m;
i1 = n*(n+1)/2 + m - 1;
schmidt_quasi_norm[i] = schmidt_quasi_norm[i1] * Math.sqrt(((n - m + 1) * (m == 1 ? 2 : 1)) / (n + m));
}
}
for(n = 1; n <= n_max; n++) {
for(m = 0; m <= n; m++) {
i = n*(n+1)/2+m;
pcup[i] *= schmidt_quasi_norm[i];
dpcup[i] *= -schmidt_quasi_norm[i];
}
}
return {
pcup: pcup,
dpcup: dpcup
};
}
function PcupHigh(x, n_max){
if(Math.abs(x) == 1.0){
throw new Error("Error in PcupHigh: derivative cannot be calculated at poles");
}
var n, m, k;
var num_terms = (n_max + 1) * (n_max + 2)/2;
var f1 = [];
var f2 = [];
var pre_sqr = [];
var scalef = 1.0e-280;
for(n = 0; n <= 2*n_max + 1; ++n){
pre_sqr[n] = Math.sqrt(n);
}
k = 2;
for(n = 0; n <= n_max; n++){
k++;
f1[k] = (2*n - 1) / n;
f2[k] = (n - 1) / n;
for(m = 1; m <= n - 2; m++){
k++;
f1[k] = (2*n - 1) / pre_sqr[n+m] / pre_sqr[n-m];
f2[k] = pre_sqr[n-m-1] * pre_sqr[n+m-1] / pre_sqr[n+m] / pre_sqr[n-m];
}
k += 2;
}
var z = Math.sqrt((1-x)*(1+x));
var plm;
var pm1 = x;
var pm2 = 1;
var pcup = [1.0, pm1];
var dpcup = [0.0, z];
if(n_max == 0){
throw new Error("Error in PcupHigh: n_max must be greater than 0");
}
k = 1;
for(n = 2; n <= n_max; n++)
{
k = k + n;
plm = f1[k] * x * pm1 - f2[k] * pm2;
pcup[k] = plm;
dpcup[k] = n * (pm1 - x * plm) / z;
pm2 = pm1;
pm1 = plm;
}
var pmm = pre_sqr[2] * scalef;
var rescalem = 1/scalef;
var kstart = 0;
for(var m = 1; m <= n_max - 1; ++m){
rescalem *= z;
//calculate pcup(m,m)
kstart = kstart + m + 1;
pmm = pmm * pre_sqr[2*m+1] / pre_sqr[2*m];
pcup[kstart] = pmm * rescalem / pre_sqr[2*m+1];
dpcup[kstart] = -( m*x*pcup[kstart] /z );
pm2 = pmm / pre_sqr[2*m + 1];
//calculate pcup(m+1,m)
k = kstart + m + 1;
pm1 = x * pre_sqr[2*m+1] * pm2;
pcup[k] = pm1*rescalem;
dpcup[k] = (pm2*rescalem *pre_sqr[2*m+1] - x*(m+1)*pcup[k]) / z;
//calculate pcup(n,m)
for(n = m + 2; n <= n_max; ++n){
k = k + n;
plm = x*f1[k]*pm1 - f2[k]*pm2;
pcup[k] = plm*rescalem;
dpcup[k] = (pre_sqr[n+m]*pre_sqr[n-m]*pm1*rescalem - n*x*pcup[k]) / z;
pm2 = pm1;
pm1 = plm;
}
}
//calculate pcup(n_max,n_max)
rescalem = rescalem*z;
kstart = kstart + m + 1;
pmm = pmm / pre_sqr[2*n_max];
pcup[kstart] = pmm * rescalem;
dpcup[kstart] = -n_max * x * pcup[kstart] / z;
return {
pcup: pcup,
dpcup: dpcup
};
}
+98
View File
@@ -0,0 +1,98 @@
module.exports = MagneticElements;
function MagneticElements(options){
this.x = options.x;
this.y = options.y;
this.z = options.z;
this.h = options.h;
this.f = options.f;
this.incl = options.incl;
this.decl = options.decl;
this.gv = options.gv;
this.xdot = options.xdot;
this.ydot = options.ydot;
this.zdot = options.zdot;
this.hdot = options.hdot;
this.fdot = options.fdot;
this.incldot = options.incldot;
this.decldot = options.decldot;
this.gvdot = options.gvdot;
}
MagneticElements.prototype.clone = function(){
return new MagneticElements(this);
};
MagneticElements.prototype.scale = function(factor){
return new MagneticElements({
x : this.x * factor,
y : this.y * factor,
z : this.z * factor,
h : this.h * factor,
f : this.f * factor,
incl : this.incl * factor,
decl : this.decl * factor,
gv : this.gv * factor,
xdot : this.xdot * factor,
ydot : this.ydot * factor,
zdot : this.zdot * factor,
hdot : this.hdot * factor,
fdot : this.fdot * factor,
incldot : this.incldot * factor,
decldot : this.decldot * factor,
gvdot : this.gvdot * factor
});
};
MagneticElements.prototype.subtract = function(subtrahend){
return new MagneticElements({
x : this.x - subtrahend.x,
y : this.y - subtrahend.y,
z : this.z - subtrahend.z,
h : this.h - subtrahend.h,
f : this.f - subtrahend.f,
incl : this.incl - subtrahend.incl,
decl : this.decl - subtrahend.decl,
gv : this.gv - subtrahend.gv,
xdot : this.xdot - subtrahend.xdot,
ydot : this.ydot - subtrahend.ydot,
zdot : this.zdot - subtrahend.zdot,
hdot : this.hdot - subtrahend.hdot,
fdot : this.fdot - subtrahend.fdot,
incldot : this.incldot - subtrahend.incldot,
decldot : this.decldot - subtrahend.decldot,
gvdot : this.gvdot - subtrahend.gvdot
});
};
MagneticElements.fromGeoMagneticVector = function(magnetic_vector){
var bx = magnetic_vector.bx;
var by = magnetic_vector.by;
var bz = magnetic_vector.bz;
var h = Math.sqrt(bx*bx + by*by);
return new MagneticElements({
x: bx,
y: by,
z: bz,
h: h,
f: Math.sqrt(h*h + bz*bz),
decl: 180/Math.PI * Math.atan2(by, bx),
incl: 180/Math.PI * Math.atan2(bz, h)
});
};
MagneticElements.fromSecularVariationVector = function(magnetic_variation){
var bx = magnetic_variation.bx;
var by = magnetic_variation.by;
var bz = magnetic_variation.bz;
return new MagneticElements({
xdot: bx,
ydot: by,
zdot: bz,
hdot: (this.x*bx + this.y*by) / this.h,
fdot: (this.x*bx + this.y*by + this.z*bz) / this.f,
decldot: 180/Math.PI * (this.x*this.ydot - this.y*this.xdot) / (this.h*this.h),
incldot: 180/Math.PI * (this.h*this.zdot - this.z*this.hdot) / (this.f*this.f),
gvdot: this.decldot
});
};
+16
View File
@@ -0,0 +1,16 @@
module.exports = MagneticVector;
function MagneticVector(options){
this.bx = options.bx;
this.by = options.by;
this.bz = options.bz;
}
MagneticVector.prototype.rotate = function(coord_spherical, coord_geodetic) {
var psi = Math.PI/180 * (coord_spherical.phig - coord_geodetic.phi);
return new MagneticVector({
bz: this.bx*Math.sin(psi) + this.bz*Math.cos(psi),
bx: this.bx*Math.cos(psi) - this.bz*Math.sin(psi),
by: this.by
});
};
+140
View File
@@ -0,0 +1,140 @@
var GeodeticCoord = require('./coords/geodetic.js');
var MagneticElements = require('./magnetic_elements.js');
var MagneticVector = require('./magnetic_vector.js');
module.exports = Model;
function Model(options){
this.epoch = options.epoch;
this.start_date = new Date(options.start_date);
this.end_date = new Date(options.end_date);
this.name = options.name || "";
this.main_field_coeff_g = options.main_field_coeff_g || [0];
this.main_field_coeff_h = options.main_field_coeff_h || [0];
this.secular_var_coeff_g = options.secular_var_coeff_g || [0];
this.secular_var_coeff_h = options.secular_var_coeff_h || [0];
this.n_max = options.n_max || 0;
this.n_max_sec_var = options.n_max_sec_var || 0;
this.num_terms = this.n_max*(this.n_max+1)/2 + this.n_max;
}
Model.prototype.getTimedModel = function(date, allowOutOfBoundsModel = false){
var year_int = date.getUTCFullYear();
var fractional_year = (date.valueOf() - Date.UTC(year_int)) / (1000*3600*24*365);
var year = year_int + fractional_year;
var dyear = year - this.epoch;
if(date < this.start_date || date > this.end_date){
if(allowOutOfBoundsModel) {
console.error("Model is only valid from "+this.start_date.toDateString()+" to "+this.end_date.toDateString());
} else {
throw new Error("Model is only valid from "+this.start_date.toDateString()+" to "+this.end_date.toDateString());
}
}
var model = new Model({
epoch: this.epoch,
n_max: this.n_max,
n_max_sec_var: this.n_max_sec_var,
name: this.name,
start_date: this.start_date,
end_date: this.end_date,
});
var a = model.n_max_sec_var;
var b = a*(a + 1)/2 + a;
for(var n = 1; n <= this.n_max; n++){
for(var m = 0; m <= n; m++){
var i = n * (n + 1)/2 + m;
var hnm = this.main_field_coeff_h[i];
var gnm = this.main_field_coeff_g[i];
var dhnm = this.secular_var_coeff_h[i];
var dgnm = this.secular_var_coeff_g[i];
if(i <= b){
model.main_field_coeff_h[i] = hnm + dyear*dhnm;
model.main_field_coeff_g[i] = gnm + dyear*dgnm;
model.secular_var_coeff_h[i] = dhnm;
model.secular_var_coeff_g[i] = dgnm;
} else {
model.main_field_coeff_h[i] = hnm;
model.main_field_coeff_g[i] = gnm;
}
}
}
return model;
};
Model.prototype.getSummation = function(legendre, sph_variables, coord_spherical){
var bx = 0;
var by = 0;
var bz = 0;
var n, m, i, k;
var relative_radius_power = sph_variables.relative_radius_power;
var cos_mlambda = sph_variables.cos_mlambda;
var sin_mlambda = sph_variables.sin_mlambda;
var g = this.main_field_coeff_g;
var h = this.main_field_coeff_h;
for(n = 1; n <= this.n_max; n++){
for(m = 0; m <= n; m++){
i = n*(n+1)/2 + m;
bz -= relative_radius_power[n] *
(g[i]*cos_mlambda[m] + h[i]*sin_mlambda[m]) *
(n+1) * legendre.pcup[i];
by += relative_radius_power[n] *
(g[i]*sin_mlambda[m] - h[i]*cos_mlambda[m]) *
(m) * legendre.pcup[i];
bx -= relative_radius_power[n] *
(g[i]*cos_mlambda[m] + h[i]*sin_mlambda[m]) *
legendre.dpcup[i];
}
}
var cos_phi = Math.cos(Math.PI/180 * coord_spherical.phig);
if(Math.abs(cos_phi) > 1e-10){
by = by / cos_phi;
} else {
//special calculation around poles
by = 0;
var schmidt_quasi_norm1 = 1.0, schmidt_quasi_norm2, schmidt_quasi_norm3;
var pcup_s = [1];
var sin_phi = Math.sin(Math.PI/180 * coord_spherical.phig);
for(n = 1; n <= this.n_max; n++){
i = n*(n+1)/2 + 1;
schmidt_quasi_norm2 = schmidt_quasi_norm1 * (2*n-1) / n;
schmidt_quasi_norm3 = schmidt_quasi_norm2 * Math.sqrt(2*n/(n+1));
schmidt_quasi_norm1 = schmidt_quasi_norm2;
if(n == 1){
pcup_s[n] = pcup_s[n-1];
} else {
k = ((n-1)*(n-1) - 1) / ((2*n-1)*(2*n-3));
pcup_s[n] = sin_phi * pcup_s[n-1] - k*pcup_s[n-2];
}
by += relative_radius_power[n] *
(g[i]*sin_mlambda[1] - h[i]*cos_mlambda[1]) *
pcup_s[n] * schmidt_quasi_norm3;
}
}
return new MagneticVector({
bx: bx, by: by, bz: bz
});
};
Model.prototype.point = function(coords) {
// Extract altitude if provided, otherwise default to 0
var altitude = (coords.length > 2 && typeof coords[2] === 'number') ? coords[2] : 0;
var coord_geodetic = new GeodeticCoord({
lat: coords[0],
lon: coords[1],
height_above_ellipsoid: altitude
});
var coord_spherical = coord_geodetic.toSpherical();
var legendre = coord_spherical.getLegendreFunction(this.n_max);
var harmonic_variables = coord_spherical.getHarmonicVariables(coord_geodetic.ellipsoid, this.n_max);
var magnetic_vector_sph = this.getSummation(legendre, harmonic_variables, coord_spherical);
var magnetic_vector_geo = magnetic_vector_sph.rotate(coord_spherical, coord_geodetic);
return MagneticElements.fromGeoMagneticVector(magnetic_vector_geo);
};
+40
View File
@@ -0,0 +1,40 @@
module.exports = function(str){
var result = {
main_field_coeff_g: [0],
main_field_coeff_h: [0],
secular_var_coeff_g: [0],
secular_var_coeff_h: [0],
n_max: 0,
n_max_sec_var: 0
};
var lines = str.split(/\r?\n/);
for(var i = 0; i < lines.length; i++) {
var line = lines[i];
var vals = line.match(/\S+/g);
if(!vals) continue;
if(vals.length === 3){
result.epoch = parseFloat(vals[0]);
result.name = vals[1];
result.start_date = new Date(vals[2]);
result.end_date = new Date(vals[2]);
var year = result.start_date.getFullYear();
result.end_date.setFullYear(year + 5);
}
if(vals.length === 6){
var n = parseInt(vals[0]);
var m = parseInt(vals[1]);
if(m <= n) {
var i = (n*(n+1)/2+m);
result.main_field_coeff_g[i] = parseFloat(vals[2]);
result.main_field_coeff_h[i] = parseFloat(vals[3]);
result.secular_var_coeff_g[i] = parseFloat(vals[4]);
result.secular_var_coeff_h[i] = parseFloat(vals[5]);
}
if(n > result.n_max){
result.n_max = n;
result.n_max_sec_var = n;
}
}
}
return result;
};
+34
View File
@@ -0,0 +1,34 @@
{
"name": "geomagnetism",
"types": "geomagnetism.d.ts",
"version": "0.2.0",
"description": "Computes geomagnetic field information",
"main": "index.js",
"scripts": {
"test": "mocha test",
"test-ci": "mocha -R tap"
},
"repository": {
"type": "git",
"url": "https://github.com/naturalatlas/geomagnetism.git"
},
"keywords": [
"geomag",
"geomagnetic",
"magnetic",
"field",
"north",
"declination",
"wmm"
],
"devDependencies": {
"mocha": "~5.x",
"chai": "~4.2.0"
},
"author": "Brandon Reavis",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/naturalatlas/geomagnetism/issues"
},
"homepage": "https://github.com/naturalatlas/geomagnetism"
}
+96
View File
@@ -0,0 +1,96 @@
var geomagnetism = require('../index.js');
var assert = require('chai').assert;
var fs = require('fs');
var tolerances = {
incl: 0.01, //deg
decl: 0.01, //deg
x: 5, //nT
y: 5, //nT
z: 5, //nT
h: 5, //nT
f: 5 //nT
};
function loadTestValues(){
var str = fs.readFileSync(__dirname + '/values.csv', {encoding: 'utf8'});
var lines = str.split(/\r?\n/);
var header = lines[0].split(',');
var values = [];
for(var i = 1; i < lines.length; i++){
var l = lines[i].split(',');
var v = {};
for(var j = 0; j < header.length; j++){
v[header[j]] = parseFloat(l[j]);
}
values.push(v);
}
return values;
}
function getModel(test){
var t0, t1;
var year = test.date;
var year_int = Math.floor(year);
var year_fpart = year - year_int;
var dms = 1000*3600*24*365*year_fpart;
t0 = new Date(year_int, 0, 1);
t1 = new Date(t0.valueOf() + dms);
return geomagnetism.model(t1);
}
var values = loadTestValues();
describe("model", function(){
describe("point()", function(){
it("should return expected values", function(){
values.forEach(function(test){
var model = getModel(test);
var info = model.point([test.lat, test.lon, test.alt]);
assert.closeTo(info.incl, test.incl, tolerances.incl, 'inclination ' + test.date);
assert.closeTo(info.decl, test.decl, tolerances.decl, 'declination ' + test.date);
assert.closeTo(info.x, test.x, tolerances.x, 'x');
assert.closeTo(info.y, test.y, tolerances.y, 'y');
assert.closeTo(info.z, test.z, tolerances.z, 'z');
assert.closeTo(info.h, test.h, tolerances.h, 'h');
assert.closeTo(info.f, test.f, tolerances.f, 'f');
});
});
it("should return value for current date", function(){
var date = new Date();
geomagnetism.model(date).point([44.53461, -109.05572]);
});
it("should return value for current date + 1 year", function(){
var date = new Date();
date.setFullYear(date.getFullYear() + 1);
geomagnetism.model(date).point([44.53461, -109.05572]);
});
});
describe("getTimedModel()", function(){
it("should throw error if date is outside of valid range and allowOutOfBoundsModel is false", function(){
assert.throws(function(){
geomagnetism.model(new Date("1/1/1999"));
}, Error);
});
it("should log error if date is outside of valid range below and allowOutOfBoundsModel is true", function(){
var model = geomagnetism.model(new Date("1/1/1999"), { allowOutOfBoundsModel: true });
assert.equal(model.start_date.getFullYear(), 2014);
});
it("should log error if date is outside of valid range above and allowOutOfBoundsModel is true", function(){
var model = geomagnetism.model(new Date("1/1/2030"), { allowOutOfBoundsModel: true });
assert.equal(model.start_date.getFullYear(), 2024);
});
it("should get a different model for a different date", function(){
var pt = [44.53461, -109.05572];
var model0 = geomagnetism.model();
var model1 = geomagnetism.model(new Date("3/22/2018"));
var decl0 = model0.point(pt).decl;
var decl1 = model1.point(pt).decl;
assert.notEqual(model0, model1);
assert(Math.abs(decl1 - decl0) > 0.001, 'declination should be different');
});
});
});
+214
View File
@@ -0,0 +1,214 @@
date,alt,lat,lon,x,y,z,h,f,incl,decl,gv
2015.0,0,80,0,6627.1,-445.9,54432.3,6642.1,54836.0,83.04,-3.85,-3.85
2015.0,0,0,120,39518.2,392.9,-11252.4,39520.2,41090.9,-15.89,0.57,0.57
2015.0,0,-80,240,5797.3,15761.1,-52919.1,16793.5,55519.8,-72.39,69.81,309.81
2015.0,100,80,0,6314.3,-471.6,52269.8,6331.9,52652.0,83.09,-4.27,-4.27
2015.0,100,0,120,37535.6,364.4,-10773.4,37537.3,39052.7,-16.01,0.56,0.56
2015.0,100,-80,240,5613.1,14791.5,-50378.6,15820.7,52804.4,-72.57,69.22,309.22
2017.5,0,80,0,6599.4,-317.1,54459.2,6607.0,54858.5,83.08,-2.75,-2.75
2017.5,0,0,120,39571.4,222.5,-11030.1,39572.0,41080.5,-15.57,0.32,0.32
2017.5,0,-80,240,5873.8,15781.4,-52687.9,16839.1,55313.4,-72.28,69.58,309.58
2017.5,100,80,0,6290.5,-348.5,52292.7,6300.1,52670.9,83.13,-3.17,-3.17
2017.5,100,0,120,37585.5,209.5,-10564.2,37586.1,39042.5,-15.70,0.32,0.32
2017.5,100,-80,240,5683.5,14808.8,-50163.0,15862.0,52611.1,-72.45,69.00,309.00
2015.21096,0,44.5364,-109.0461,18702.1,3663.7,50812.2,19057.5,54268.5,69.44104,11.08386,0
2020.0,28,89,-121,-575.7,-1396.0,56082.3,1510.0,56102.7,88.46,-112.41,0
2020.0,48,80,-96,1518.0,-1160.5,55671.9,1910.8,55704.7,88.03,-37.40,0
2020.0,54,82,87,1555.6,1941.4,56520.5,2487.8,56575.2,87.48,51.30,0
2020.0,65,43,93,24375.3,303.2,49691.4,24377.2,55348.7,63.87,0.71,0
2020.0,51,-33,109,21556.3,-2183.2,-52676.0,21666.6,56957.9,-67.64,-5.78,0
2020.0,39,-59,-8,14369.9,-4063.3,-24679.0,14933.4,28845.4,-58.82,-15.79,0
2020.0,3,-50,-103,19684.4,10512.2,-31883.6,22315.5,38917.2,-55.01,28.10,0
2020.0,94,-29,-110,23467.8,6650.9,-19320.7,24392.0,31116.9,-38.38,15.82,0
2020.0,66,14,143,34916.8,70.2,8114.9,34916.9,35847.5,13.08,0.12,0
2020.0,18,0,21,29311.2,536.0,-14589.0,29316.1,32745.6,-26.46,1.05,0
2020.5,6,-36,-137,23948.6,8791.9,-32897.6,25511.4,41630.3,-52.21,20.16,0
2020.5,63,26,81,34737.7,259.2,30023.4,34738.7,45914.9,40.84,0.43,0
2020.5,69,38,-144,22647.3,5390.0,35831.9,23279.9,42730.3,56.99,13.39,0
2020.5,50,-70,-133,8943.1,13981.7,-51628.5,16597.2,54230.7,-72.18,57.40,0
2020.5,8,-52,-75,19571.7,5387.5,-23769.0,20299.7,31257.7,-49.50,15.39,0
2020.5,8,-66,17,15247.0,-9734.8,-31062.0,18089.7,35945.6,-59.78,-32.56,0
2020.5,22,-37,140,21429.0,3451.3,-55415.6,21705.2,59514.7,-68.61,9.15,0
2020.5,40,-12,-129,28773.9,5503.9,-8221.8,29295.6,30427.4,-15.68,10.83,0
2020.5,44,33,-118,23414.3,4748.3,38184.5,23890.9,45042.6,57.97,11.46,0
2020.5,50,-81,-67,16087.9,8788.9,-44780.8,18332.1,48387.8,-67.74,28.65,0
2021.0,74,-57,3,13228.0,-5423.3,-23859.2,14296.6,27814.7,-59.07,-22.29,0
2021.0,46,-24,-122,26037.0,6501.8,-18297.4,26836.5,32480.6,-34.29,14.02,0
2021.0,69,23,63,34450.4,646.9,24869.2,34456.5,42493.9,35.82,1.08,0
2021.0,33,-3,-147,30690.1,5265.7,-1277.4,31138.6,31164.8,-2.35,9.74,0
2021.0,47,-72,-22,18352.8,-1946.6,-33665.0,18455.7,38392.0,-61.27,-6.05,0
2021.0,62,-14,99,33213.0,-990.3,-33354.0,33227.7,47080.5,-45.11,-1.71,0
2021.0,83,86,-46,2408.8,-1796.2,54184.7,3004.8,54268.0,86.83,-36.71,0
2021.0,82,-64,87,2249.5,-13907.0,-53526.9,14087.8,55349.8,-75.25,-80.81,0
2021.0,34,-19,43,19327.6,-4933.5,-25969.5,19947.3,32746.2,-52.47,-14.32,0
2021.0,56,-81,40,9198.0,-15323.4,-45453.8,17872.0,48841.2,-68.54,-59.03,0
2021.5,14,0,80,39246.6,-2338.9,-12258.0,39316.2,41182.8,-17.32,-3.41,0
2021.5,12,-82,-68,15995.1,9368.5,-46308.7,18536.8,49880.9,-68.18,30.36,0
2021.5,44,-46,-42,14159.0,-2889.8,-19762.2,14450.9,24482.1,-53.82,-11.54,0
2021.5,43,17,52,35896.1,773.7,15885.6,35904.4,39261.7,23.87,1.23,0
2021.5,64,10,78,39294.0,-1172.2,5088.1,39311.5,39639.4,7.37,-1.71,0
2021.5,12,33,-145,24301.2,5327.4,32429.3,24878.3,40872.8,52.51,12.36,0
2021.5,12,-79,115,-9403.6,-8972.3,-58271.0,12997.3,59702.9,-77.43,-136.34,0
2021.5,14,-33,-114,23592.3,7712.3,-24163.1,24820.9,34640.0,-44.23,18.10,0
2021.5,19,29,66,32618.0,1215.2,33763.7,32640.6,46961.7,45.97,2.13,0
2021.5,86,-11,167,32676.0,5828.1,-20299.1,33191.7,38906.8,-31.45,10.11,0
2022.0,37,-66,-5,16404.3,-5011.2,-28849.5,17152.6,33563.5,-59.27,-16.99,0
2022.0,67,72,-115,4532.7,1254.7,55923.4,4703.2,56120.8,85.19,15.47,0
2022.0,44,22,174,28671.0,3294.9,17967.2,28859.7,33995.6,31.91,6.56,0
2022.0,54,54,178,20624.8,514.8,45076.8,20631.2,49573.8,65.41,1.43,0
2022.0,57,-43,50,11344.6,-12349.5,-32850.3,16769.3,36883.0,-62.96,-47.43,0
2022.0,44,-43,-111,20646.1,9330.1,-29747.5,22656.4,37392.8,-52.71,24.32,0
2022.0,12,-63,178,6292.0,9718.1,-61429.1,11577.2,62510.5,-79.33,57.08,0
2022.0,38,27,-169,25896.5,3991.3,24097.4,26202.3,35598.4,42.60,8.76,0
2022.0,61,59,-77,10098.3,-3208.9,54735.3,10595.8,55751.4,79.04,-17.63,0
2022.0,67,-47,-32,12663.7,-3178.2,-20600.9,13056.5,24389.9,-57.63,-14.09,0
2022.5,8,62,53,12336.1,4236.6,54498.1,13043.3,56037.2,76.54,18.95,0
2022.5,77,-68,-7,16604.7,-4741.2,-29908.6,17268.3,34535.8,-60.00,-15.94,0
2022.5,98,-5,159,33613.6,4601.1,-14426.9,33927.0,36867.1,-23.04,7.79,0
2022.5,34,-29,-107,23739.9,6662.3,-19023.5,24657.0,31142.6,-37.65,15.68,0
2022.5,60,27,65,32938.8,1025.8,30561.3,32954.8,44944.6,42.84,1.78,0
2022.5,73,-72,95,-2661.0,-13095.2,-55423.4,13362.8,57011.5,-76.44,-101.49,0
2022.5,96,-46,-85,19136.4,6358.2,-21915.4,20165.1,29781.1,-47.38,18.38,0
2022.5,0,-13,-59,21797.3,-6520.6,-5425.9,22751.7,23389.8,-13.41,-16.65,0
2022.5,16,66,-178,13804.5,463.2,54055.4,13812.2,55792.1,75.67,1.92,0
2022.5,72,-87,38,7132.3,-15063.2,-48550.5,16666.4,51331.5,-71.05,-64.66,0
2023.0,49,20,167,30099.4,2737.4,15301.2,30223.6,33876.1,26.85,5.20,0
2023.0,71,5,-13,28217.7,-3592.6,-8905.8,28445.5,29807.1,-17.38,-7.26,0
2023.0,95,14,65,36804.1,-356.8,11616.0,36805.8,38595.3,17.52,-0.56,0
2023.0,86,-85,-79,12598.0,11248.0,-47331.2,16888.7,50254.0,-70.36,41.76,0
2023.0,30,-36,-64,17694.8,-1198.1,-14566.5,17735.3,22950.5,-39.40,-3.87,0
2023.0,75,79,125,2605.8,-676.0,57085.9,2692.1,57149.3,87.30,-14.54,0
2023.0,21,6,-32,27630.5,-7515.0,-3646.9,28634.3,28865.6,-7.26,-15.22,0
2023.0,1,-76,-75,16998.9,9958.1,-42873.8,19700.9,47183.6,-65.32,30.36,0
2023.0,45,-46,-41,13880.3,-2936.1,-19853.0,14187.4,24401.3,-54.45,-11.94,0
2023.0,11,-22,-21,12752.8,-5710.4,-21372.4,13972.9,25534.7,-56.82,-24.12,0
2023.5,28,54,-120,14556.6,4230.3,52945.6,15158.8,55072.9,74.02,16.20,0
2023.5,68,-58,156,7015.1,5987.8,-62459.5,9223.1,63136.8,-81.60,40.48,0
2023.5,39,-65,-88,18024.0,10347.2,-36415.6,20783.0,41928.8,-60.29,29.86,0
2023.5,27,-23,81,24811.0,-6176.1,-41759.2,25568.2,48965.0,-58.52,-13.98,0
2023.5,11,34,0,29033.7,545.3,30807.0,29038.8,42335.9,46.69,1.08,0
2023.5,72,-62,65,6836.8,-16092.9,-44111.8,17485.0,47450.8,-68.38,-66.98,0
2023.5,55,86,70,1168.7,2124.7,55750.6,2424.9,55803.4,87.51,61.19,0
2023.5,59,32,163,28170.0,176.0,26318.3,28170.6,38551.7,43.05,0.36,0
2023.5,65,48,148,23356.8,-3861.2,43968.0,23673.8,49936.3,61.70,-9.39,0
2023.5,95,30,28,29663.3,2331.2,28857.6,29754.7,41450.1,44.12,4.49,0
2024.0,95,-60,-59,18099.3,2821.2,-26193.2,18317.9,31962.9,-55.03,8.86,0
2024.0,95,-70,42,10615.3,-14769.3,-38293.4,18188.3,42393.4,-64.59,-54.29,0
2024.0,50,87,-154,80.9,-592.4,55904.6,597.9,55907.8,89.39,-82.22,0
2024.0,58,32,19,29331.6,2019.5,30329.8,29401.0,42241.2,45.89,3.94,0
2024.0,57,34,-13,28158.7,-1290.8,29015.5,28188.3,40453.4,45.83,-2.62,0
2024.0,38,-76,49,8218.0,-16491.7,-44260.7,18425.8,47942.9,-67.40,-63.51,0
2024.0,49,-50,-179,15431.4,9482.7,-53818.3,18112.2,56784.4,-71.40,31.57,0
2024.0,90,-55,-171,12918.7,10118.6,-53373.5,16409.7,55839.2,-72.91,38.07,0
2024.0,41,42,-19,24317.3,-2127.0,36981.3,24410.2,44311.1,56.57,-5.00,0
2024.0,19,46,-22,22384.7,-2590.4,40713.3,22534.0,46533.4,61.04,-6.60,0
2024.5,31,13,-132,28046.9,4548.8,17417.2,28413.4,33326.9,31.51,9.21,0
2024.5,93,-2,158,33858.1,4253.5,-10940.3,34124.3,35835.1,-17.78,7.16,0
2024.5,51,-76,40,10459.6,-15294.7,-42141.5,18529.2,46035.2,-66.27,-55.63,0
2024.5,64,22,-132,25808.9,4792.5,25239.1,26250.1,36415.3,43.88,10.52,0
2024.5,26,-65,55,8607.6,-16603.5,-41366.0,18702.1,45397.3,-65.67,-62.60,0
2024.5,66,-21,32,15510.7,-3677.9,-24502.7,15940.8,29231.7,-56.95,-13.34,0
2024.5,18,9,-172,30615.4,5065.5,8768.5,31031.6,32246.7,15.78,9.39,0
2024.5,63,88,26,2189.6,1254.6,55156.1,2523.6,55213.8,87.38,29.81,0
2024.5,33,17,5,34060.9,362.9,8230.6,34062.9,35043.1,13.58,0.61,0
2024.5,77,-18,138,31722.0,2569.6,-34986.2,31825.9,47296.1,-47.71,4.63,0
2025.000000,28,89,-121,-255.388723,-1482.460628,56194.288771,1504.298146,56214.419888,88.47,-99.77,0
2025.000000,48,80,-96,1875.982280,-1079.269389,55623.044051,2164.285547,55665.134163,87.77,-29.91,0
2025.000000,54,82,87,1324.336929,1883.428620,56740.772059,2302.427342,56787.466800,87.68,54.89,0
2025.000000,65,43,93,24299.852822,210.517066,50037.923998,24300.764692,55626.621348,64.10,0.50,0
2025.000000,51,-33,109,21737.778822,-2090.274098,-52710.003920,21838.046477,57054.752538,-67.50,-5.49,0
2025.000000,39,-59,-8,14358.095523,-4049.107540,-24389.086374,14918.115796,28589.818346,-58.55,-15.75,0
2025.000000,3,-50,-103,19526.532799,10362.990980,-31437.562789,22106.041373,38431.724126,-54.89,27.96,0
2025.000000,94,-29,-110,23275.471080,6559.046509,-19063.605287,24181.990098,30792.688931,-38.25,15.74,0
2025.000000,66,14,143,35003.441364,-116.624818,7966.315182,35003.635649,35898.700342,12.82,-0.19,0
2025.000000,18,0,21,29274.811882,659.800118,-14316.722540,29282.246275,32594.761714,-26.06,1.29,0
2025.500000,6,-36,-137,23781.930678,8786.698927,-32577.518648,25353.230658,41280.516301,-52.11,20.28,0
2025.500000,63,26,81,34802.613433,308.431881,30332.056989,34803.980117,46166.554053,41.07,0.51,0
2025.500000,69,38,-144,22510.804524,5167.636206,35525.990264,23096.337032,42373.774537,56.97,12.93,0
2025.500000,50,-70,-133,9021.847823,14001.865232,-51084.838301,16656.709403,53731.803175,-71.94,57.21,0
2025.500000,8,-52,-75,19331.857134,5147.774727,-23532.664273,20005.506364,30886.996822,-49.63,14.91,0
2025.500000,8,-66,17,15201.438652,-9925.501123,-30881.123197,18154.870136,35822.382382,-59.55,-33.14,0
2025.500000,22,-37,140,21404.761773,3498.897430,-55397.587760,21688.847590,59492.006517,-68.62,9.28,0
2025.500000,40,-12,-129,28594.451238,5432.201489,-8052.525092,29105.866326,30199.248583,-15.46,10.76,0
2025.500000,44,33,-118,23235.835850,4558.379362,37727.715752,23678.743422,44542.826874,57.89,11.10,0
2025.500000,50,-81,-67,16132.682326,8623.494405,-44412.283868,18292.842720,48032.062762,-67.61,28.13,0
2026.000000,74,-57,3,13268.119649,-5498.179626,-23576.062921,14362.206593,27606.226129,-58.65,-22.51,0
2026.000000,46,-24,-122,25846.118652,6448.863284,-18080.399376,26638.500090,32194.883578,-34.17,14.01,0
2026.000000,69,23,63,34558.605297,708.078839,25043.405885,34565.858527,42684.549360,35.92,1.17,0
2026.000000,33,-3,-147,30514.086409,5221.840663,-1146.978999,30957.666082,30978.906535,-2.12,9.71,0
2026.000000,47,-72,-22,18280.800055,-2024.105320,-33397.486160,18392.516222,38127.112857,-61.16,-6.32,0
2026.000000,62,-14,99,33437.828630,-835.919473,-33100.922253,33448.275663,47058.030120,-44.70,-1.43,0
2026.000000,83,86,-46,2582.099403,-1527.839829,54279.308437,3000.255301,54362.163830,86.84,-30.61,0
2026.000000,82,-64,87,2007.074870,-13829.362571,-53663.514288,13974.248411,55453.154865,-75.40,-81.74,0
2026.000000,34,-19,43,19525.694050,-5224.017527,-26182.862330,20212.448819,33076.961273,-52.33,-14.98,0
2026.000000,56,-81,40,9000.536024,-15446.900890,-45267.890393,17877.818542,48670.301997,-68.45,-59.77,0
2026.500000,14,0,80,39431.415992,-2133.456168,-12188.838466,39489.089663,41327.424134,-17.15,-3.10,0
2026.500000,12,-82,-68,16052.819558,9190.416754,-45940.146795,18497.480257,49524.275496,-68.07,29.79,0
2026.500000,44,-46,-42,13863.176808,-2785.834358,-19744.304022,14140.316272,24285.511845,-54.39,-11.36,0
2026.500000,43,17,52,35994.907968,747.876551,15990.895993,36002.676553,39394.180708,23.95,1.19,0
2026.500000,64,10,78,39427.724480,-1049.971869,5214.811025,39441.702532,39784.948821,7.53,-1.53,0
2026.500000,12,33,-145,24136.839639,5112.225422,32162.934508,24672.289649,40536.110231,52.51,11.96,0
2026.500000,12,-79,115,-9613.650418,-8785.714482,-58104.306533,13023.480845,59545.961164,-77.37,-137.58,0
2026.500000,14,-33,-114,23393.133584,7653.110952,-23854.293436,24613.183584,34275.882505,-44.10,18.12,0
2026.500000,19,29,66,32725.000691,1278.343380,33958.454002,32749.959268,47177.711160,46.04,2.24,0
2026.500000,86,-11,167,32578.377044,5882.794932,-20368.224196,33105.255278,38869.300019,-31.60,10.24,0
2027.000000,37,-66,-5,16390.771268,-5079.626554,-28608.243575,17159.836500,33360.029814,-59.04,-17.22,0
2027.000000,67,72,-115,4883.287833,1192.857435,55689.615237,5026.868699,55916.032175,84.84,13.73,0
2027.000000,44,22,174,28683.972510,3249.857362,17961.198575,28867.487799,33999.066253,31.89,6.46,0
2027.000000,54,54,178,20615.871559,225.041793,45149.631876,20617.099795,49634.202547,65.46,0.63,0
2027.000000,57,-43,50,11203.748204,-12563.437494,-33221.366617,16833.417225,37242.759503,-63.13,-48.27,0
2027.000000,44,-43,-111,20471.522067,9245.505620,-29347.556906,22462.470699,36957.295441,-52.57,24.31,0
2027.000000,12,-63,178,6233.774935,9925.455386,-61075.730989,11720.691727,62190.188377,-79.14,57.87,0
2027.000000,38,27,-169,25821.061601,3851.701313,24058.365347,26106.758229,35501.658671,42.66,8.48,0
2027.000000,61,59,-77,10437.775689,-3087.391846,54397.713552,10884.812802,55476.034370,78.68,-16.48,0
2027.000000,67,-47,-32,12450.832543,-2994.148743,-20475.298079,12805.786103,24150.072239,-57.98,-13.52,0
2027.500000,8,62,53,12260.425578,4315.497527,54849.810218,12997.751893,56368.814385,76.67,19.39,0
2027.500000,77,-68,-7,16578.099495,-4813.676173,-29680.383821,17262.817301,34335.550744,-59.82,-16.19,0
2027.500000,98,-5,159,33544.960996,4589.735713,-14525.780052,33857.496691,36841.937629,-23.22,7.79,0
2027.500000,34,-29,-107,23540.396213,6592.363667,-18723.097084,24446.053109,30792.269761,-37.45,15.64,0
2027.500000,60,27,65,33062.159421,1068.555172,30667.425573,33079.422542,45108.083389,42.83,1.85,0
2027.500000,73,-72,95,-2912.418045,-12984.118939,-55399.217725,13306.747292,56974.931751,-76.49,-102.64,0
2027.500000,96,-46,-85,18947.658009,6129.590452,-21631.434316,19914.457641,29402.458634,-47.37,17.93,0
2027.500000,0,-13,-59,21365.849306,-6732.560620,-6112.313520,22401.493010,23220.406233,-15.26,-17.49,0
2027.500000,16,66,-178,13821.326215,89.244328,54092.646409,13821.614337,55830.559897,75.67,0.37,0
2027.500000,72,-87,38,6926.051596,-15153.941754,-48295.635435,16661.696834,51088.947370,-70.97,-65.44,0
2028.000000,49,20,167,30131.436134,2689.876669,15295.611788,30251.262453,33898.298187,26.82,5.10,0
2028.000000,71,5,-13,28142.647915,-3192.970202,-9017.928693,28323.200567,29724.177504,-17.66,-6.47,0
2028.000000,95,14,65,36932.466767,-329.910612,11601.180703,36933.940251,38713.089985,17.44,-0.51,0
2028.000000,86,-85,-79,12713.115116,11085.480728,-46988.258092,16867.459172,49924.018042,-70.25,41.09,0
2028.000000,30,-36,-64,17341.333537,-1411.102609,-14639.967305,17398.651081,22738.551012,-40.08,-4.65,0
2028.000000,75,79,125,2447.595900,-823.235047,57308.751756,2582.332595,57366.902212,87.42,-18.59,0
2028.000000,21,6,-32,27567.094260,-7045.034525,-4352.046687,28453.070088,28783.980055,-8.70,-14.34,0
2028.000000,1,-76,-75,16993.742946,9761.147808,-42479.847250,19597.635210,46782.525885,-65.23,29.87,0
2028.000000,45,-46,-41,13609.973828,-2812.623735,-19816.196211,13897.562372,24203.798713,-54.96,-11.68,0
2028.000000,11,-22,-21,12430.606447,-5337.987778,-21373.837958,13528.270036,25295.356080,-57.67,-23.24,0
2028.500000,28,54,-120,14735.145798,4066.959949,52393.678137,15286.094495,54578.037650,73.74,15.43,0
2028.500000,68,-58,156,6944.959164,6159.591995,-62264.415929,9282.943032,62952.605366,-81.52,41.57,0
2028.500000,39,-65,-88,17946.905687,10131.662696,-35982.872979,20609.270068,41466.964689,-60.20,29.45,0
2028.500000,27,-23,81,24940.672257,-5883.907569,-41948.733657,25625.329284,49156.421313,-58.58,-13.27,0
2028.500000,11,34,0,29078.234597,798.434048,30945.577813,29089.194286,42471.284539,46.77,1.57,0
2028.500000,72,-62,65,6567.891205,-16150.440331,-44267.327811,17434.847799,47576.992646,-68.50,-67.87,0
2028.500000,55,86,70,901.741754,2192.139033,55926.154052,2370.361097,55976.363930,87.57,67.64,0
2028.500000,59,32,163,28217.104175,75.200106,26405.862611,28217.204381,38645.571587,43.10,0.15,0
2028.500000,65,48,148,23365.167010,-3931.047029,44177.553125,23693.546804,50130.233993,61.79,-9.55,0
2028.500000,95,30,28,29692.133298,2367.965026,29039.808439,29786.406936,41599.765773,44.27,4.56,0
2029.000000,95,-60,-59,17893.018948,2700.105868,-26011.845842,18095.598879,31687.013474,-55.17,8.58,0
2029.000000,95,-70,42,10426.249753,-14920.796381,-38237.047006,18202.660480,42348.655378,-64.54,-55.06,0
2029.000000,50,87,-154,257.877420,-869.484879,55992.308183,906.920459,55999.652503,89.07,-73.48,0
2029.000000,58,32,19,29359.395781,2108.188210,30508.465542,29434.989012,42393.219362,46.03,4.11,0
2029.000000,57,34,-13,28241.863242,-933.225495,28997.458189,28257.277809,40488.595068,45.74,-1.89,0
2029.000000,38,-76,49,7991.121323,-16588.167977,-44151.303941,18412.640681,47836.837024,-67.36,-64.28,0
2029.000000,49,-50,-179,15315.042731,9610.272521,-53522.651338,18080.593790,56494.088877,-71.33,32.11,0
2029.000000,90,-55,-171,12821.507915,10252.398258,-52995.143972,16416.538468,55479.618058,-72.79,38.65,0
2029.000000,41,42,-19,24439.977735,-1762.893879,36929.897501,24503.475397,44319.720622,56.44,-4.13,0
2029.000000,19,46,-22,22522.142232,-2227.393290,40651.688191,22632.016516,46527.066578,60.89,-5.65,0
2029.500000,31,13,-132,27795.620707,4421.061344,17187.983590,28145.022897,32978.312476,31.41,9.04,0
2029.500000,93,-2,158,33806.520595,4207.156292,-10964.647547,34067.301020,35788.329028,-17.84,7.09,0
2029.500000,51,-76,40,10263.650094,-15412.758102,-42018.541264,18517.441118,45917.898858,-66.22,-56.34,0
2029.500000,64,22,-132,25601.266218,4619.955329,24914.378368,26014.780783,36020.758857,43.76,10.23,0
2029.500000,26,-65,55,8347.198524,-16728.868464,-41431.528035,18695.741849,45454.397791,-65.71,-63.48,0
2029.500000,66,-21,32,15578.335534,-4066.430831,-24494.877642,16100.322907,29312.444941,-56.68,-14.63,0
2029.500000,18,9,-172,30520.999126,4966.941695,8779.472279,30922.514410,32144.689001,15.85,9.24,0
2029.500000,63,88,26,2041.140972,1511.567287,55286.620082,2539.900024,55344.931586,87.37,36.52,0
2029.500000,33,17,5,34021.976056,531.446418,8341.137769,34026.126581,35033.582023,13.77,0.89,0
2029.500000,77,-18,138,31751.497580,2472.257962,-34817.395113,31847.600506,47186.021876,-47.55,4.45,0
1 date alt lat lon x y z h f incl decl gv
2 2015.0 0 80 0 6627.1 -445.9 54432.3 6642.1 54836.0 83.04 -3.85 -3.85
3 2015.0 0 0 120 39518.2 392.9 -11252.4 39520.2 41090.9 -15.89 0.57 0.57
4 2015.0 0 -80 240 5797.3 15761.1 -52919.1 16793.5 55519.8 -72.39 69.81 309.81
5 2015.0 100 80 0 6314.3 -471.6 52269.8 6331.9 52652.0 83.09 -4.27 -4.27
6 2015.0 100 0 120 37535.6 364.4 -10773.4 37537.3 39052.7 -16.01 0.56 0.56
7 2015.0 100 -80 240 5613.1 14791.5 -50378.6 15820.7 52804.4 -72.57 69.22 309.22
8 2017.5 0 80 0 6599.4 -317.1 54459.2 6607.0 54858.5 83.08 -2.75 -2.75
9 2017.5 0 0 120 39571.4 222.5 -11030.1 39572.0 41080.5 -15.57 0.32 0.32
10 2017.5 0 -80 240 5873.8 15781.4 -52687.9 16839.1 55313.4 -72.28 69.58 309.58
11 2017.5 100 80 0 6290.5 -348.5 52292.7 6300.1 52670.9 83.13 -3.17 -3.17
12 2017.5 100 0 120 37585.5 209.5 -10564.2 37586.1 39042.5 -15.70 0.32 0.32
13 2017.5 100 -80 240 5683.5 14808.8 -50163.0 15862.0 52611.1 -72.45 69.00 309.00
14 2015.21096 0 44.5364 -109.0461 18702.1 3663.7 50812.2 19057.5 54268.5 69.44104 11.08386 0
15 2020.0 28 89 -121 -575.7 -1396.0 56082.3 1510.0 56102.7 88.46 -112.41 0
16 2020.0 48 80 -96 1518.0 -1160.5 55671.9 1910.8 55704.7 88.03 -37.40 0
17 2020.0 54 82 87 1555.6 1941.4 56520.5 2487.8 56575.2 87.48 51.30 0
18 2020.0 65 43 93 24375.3 303.2 49691.4 24377.2 55348.7 63.87 0.71 0
19 2020.0 51 -33 109 21556.3 -2183.2 -52676.0 21666.6 56957.9 -67.64 -5.78 0
20 2020.0 39 -59 -8 14369.9 -4063.3 -24679.0 14933.4 28845.4 -58.82 -15.79 0
21 2020.0 3 -50 -103 19684.4 10512.2 -31883.6 22315.5 38917.2 -55.01 28.10 0
22 2020.0 94 -29 -110 23467.8 6650.9 -19320.7 24392.0 31116.9 -38.38 15.82 0
23 2020.0 66 14 143 34916.8 70.2 8114.9 34916.9 35847.5 13.08 0.12 0
24 2020.0 18 0 21 29311.2 536.0 -14589.0 29316.1 32745.6 -26.46 1.05 0
25 2020.5 6 -36 -137 23948.6 8791.9 -32897.6 25511.4 41630.3 -52.21 20.16 0
26 2020.5 63 26 81 34737.7 259.2 30023.4 34738.7 45914.9 40.84 0.43 0
27 2020.5 69 38 -144 22647.3 5390.0 35831.9 23279.9 42730.3 56.99 13.39 0
28 2020.5 50 -70 -133 8943.1 13981.7 -51628.5 16597.2 54230.7 -72.18 57.40 0
29 2020.5 8 -52 -75 19571.7 5387.5 -23769.0 20299.7 31257.7 -49.50 15.39 0
30 2020.5 8 -66 17 15247.0 -9734.8 -31062.0 18089.7 35945.6 -59.78 -32.56 0
31 2020.5 22 -37 140 21429.0 3451.3 -55415.6 21705.2 59514.7 -68.61 9.15 0
32 2020.5 40 -12 -129 28773.9 5503.9 -8221.8 29295.6 30427.4 -15.68 10.83 0
33 2020.5 44 33 -118 23414.3 4748.3 38184.5 23890.9 45042.6 57.97 11.46 0
34 2020.5 50 -81 -67 16087.9 8788.9 -44780.8 18332.1 48387.8 -67.74 28.65 0
35 2021.0 74 -57 3 13228.0 -5423.3 -23859.2 14296.6 27814.7 -59.07 -22.29 0
36 2021.0 46 -24 -122 26037.0 6501.8 -18297.4 26836.5 32480.6 -34.29 14.02 0
37 2021.0 69 23 63 34450.4 646.9 24869.2 34456.5 42493.9 35.82 1.08 0
38 2021.0 33 -3 -147 30690.1 5265.7 -1277.4 31138.6 31164.8 -2.35 9.74 0
39 2021.0 47 -72 -22 18352.8 -1946.6 -33665.0 18455.7 38392.0 -61.27 -6.05 0
40 2021.0 62 -14 99 33213.0 -990.3 -33354.0 33227.7 47080.5 -45.11 -1.71 0
41 2021.0 83 86 -46 2408.8 -1796.2 54184.7 3004.8 54268.0 86.83 -36.71 0
42 2021.0 82 -64 87 2249.5 -13907.0 -53526.9 14087.8 55349.8 -75.25 -80.81 0
43 2021.0 34 -19 43 19327.6 -4933.5 -25969.5 19947.3 32746.2 -52.47 -14.32 0
44 2021.0 56 -81 40 9198.0 -15323.4 -45453.8 17872.0 48841.2 -68.54 -59.03 0
45 2021.5 14 0 80 39246.6 -2338.9 -12258.0 39316.2 41182.8 -17.32 -3.41 0
46 2021.5 12 -82 -68 15995.1 9368.5 -46308.7 18536.8 49880.9 -68.18 30.36 0
47 2021.5 44 -46 -42 14159.0 -2889.8 -19762.2 14450.9 24482.1 -53.82 -11.54 0
48 2021.5 43 17 52 35896.1 773.7 15885.6 35904.4 39261.7 23.87 1.23 0
49 2021.5 64 10 78 39294.0 -1172.2 5088.1 39311.5 39639.4 7.37 -1.71 0
50 2021.5 12 33 -145 24301.2 5327.4 32429.3 24878.3 40872.8 52.51 12.36 0
51 2021.5 12 -79 115 -9403.6 -8972.3 -58271.0 12997.3 59702.9 -77.43 -136.34 0
52 2021.5 14 -33 -114 23592.3 7712.3 -24163.1 24820.9 34640.0 -44.23 18.10 0
53 2021.5 19 29 66 32618.0 1215.2 33763.7 32640.6 46961.7 45.97 2.13 0
54 2021.5 86 -11 167 32676.0 5828.1 -20299.1 33191.7 38906.8 -31.45 10.11 0
55 2022.0 37 -66 -5 16404.3 -5011.2 -28849.5 17152.6 33563.5 -59.27 -16.99 0
56 2022.0 67 72 -115 4532.7 1254.7 55923.4 4703.2 56120.8 85.19 15.47 0
57 2022.0 44 22 174 28671.0 3294.9 17967.2 28859.7 33995.6 31.91 6.56 0
58 2022.0 54 54 178 20624.8 514.8 45076.8 20631.2 49573.8 65.41 1.43 0
59 2022.0 57 -43 50 11344.6 -12349.5 -32850.3 16769.3 36883.0 -62.96 -47.43 0
60 2022.0 44 -43 -111 20646.1 9330.1 -29747.5 22656.4 37392.8 -52.71 24.32 0
61 2022.0 12 -63 178 6292.0 9718.1 -61429.1 11577.2 62510.5 -79.33 57.08 0
62 2022.0 38 27 -169 25896.5 3991.3 24097.4 26202.3 35598.4 42.60 8.76 0
63 2022.0 61 59 -77 10098.3 -3208.9 54735.3 10595.8 55751.4 79.04 -17.63 0
64 2022.0 67 -47 -32 12663.7 -3178.2 -20600.9 13056.5 24389.9 -57.63 -14.09 0
65 2022.5 8 62 53 12336.1 4236.6 54498.1 13043.3 56037.2 76.54 18.95 0
66 2022.5 77 -68 -7 16604.7 -4741.2 -29908.6 17268.3 34535.8 -60.00 -15.94 0
67 2022.5 98 -5 159 33613.6 4601.1 -14426.9 33927.0 36867.1 -23.04 7.79 0
68 2022.5 34 -29 -107 23739.9 6662.3 -19023.5 24657.0 31142.6 -37.65 15.68 0
69 2022.5 60 27 65 32938.8 1025.8 30561.3 32954.8 44944.6 42.84 1.78 0
70 2022.5 73 -72 95 -2661.0 -13095.2 -55423.4 13362.8 57011.5 -76.44 -101.49 0
71 2022.5 96 -46 -85 19136.4 6358.2 -21915.4 20165.1 29781.1 -47.38 18.38 0
72 2022.5 0 -13 -59 21797.3 -6520.6 -5425.9 22751.7 23389.8 -13.41 -16.65 0
73 2022.5 16 66 -178 13804.5 463.2 54055.4 13812.2 55792.1 75.67 1.92 0
74 2022.5 72 -87 38 7132.3 -15063.2 -48550.5 16666.4 51331.5 -71.05 -64.66 0
75 2023.0 49 20 167 30099.4 2737.4 15301.2 30223.6 33876.1 26.85 5.20 0
76 2023.0 71 5 -13 28217.7 -3592.6 -8905.8 28445.5 29807.1 -17.38 -7.26 0
77 2023.0 95 14 65 36804.1 -356.8 11616.0 36805.8 38595.3 17.52 -0.56 0
78 2023.0 86 -85 -79 12598.0 11248.0 -47331.2 16888.7 50254.0 -70.36 41.76 0
79 2023.0 30 -36 -64 17694.8 -1198.1 -14566.5 17735.3 22950.5 -39.40 -3.87 0
80 2023.0 75 79 125 2605.8 -676.0 57085.9 2692.1 57149.3 87.30 -14.54 0
81 2023.0 21 6 -32 27630.5 -7515.0 -3646.9 28634.3 28865.6 -7.26 -15.22 0
82 2023.0 1 -76 -75 16998.9 9958.1 -42873.8 19700.9 47183.6 -65.32 30.36 0
83 2023.0 45 -46 -41 13880.3 -2936.1 -19853.0 14187.4 24401.3 -54.45 -11.94 0
84 2023.0 11 -22 -21 12752.8 -5710.4 -21372.4 13972.9 25534.7 -56.82 -24.12 0
85 2023.5 28 54 -120 14556.6 4230.3 52945.6 15158.8 55072.9 74.02 16.20 0
86 2023.5 68 -58 156 7015.1 5987.8 -62459.5 9223.1 63136.8 -81.60 40.48 0
87 2023.5 39 -65 -88 18024.0 10347.2 -36415.6 20783.0 41928.8 -60.29 29.86 0
88 2023.5 27 -23 81 24811.0 -6176.1 -41759.2 25568.2 48965.0 -58.52 -13.98 0
89 2023.5 11 34 0 29033.7 545.3 30807.0 29038.8 42335.9 46.69 1.08 0
90 2023.5 72 -62 65 6836.8 -16092.9 -44111.8 17485.0 47450.8 -68.38 -66.98 0
91 2023.5 55 86 70 1168.7 2124.7 55750.6 2424.9 55803.4 87.51 61.19 0
92 2023.5 59 32 163 28170.0 176.0 26318.3 28170.6 38551.7 43.05 0.36 0
93 2023.5 65 48 148 23356.8 -3861.2 43968.0 23673.8 49936.3 61.70 -9.39 0
94 2023.5 95 30 28 29663.3 2331.2 28857.6 29754.7 41450.1 44.12 4.49 0
95 2024.0 95 -60 -59 18099.3 2821.2 -26193.2 18317.9 31962.9 -55.03 8.86 0
96 2024.0 95 -70 42 10615.3 -14769.3 -38293.4 18188.3 42393.4 -64.59 -54.29 0
97 2024.0 50 87 -154 80.9 -592.4 55904.6 597.9 55907.8 89.39 -82.22 0
98 2024.0 58 32 19 29331.6 2019.5 30329.8 29401.0 42241.2 45.89 3.94 0
99 2024.0 57 34 -13 28158.7 -1290.8 29015.5 28188.3 40453.4 45.83 -2.62 0
100 2024.0 38 -76 49 8218.0 -16491.7 -44260.7 18425.8 47942.9 -67.40 -63.51 0
101 2024.0 49 -50 -179 15431.4 9482.7 -53818.3 18112.2 56784.4 -71.40 31.57 0
102 2024.0 90 -55 -171 12918.7 10118.6 -53373.5 16409.7 55839.2 -72.91 38.07 0
103 2024.0 41 42 -19 24317.3 -2127.0 36981.3 24410.2 44311.1 56.57 -5.00 0
104 2024.0 19 46 -22 22384.7 -2590.4 40713.3 22534.0 46533.4 61.04 -6.60 0
105 2024.5 31 13 -132 28046.9 4548.8 17417.2 28413.4 33326.9 31.51 9.21 0
106 2024.5 93 -2 158 33858.1 4253.5 -10940.3 34124.3 35835.1 -17.78 7.16 0
107 2024.5 51 -76 40 10459.6 -15294.7 -42141.5 18529.2 46035.2 -66.27 -55.63 0
108 2024.5 64 22 -132 25808.9 4792.5 25239.1 26250.1 36415.3 43.88 10.52 0
109 2024.5 26 -65 55 8607.6 -16603.5 -41366.0 18702.1 45397.3 -65.67 -62.60 0
110 2024.5 66 -21 32 15510.7 -3677.9 -24502.7 15940.8 29231.7 -56.95 -13.34 0
111 2024.5 18 9 -172 30615.4 5065.5 8768.5 31031.6 32246.7 15.78 9.39 0
112 2024.5 63 88 26 2189.6 1254.6 55156.1 2523.6 55213.8 87.38 29.81 0
113 2024.5 33 17 5 34060.9 362.9 8230.6 34062.9 35043.1 13.58 0.61 0
114 2024.5 77 -18 138 31722.0 2569.6 -34986.2 31825.9 47296.1 -47.71 4.63 0
115 2025.000000 28 89 -121 -255.388723 -1482.460628 56194.288771 1504.298146 56214.419888 88.47 -99.77 0
116 2025.000000 48 80 -96 1875.982280 -1079.269389 55623.044051 2164.285547 55665.134163 87.77 -29.91 0
117 2025.000000 54 82 87 1324.336929 1883.428620 56740.772059 2302.427342 56787.466800 87.68 54.89 0
118 2025.000000 65 43 93 24299.852822 210.517066 50037.923998 24300.764692 55626.621348 64.10 0.50 0
119 2025.000000 51 -33 109 21737.778822 -2090.274098 -52710.003920 21838.046477 57054.752538 -67.50 -5.49 0
120 2025.000000 39 -59 -8 14358.095523 -4049.107540 -24389.086374 14918.115796 28589.818346 -58.55 -15.75 0
121 2025.000000 3 -50 -103 19526.532799 10362.990980 -31437.562789 22106.041373 38431.724126 -54.89 27.96 0
122 2025.000000 94 -29 -110 23275.471080 6559.046509 -19063.605287 24181.990098 30792.688931 -38.25 15.74 0
123 2025.000000 66 14 143 35003.441364 -116.624818 7966.315182 35003.635649 35898.700342 12.82 -0.19 0
124 2025.000000 18 0 21 29274.811882 659.800118 -14316.722540 29282.246275 32594.761714 -26.06 1.29 0
125 2025.500000 6 -36 -137 23781.930678 8786.698927 -32577.518648 25353.230658 41280.516301 -52.11 20.28 0
126 2025.500000 63 26 81 34802.613433 308.431881 30332.056989 34803.980117 46166.554053 41.07 0.51 0
127 2025.500000 69 38 -144 22510.804524 5167.636206 35525.990264 23096.337032 42373.774537 56.97 12.93 0
128 2025.500000 50 -70 -133 9021.847823 14001.865232 -51084.838301 16656.709403 53731.803175 -71.94 57.21 0
129 2025.500000 8 -52 -75 19331.857134 5147.774727 -23532.664273 20005.506364 30886.996822 -49.63 14.91 0
130 2025.500000 8 -66 17 15201.438652 -9925.501123 -30881.123197 18154.870136 35822.382382 -59.55 -33.14 0
131 2025.500000 22 -37 140 21404.761773 3498.897430 -55397.587760 21688.847590 59492.006517 -68.62 9.28 0
132 2025.500000 40 -12 -129 28594.451238 5432.201489 -8052.525092 29105.866326 30199.248583 -15.46 10.76 0
133 2025.500000 44 33 -118 23235.835850 4558.379362 37727.715752 23678.743422 44542.826874 57.89 11.10 0
134 2025.500000 50 -81 -67 16132.682326 8623.494405 -44412.283868 18292.842720 48032.062762 -67.61 28.13 0
135 2026.000000 74 -57 3 13268.119649 -5498.179626 -23576.062921 14362.206593 27606.226129 -58.65 -22.51 0
136 2026.000000 46 -24 -122 25846.118652 6448.863284 -18080.399376 26638.500090 32194.883578 -34.17 14.01 0
137 2026.000000 69 23 63 34558.605297 708.078839 25043.405885 34565.858527 42684.549360 35.92 1.17 0
138 2026.000000 33 -3 -147 30514.086409 5221.840663 -1146.978999 30957.666082 30978.906535 -2.12 9.71 0
139 2026.000000 47 -72 -22 18280.800055 -2024.105320 -33397.486160 18392.516222 38127.112857 -61.16 -6.32 0
140 2026.000000 62 -14 99 33437.828630 -835.919473 -33100.922253 33448.275663 47058.030120 -44.70 -1.43 0
141 2026.000000 83 86 -46 2582.099403 -1527.839829 54279.308437 3000.255301 54362.163830 86.84 -30.61 0
142 2026.000000 82 -64 87 2007.074870 -13829.362571 -53663.514288 13974.248411 55453.154865 -75.40 -81.74 0
143 2026.000000 34 -19 43 19525.694050 -5224.017527 -26182.862330 20212.448819 33076.961273 -52.33 -14.98 0
144 2026.000000 56 -81 40 9000.536024 -15446.900890 -45267.890393 17877.818542 48670.301997 -68.45 -59.77 0
145 2026.500000 14 0 80 39431.415992 -2133.456168 -12188.838466 39489.089663 41327.424134 -17.15 -3.10 0
146 2026.500000 12 -82 -68 16052.819558 9190.416754 -45940.146795 18497.480257 49524.275496 -68.07 29.79 0
147 2026.500000 44 -46 -42 13863.176808 -2785.834358 -19744.304022 14140.316272 24285.511845 -54.39 -11.36 0
148 2026.500000 43 17 52 35994.907968 747.876551 15990.895993 36002.676553 39394.180708 23.95 1.19 0
149 2026.500000 64 10 78 39427.724480 -1049.971869 5214.811025 39441.702532 39784.948821 7.53 -1.53 0
150 2026.500000 12 33 -145 24136.839639 5112.225422 32162.934508 24672.289649 40536.110231 52.51 11.96 0
151 2026.500000 12 -79 115 -9613.650418 -8785.714482 -58104.306533 13023.480845 59545.961164 -77.37 -137.58 0
152 2026.500000 14 -33 -114 23393.133584 7653.110952 -23854.293436 24613.183584 34275.882505 -44.10 18.12 0
153 2026.500000 19 29 66 32725.000691 1278.343380 33958.454002 32749.959268 47177.711160 46.04 2.24 0
154 2026.500000 86 -11 167 32578.377044 5882.794932 -20368.224196 33105.255278 38869.300019 -31.60 10.24 0
155 2027.000000 37 -66 -5 16390.771268 -5079.626554 -28608.243575 17159.836500 33360.029814 -59.04 -17.22 0
156 2027.000000 67 72 -115 4883.287833 1192.857435 55689.615237 5026.868699 55916.032175 84.84 13.73 0
157 2027.000000 44 22 174 28683.972510 3249.857362 17961.198575 28867.487799 33999.066253 31.89 6.46 0
158 2027.000000 54 54 178 20615.871559 225.041793 45149.631876 20617.099795 49634.202547 65.46 0.63 0
159 2027.000000 57 -43 50 11203.748204 -12563.437494 -33221.366617 16833.417225 37242.759503 -63.13 -48.27 0
160 2027.000000 44 -43 -111 20471.522067 9245.505620 -29347.556906 22462.470699 36957.295441 -52.57 24.31 0
161 2027.000000 12 -63 178 6233.774935 9925.455386 -61075.730989 11720.691727 62190.188377 -79.14 57.87 0
162 2027.000000 38 27 -169 25821.061601 3851.701313 24058.365347 26106.758229 35501.658671 42.66 8.48 0
163 2027.000000 61 59 -77 10437.775689 -3087.391846 54397.713552 10884.812802 55476.034370 78.68 -16.48 0
164 2027.000000 67 -47 -32 12450.832543 -2994.148743 -20475.298079 12805.786103 24150.072239 -57.98 -13.52 0
165 2027.500000 8 62 53 12260.425578 4315.497527 54849.810218 12997.751893 56368.814385 76.67 19.39 0
166 2027.500000 77 -68 -7 16578.099495 -4813.676173 -29680.383821 17262.817301 34335.550744 -59.82 -16.19 0
167 2027.500000 98 -5 159 33544.960996 4589.735713 -14525.780052 33857.496691 36841.937629 -23.22 7.79 0
168 2027.500000 34 -29 -107 23540.396213 6592.363667 -18723.097084 24446.053109 30792.269761 -37.45 15.64 0
169 2027.500000 60 27 65 33062.159421 1068.555172 30667.425573 33079.422542 45108.083389 42.83 1.85 0
170 2027.500000 73 -72 95 -2912.418045 -12984.118939 -55399.217725 13306.747292 56974.931751 -76.49 -102.64 0
171 2027.500000 96 -46 -85 18947.658009 6129.590452 -21631.434316 19914.457641 29402.458634 -47.37 17.93 0
172 2027.500000 0 -13 -59 21365.849306 -6732.560620 -6112.313520 22401.493010 23220.406233 -15.26 -17.49 0
173 2027.500000 16 66 -178 13821.326215 89.244328 54092.646409 13821.614337 55830.559897 75.67 0.37 0
174 2027.500000 72 -87 38 6926.051596 -15153.941754 -48295.635435 16661.696834 51088.947370 -70.97 -65.44 0
175 2028.000000 49 20 167 30131.436134 2689.876669 15295.611788 30251.262453 33898.298187 26.82 5.10 0
176 2028.000000 71 5 -13 28142.647915 -3192.970202 -9017.928693 28323.200567 29724.177504 -17.66 -6.47 0
177 2028.000000 95 14 65 36932.466767 -329.910612 11601.180703 36933.940251 38713.089985 17.44 -0.51 0
178 2028.000000 86 -85 -79 12713.115116 11085.480728 -46988.258092 16867.459172 49924.018042 -70.25 41.09 0
179 2028.000000 30 -36 -64 17341.333537 -1411.102609 -14639.967305 17398.651081 22738.551012 -40.08 -4.65 0
180 2028.000000 75 79 125 2447.595900 -823.235047 57308.751756 2582.332595 57366.902212 87.42 -18.59 0
181 2028.000000 21 6 -32 27567.094260 -7045.034525 -4352.046687 28453.070088 28783.980055 -8.70 -14.34 0
182 2028.000000 1 -76 -75 16993.742946 9761.147808 -42479.847250 19597.635210 46782.525885 -65.23 29.87 0
183 2028.000000 45 -46 -41 13609.973828 -2812.623735 -19816.196211 13897.562372 24203.798713 -54.96 -11.68 0
184 2028.000000 11 -22 -21 12430.606447 -5337.987778 -21373.837958 13528.270036 25295.356080 -57.67 -23.24 0
185 2028.500000 28 54 -120 14735.145798 4066.959949 52393.678137 15286.094495 54578.037650 73.74 15.43 0
186 2028.500000 68 -58 156 6944.959164 6159.591995 -62264.415929 9282.943032 62952.605366 -81.52 41.57 0
187 2028.500000 39 -65 -88 17946.905687 10131.662696 -35982.872979 20609.270068 41466.964689 -60.20 29.45 0
188 2028.500000 27 -23 81 24940.672257 -5883.907569 -41948.733657 25625.329284 49156.421313 -58.58 -13.27 0
189 2028.500000 11 34 0 29078.234597 798.434048 30945.577813 29089.194286 42471.284539 46.77 1.57 0
190 2028.500000 72 -62 65 6567.891205 -16150.440331 -44267.327811 17434.847799 47576.992646 -68.50 -67.87 0
191 2028.500000 55 86 70 901.741754 2192.139033 55926.154052 2370.361097 55976.363930 87.57 67.64 0
192 2028.500000 59 32 163 28217.104175 75.200106 26405.862611 28217.204381 38645.571587 43.10 0.15 0
193 2028.500000 65 48 148 23365.167010 -3931.047029 44177.553125 23693.546804 50130.233993 61.79 -9.55 0
194 2028.500000 95 30 28 29692.133298 2367.965026 29039.808439 29786.406936 41599.765773 44.27 4.56 0
195 2029.000000 95 -60 -59 17893.018948 2700.105868 -26011.845842 18095.598879 31687.013474 -55.17 8.58 0
196 2029.000000 95 -70 42 10426.249753 -14920.796381 -38237.047006 18202.660480 42348.655378 -64.54 -55.06 0
197 2029.000000 50 87 -154 257.877420 -869.484879 55992.308183 906.920459 55999.652503 89.07 -73.48 0
198 2029.000000 58 32 19 29359.395781 2108.188210 30508.465542 29434.989012 42393.219362 46.03 4.11 0
199 2029.000000 57 34 -13 28241.863242 -933.225495 28997.458189 28257.277809 40488.595068 45.74 -1.89 0
200 2029.000000 38 -76 49 7991.121323 -16588.167977 -44151.303941 18412.640681 47836.837024 -67.36 -64.28 0
201 2029.000000 49 -50 -179 15315.042731 9610.272521 -53522.651338 18080.593790 56494.088877 -71.33 32.11 0
202 2029.000000 90 -55 -171 12821.507915 10252.398258 -52995.143972 16416.538468 55479.618058 -72.79 38.65 0
203 2029.000000 41 42 -19 24439.977735 -1762.893879 36929.897501 24503.475397 44319.720622 56.44 -4.13 0
204 2029.000000 19 46 -22 22522.142232 -2227.393290 40651.688191 22632.016516 46527.066578 60.89 -5.65 0
205 2029.500000 31 13 -132 27795.620707 4421.061344 17187.983590 28145.022897 32978.312476 31.41 9.04 0
206 2029.500000 93 -2 158 33806.520595 4207.156292 -10964.647547 34067.301020 35788.329028 -17.84 7.09 0
207 2029.500000 51 -76 40 10263.650094 -15412.758102 -42018.541264 18517.441118 45917.898858 -66.22 -56.34 0
208 2029.500000 64 22 -132 25601.266218 4619.955329 24914.378368 26014.780783 36020.758857 43.76 10.23 0
209 2029.500000 26 -65 55 8347.198524 -16728.868464 -41431.528035 18695.741849 45454.397791 -65.71 -63.48 0
210 2029.500000 66 -21 32 15578.335534 -4066.430831 -24494.877642 16100.322907 29312.444941 -56.68 -14.63 0
211 2029.500000 18 9 -172 30520.999126 4966.941695 8779.472279 30922.514410 32144.689001 15.85 9.24 0
212 2029.500000 63 88 26 2041.140972 1511.567287 55286.620082 2539.900024 55344.931586 87.37 36.52 0
213 2029.500000 33 17 5 34021.976056 531.446418 8341.137769 34026.126581 35033.582023 13.77 0.89 0
214 2029.500000 77 -18 138 31751.497580 2472.257962 -34817.395113 31847.600506 47186.021876 -47.55 4.45 0
+27
View File
@@ -0,0 +1,27 @@
Savage Benchmark (100 runs) Double Precision
--------------------------------------------
The first four are from [TS Kelso's System Benchmarking column](http://celestrak.com/columns/v02n04/)
The Core i7 is Shashwat Kandadai's personal laptop
```
Value: Avg Time:
386DX-33 2500.00000000117734 6.81 s 33 MHz : MS-DOS 6.20
486DX2-66 " 1.26 s 66 MHz : Windows 95
Pentium 90 " 0.55 s 90 MHz : Windows 95
Pentium 133 " 0.38 s 133 MHz : Windows 95
Core i7 2500.0000000025643 0.58 ms 2.0 GHz : Mac OS X
```
Full day propagation results (1440 propagations)
-------------------------------------------------
```
Honeywell-6000 (from Space-Track Report #3)
init ms prpgtion ms
SGP4 1.9 2.5
SDP4 5.1 3.6
Core i7 (Shashwat Kandadai's personal computer)
init ms prpgtion ms
SGP4 0.074 0.0017
SDP4 0.092 0.0046
```
+130
View File
@@ -0,0 +1,130 @@
# Changelog
## 6.0.2
- fix: `twoline2satrec` couldn't parse eccentricity padded with spaces instead of zeros
(this only affects TLE generated by rare specialized software; see #153)
## 6.0.1 (2025-07-04)
- fix: `json2satrec` couldn't parse OMM `EPOCH` that was ending with Z
- fix: `OMMJsonObject.REV_AT_EPOCH` is made optional according to OMM spec
## 6.0.0 (2025-04-06)
- chore: The library is rewritten to TypeScript and type definitions are now not hand-written
but compiled from source code.
- feature: New `json2satrec` function that allows parsing orbital elements in
[OMM](https://www.nasa.gov/wp-content/uploads/2017/12/orbit_data_messages.pdf) format,
**encoded as JSON**. Orbital elements in OMM format are already available for download
from Celestrak and Space-Track. `json2satrec` supports both of these sources and aims
to support all sources of properly formatted OMM data.
To obtain OMM as JSON from Celestrak, select "JSON" option at the top of "Current GP
Element Sets" page or follow
[this link](https://celestrak.org/NORAD/elements/index.php?FORMAT=json) where it will
be already selected.
Space-Track doesn't expose the JSON format in their UI, so to get JSON encoded OMM,
on "Recent ELSETs" page, from "Current Catalog Files", copy a URL for the needed category
and change the ending part of the URL from `/format/xml` to be `/format/json`.
- **BREAKING**: The return type of the `sgp4` and `propagate` functions is changed from:
```ts
{
position: EciVec3<Kilometer> | false
velocity: EciVec3<KilometerPerSecond> | false
}
```
to:
```ts
null | {
position: EciVec3<Kilometer>
velocity: EciVec3<KilometerPerSecond>
meanElements: MeanElements
}
```
Where, if propagation failed, `null` is returned instead of individual keys set to `false`.
- **BREAKING**: removed overloads of `gstime` and return types of `sgp4` and `propagate` that
were not documented by TypeScript definitions as of v5.0.0, but could happen in runtime with v5.0.0.
- feature: New `SatRecError` enum that lists all error codes that can be set on `SatRec.error`.
- feature: `sgp4` and `propagate` function result object returns `meanElements` key,
which is orbit parameters as they have evolved at the propagation moment. Since they are always
internally calculated by SGP4 model, this doesn't impact performance.
- feature: New `sunPos` function that calculates Sun position at date, useful to calculate if
a satellite is in Earth umbra. Its accuracy is within 0.01 angular degree between years
1950 and 2050.
- feature: Many additional properties of `SatRec` are documented
- fix: `dopplerFactor` produces correct results depending on if the satellite is moving
towards or away from the observer.
## 5.0.0 (2023-01-06)
- Errors in calculations are fixed, WGS72 is used instead of WGS84 (#107).
- Dependencies are upgraded.
## 4.1.4 (2022-07-18)
- TypeScript definition for `ecfToEci` function is added.
## 4.1.3 (2020-12-18)
- Fixed calculation of Doppler effect (`dopplerFactor`).
## 4.1.2 (2020-10-13)
- Expose `error` in TypeScript definition of `SatRec`.
- Fix TypeScript definition for `PositionAndVelocity` to allow error handling.
## 4.1.1 (2020-09-15)
- Fix TypeScript definition for `gstime` (#73).
- Fix documentation and TypeScript definition for `degreesLong` and `degreesLat` (#74).
## 4.1.0 (2020-09-14)
- TypeScript support is added via new TypeScript definitions file (#71).
- Rollup and some other dependencies are upgraded.
## 4.0.0 (2020-01-21)
- Node.js 12 support is added. Node.js 6 and Node.js 8 support is dropped (breaking change).
- Mocha, Chai and Istanbul are replaced by [Jest](https://jestjs.io/).
- Dependencies are upgraded.
## 3.0.1 (2019-03-14)
- Unnecessary calculations in `sgp4` function are reduced (#47).
- `vkmpersec` calculation is moved to constants (#50).
- `degreesToRadians` function is used in docs instead of `deg2rad` constant (#53).
- Typos' fixes (#54).
## 3.0.0 (2018-11-26)
- Node.js 4 support is dropped (breaking change).
- Deprecated functions `gstimeFromJday` and `gstimeFromDate` are removed (breaking change).
- New transformation functions are added: `radiansToDegrees`, `degreesToRadians`, `radiansLat`, `radiansLong`.
## 2.0.3 (2018-09-15)
- `satrec` object is not cloned in `sgp4` and `sgp4init` functions due to [performance reasons](https://github.com/shashwatak/satellite-js/issues/45).
## 2.0.2 (2018-04-16)
- [Wrong predictions for Molniya 3-47 orbits](https://github.com/shashwatak/satellite-js/issues/43) are fixed. Special thanks to [@nhamer](https://github.com/nhamer).
## 2.0.1 (2018-03-01)
- `sgp4` function's call result is used in `sgp4init`.
- Longitude of `eciToGeodetic` result is in [-PI; PI] range now.
## 2.0.0 (2017-12-23)
- Library became ES and Common.js compatible.
- Source code is reorganized to match [original Python library](https://pypi.python.org/pypi/sgp4/).
- `degreesLat` and `degreesLong` don't adjust input radians value and throw `RangeError` if it's out of bounds (breaking change).
- `invjday` function is added.
- [Julian day calculations take account of milliseconds](https://github.com/shashwatak/satellite-js/issues/31)
([#38](https://github.com/shashwatak/satellite-js/pull/38)).
- [Incorrect position and velocity bug](https://github.com/shashwatak/satellite-js/issues/26) for times not close to TLE epoch is fixed ([#37](https://github.com/shashwatak/satellite-js/pull/37)).
- Continuous integration and test coverage are provided.
- [Bower support is dropped](https://github.com/shashwatak/satellite-js/issues/40).
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (C) 2013 Shashwat Kandadai, UCSC Jack Baskin School of Engineering
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+130
View File
@@ -0,0 +1,130 @@
Metadata-Version: 1.0
Name: sgp4
Version: 1.1
Summary: Track earth satellite TLE orbits using up-to-date 2010 version of SGP4
Home-page: https://github.com/brandon-rhodes/python-sgp4
Author: Brandon Rhodes
Author-email: brandon@rhodesmill.org
License: MIT
Description:
This Python package computes the position and velocity of an
earth-orbiting satellite, given the satellite's TLE orbital elements
from a source like `Celestrak <http://celestrak.com/>`_. It implements
the most recent version of SGP4, and is regularly run against the SGP4
test suite to make sure that its satellite position predictions **agree
to within 1 µm** of the predictions of the standard C++ implementation
of the algorithm. This error is far less than the 1–3 km/day by which
satellites themselves deviate from the ideal orbits described in TLE
files.
The C++ function names have been retained, since users may already be
familiar with this library in other languages. Here is how to compute
the x,y,z position and velocity for Vanguard 1 at 12:50:19 on 29
June 2000:
>>> from sgp4.earth_gravity import wgs72
>>> from sgp4.io import twoline2rv
>>> line1 = ('1 00005U 58002B 00179.78495062 '
... '.00000023 00000-0 28098-4 0 4753')
>>> line2 = ('2 00005 34.2682 348.7242 1859667 '
... '331.7664 19.3264 10.82419157413667')
>>>
>>> satellite = twoline2rv(line1, line2, wgs72)
>>> position, velocity = satellite.propagate(
... 2000, 6, 29, 12, 50, 19)
>>>
>>> position
[5576.056952400586, -3999.371134576452, -1521.9571594376037]
>>> velocity
[4.772627303379319, 5.119817120959591, 4.275553909172126]
The position vector measures the satellite position in **meters** from
the center of the earth. The velocity is the rate at which those same
three parameters are changing, expressed in **meters per second**.
There are three gravity models available that you can import from the
``earth_gravity`` module:
* ``wgs72``
* ``wgs72old``
* ``wgs84``
The ``wgs72`` model seems to be the most commonly used in the satellite
tracking community, and is probably the model behind most TLE elements
that are available for download.
The ``twoline2rv()`` function returns a ``Satellite`` object whose
attributes carry the data loaded from the TLE entry.
Most of this class's hundred-plus attributes are intermediate values
of interest only to the propagation algorithm itself. Here are the
attributes set by ``sgp4.io.twoline2rv()`` in which users are likely
to be interested:
``satnum``
Unique satellite number given in the TLE file.
``epochyr``
Full four-digit year of this element set's epoch moment.
``epochdays``
Fractional days into the year of the epoch moment.
``jdsatepoch``
Julian date of the epoch (computed from ``epochyr`` and ``epochdays``).
``ndot``
First time derivative of the mean motion (ignored by SGP4).
``nddot``
Second time derivative of the mean motion (ignored by SGP4).
``bstar``
Ballistic drag coefficient B* in inverse earth radii.
``inclo``
Inclination in radians.
``nodeo``
Right ascension of ascending node in radians.
``ecco``
Eccentricity.
``argpo``
Argument of perigee in radians.
``mo``
Mean anomaly in radians.
``no``
Mean motion in radians per minute.
This implementation passes all of the automated tests in the August 2010
release of the reference implementation of SGP4 by Vallado et al., who
originally published their revision of SGP4 in 2006:
Vallado, David A., Paul Crawford, Richard Hujsak, and T.S. Kelso, “Revisiting Spacetrack Report #3,” presented at the AIAA/AAS Astrodynamics Specialist Conference, Keystone, CO, 2006 August 21–24.
If you would like to review the paper, it is `available online
<http://www.celestrak.com/publications/AIAA/2006-6753/>`_. You can
always download the latest version of their code for comparison against
this Python module (or other implementations) at `AIAA-2006-6753.zip
<http://www.celestrak.com/publications/AIAA/2006-6753/AIAA-2006-6753.zip>`_.
This module was adapted from Vallado's C++ code since its revision date
was the most recently updated SGP4 implementation in their zip file:
* C++, August 2010
* Fortran, August 2008
* Pascal, August 2008
* Matlab, May 2008
* Java, July 2005
Changelog
---------
| 2012-11-22 — 1.1 — Python 3 compatibility; more documentation
| 2012-08-27 — 1.0 — Initial release
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.1
Classifier: Programming Language :: Python :: 3.2
Classifier: Topic :: Scientific/Engineering :: Astronomy
+568
View File
@@ -0,0 +1,568 @@
# satellite.js
[![NPM version](https://img.shields.io/npm/v/satellite.js.svg)](https://www.npmjs.com/package/satellite.js)
[![Downloads/month](https://img.shields.io/npm/dm/satellite.js.svg)](https://www.npmjs.com/package/satellite.js)
[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](LICENSE.md)
## Introduction
A library to make satellite propagation via TLEs or [OMM](https://www.nasa.gov/wp-content/uploads/2017/12/orbit_data_messages.pdf)
possible in the web. Provides the functions necessary for SGP4/SDP4 calculations, as callable javascript. Also provides
functions for coordinate transforms.
The internals of this library are nearly identical to
[Brandon Rhode's sgp4 python library](https://pypi.python.org/pypi/sgp4/).
Special thanks to all contributors for improving usability and bug fixes :)
- [ezze (Dmitriy Pushkov)](https://github.com/ezze)
- [davidcalhoun (David Calhoun)](https://github.com/davidcalhoun)
- [tikhonovits (Nikos Sagias)](https://github.com/tikhonovits)
- [dangodev (Drew Powers)](https://github.com/dangodev)
- [thkruz (Theodore Kruczek)](https://github.com/thkruz)
- [bakercp (Christopher Baker)](https://github.com/bakercp)
- [kylegmaxwell (Kyle G. Maxwell)](https://github.com/kylegmaxwell)
- [iamthechad (Chad Johnston)](https://github.com/iamthechad)
- [drom (Aliaksei Chapyzhenka)](https://github.com/drom)
- [PeterDaveHello (Peter Dave Hello)](https://github.com/PeterDaveHello)
- [Alesha72003](https://github.com/Alesha72003)
- [nhamer](https://github.com/nhamer)
- [owntheweb](https://github.com/owntheweb)
- [Zigone](https://github.com/Zigone)
Sites using the library can be found [here](https://github.com/shashwatak/satellite-js/wiki/Sites-using-satellite.js).
## Installation
```bash
npm install satellite.js
```
```bash
yarn add satellite.js
```
## Usage
### ES Modules
```js
import { sgp4 } from 'satellite.js';
...
const positionAndVelocity = sgp4(satrec, time);
```
### Common.js ([Node.js](https://nodejs.org))
```js
const satellite = require('satellite.js');
...
const positionAndVelocity = satellite.sgp4(satrec, time);
```
### AMD ([Require.js](http://requirejs.org/))
```js
define(['path/to/dist/satellite'], function(satellite) {
...
var positionAndVelocity = satellite.sgp4(satrec, time);
});
```
### Script tag
Include `dist/satellite.min.js` as a script in your html:
```html
<script src="path/to/dist/satellite.min.js"></script>
```
`satellite` object will be available in global scope:
```js
const positionAndVelocity = satellite.sgp4(satrec, time);
```
## Sample Usage: calculate Look Angles, Geodetic Position etc
```js
// Sample TLE
const tleLine1 = '1 25544U 98067A 19156.50900463 .00003075 00000-0 59442-4 0 9992',
tleLine2 = '2 25544 51.6433 59.2583 0008217 16.4489 347.6017 15.51174618173442';
// Initialize a satellite record
const satrec = satellite.twoline2satrec(tleLine1, tleLine2);
// Or sample OMM - preferred for new applications
const omm = {
"OBJECT_NAME": "HELIOS 2A",
"OBJECT_ID": "2004-049A",
"EPOCH": "2025-03-26T05:19:34.116960",
"MEAN_MOTION": 15.00555103,
"ECCENTRICITY": 0.000583,
"INCLINATION": 98.3164,
"RA_OF_ASC_NODE": 103.8411,
"ARG_OF_PERICENTER": 20.5667,
"MEAN_ANOMALY": 339.5789,
"EPHEMERIS_TYPE": 0,
"CLASSIFICATION_TYPE": "U",
"NORAD_CAT_ID": 28492,
"ELEMENT_SET_NO": 999,
"REV_AT_EPOCH": 8655,
"BSTAR": 0.00048021,
"MEAN_MOTION_DOT": 0.00005995,
"MEAN_MOTION_DDOT": 0
};
const satrecFromOmm = satellite.json2satrec(omm);
// Propagate satellite using time since epoch (in minutes).
const positionAndVelocity = satellite.sgp4(satrec, timeSinceTleEpochMinutes);
// Or you can use a JavaScript Date
const positionAndVelocity = satellite.propagate(satrec, new Date());
// if the result is `null`, it means that the propagation failed;
// consult `satrec.error` property for a specific reason.
if (positionAndVelocity === null) {
switch (satrec.error) {
// all possible values are listed in SatRecError enum:
case satellite.SatRecError.Decayed:
console.log('The satellite has decayed')
// ...
}
}
// The positionAndVelocity result is a pair of ECI coordinates.
// These are the base results from which all other coordinates are derived.
const positionEci = positionAndVelocity.position,
velocityEci = positionAndVelocity.velocity;
// Set the Observer at 122.03 West by 36.96 North, in RADIANS
const observerGd = {
longitude: satellite.degreesToRadians(-122.0308),
latitude: satellite.degreesToRadians(36.9613422),
height: 0.370
};
// You will need GMST for some of the coordinate transforms.
// http://en.wikipedia.org/wiki/Sidereal_time#Definition
const gmst = satellite.gstime(new Date());
// You can get ECF, Geodetic, Look Angles, and Doppler Factor.
const positionEcf = satellite.eciToEcf(positionEci, gmst),
observerEcf = satellite.geodeticToEcf(observerGd),
positionGd = satellite.eciToGeodetic(positionEci, gmst),
lookAngles = satellite.ecfToLookAngles(observerGd, positionEcf),
dopplerFactor = satellite.dopplerFactor(observerCoordsEcf, positionEcf, velocityEcf);
// The coordinates are all stored in key-value pairs.
// ECI and ECF are accessed by `x`, `y`, `z` properties.
const satelliteX = positionEci.x,
satelliteY = positionEci.y,
satelliteZ = positionEci.z;
// Look Angles may be accessed by `azimuth`, `elevation`, `rangeSat` properties.
const azimuth = lookAngles.azimuth,
elevation = lookAngles.elevation,
rangeSat = lookAngles.rangeSat;
// Geodetic coords are accessed via `longitude`, `latitude`, `height`.
const longitude = positionGd.longitude,
latitude = positionGd.latitude,
height = positionGd.height;
// Convert the RADIANS to DEGREES.
const longitudeDeg = satellite.degreesLong(longitude),
latitudeDeg = satellite.degreesLat(latitude);
```
## Resources
- [TS Kelso's Columns for Satellite Times](http://celestrak.com/columns/), Orbital Propagation Parts I and II a must!
- [Wikipedia: Simplified Perturbations Model](http://en.wikipedia.org/wiki/Simplified_perturbations_models)
- [SpaceTrack Report #3, by Hoots and Roehrich](http://celestrak.com/NORAD/documentation/spacetrk.pdf).
The TypeScript in this library is heavily based (propagation procedures straight copied) from:
- The python [sgp4 1.1 by Brandon Rhodes](https://pypi.python.org/pypi/sgp4/)
- The C++ code by [David Vallado, et al](http://www.celestrak.com/publications/AIAA/2006-6753/)
The original PKG-INFO file from the python library is included.
The coordinate transforms are based off T.S. Kelso's columns:
- [Part I](http://celestrak.com/columns/v02n01/)
- [Part II](http://celestrak.com/columns/v02n02/)
- [Part III](http://celestrak.com/columns/v02n03/)
And the coursework for UC Boulder's ASEN students
- [Coodinate Transforms @ UC Boulder](http://ccar.colorado.edu/ASEN5070/handouts/coordsys.doc)
I would recommend anybody interested in satellite tracking or orbital propagation to read
[all of TS Kelso's columns](http://celestrak.com/columns/). Without his work, this project would not be possible.
Get a free [Space Track account](https://www.space-track.org/auth/login) and download your own up to date TLEs or OMM
for use with this library.
## Exposed Objects
### SatRec
The `SatRec` object comes from the original code by Rhodes as well as Vallado. It is immense and complex, but the
most important values it contains are the Keplerian Elements and the other values pulled from the TLE/OMM. I do not
suggest that anybody try to simplify it unless they have absolute understanding of Orbital Mechanics.
- `satnum` Unique satellite number given in the TLE file.
- `epochyr` Full four-digit year of this element set's epoch moment.
- `epochdays` Fractional days into the year of the epoch moment.
- `jdsatepoch` Julian date of the epoch (computed from `epochyr` and `epochdays`).
- `ndot` First time derivative of the mean motion (ignored by SGP4).
- `nddot` Second time derivative of the mean motion (ignored by SGP4).
- `bstar` Ballistic drag coefficient B* in inverse earth radii.
- `inclo` Inclination in radians.
- `nodeo` Right ascension of ascending node in radians.
- `ecco` Eccentricity.
- `argpo` Argument of perigee in radians.
- `mo` Mean anomaly in radians.
- `no` Mean motion in radians per minute.
- `error` The error code that is set by SGP4 model in case when propagation fails.
### SatRecError
The enum that lists all possible error codes in `SatRec.error property:
- `None` - No error, propagation for the last supplied date is successful
- `MeanEccentricityOutOfRange` - Mean eccentricity is out of range 0 ≤ e < 1
- `MeanMotionBelowZero` - Mean motion has fallen below zero
- `PerturbedEccentricityOutOfRange` - Perturbed eccentricity is out of range 0 ≤ e < 1
- `SemiLatusRectumBelowZero` - Length of the orbit’s semi-latus rectum has fallen below zero
- `Decayed` - Orbit has decayed: the computed position is underground
## Exposed Functions
### Initialization
NOTE! You are responsible for providing OMM or TLE.
[Get your free Space Track account here.](https://www.space-track.org/auth/login)
If you use Space Track, there should be no problem.
#### From OMM (preferred for new applications)
```js
const satrec = satellite.json2satrec(ommObject);
```
returns satrec object, created from JSON object that follows
[OMM format](https://www.nasa.gov/wp-content/uploads/2017/12/orbit_data_messages.pdf).
**OMM is a preferred default method for new applications**, since TLE format is constrained
to 5 digits in NORAD section and the number of catalogued objects quickly approches 100 000.
To obtain OMM as JSON from Celestrak, select "JSON" option at the top of "Current GP
Element Sets" page or follow
[this link](https://celestrak.org/NORAD/elements/index.php?FORMAT=json) where it will
be already selected.
Space-Track doesn't expose the JSON format in their UI, so to get JSON encoded OMM,
on "Recent ELSETs" page, from "Current Catalog Files", copy a URL for the needed category
and change the ending part of the URL from `/format/xml` to be `/format/json`.
#### From TLE
```js
const satrec = satellite.twoline2satrec(longstr1, longstr2);
```
returns satrec object, created from the TLEs passed in. longstr1 and longstr2 are the two lines of the TLE,
properly formatted by NASA and NORAD standards.
___
The satrec object is vastly complicated, but you don't have to do anything with it, except pass it around.
### Propagation
Both `propagate()` and `sgp4()` functions return position and velocity; as well as mean elements:
```json
{
"position": { "x" : 1, "y" : 1, "z" : 1 },
"velocity": { "x" : 1, "y" : 1, "z" : 1 },
"meanElements": {
"Om": 2.2835713400168607,
"am": 1.3043985097733939,
"em": 0.166565,
"im": 0.5743651675510579,
"mm": -4.361270622785478,
"nm": 0.049918822378349076,
"om": 4.074394344293675,
}
}
```
position is in km, velocity is in km/s, both the ECI coordinate frame. Mean elements are satellite orbit elements as they
evolved at the propagation date: `am` (semi-major axis, Earth radii), `em` (eccentricity), `im` (inclination, radians),
`Om` (right ascension of ascending node, radians), `om` (argument of perigee, radians),
`nm` (mean motion, radians per minute).
```js
const positionAndVelocity = satellite.propagate(satrec, new Date());
```
Returns position and velocity, given a satrec and the calendar date. Is merely a wrapper for `sgp4()`, converts the
calendar day to Julian time since satellite epoch. Sometimes it's better to ask for position and velocity given
a specific date.
```js
const positionAndVelocity = satellite.sgp4(satrec, timeSinceTleEpochMinutes);
```
Returns position and velocity, given a satrec and the time in minutes since epoch. Sometimes it's better to ask for
position and velocity given the time elapsed since epoch.
### Doppler
You can get the satellites current Doppler factor, relative to your position, using the `dopplerFactor()` function.
Use either ECI or ECF coordinates, but don't mix them.
```js
const dopplerFactor = satellite.dopplerFactor(observer, position, velocity);
```
See the section on Coordinate Transforms to see how to get ECF/ECI/Geodetic coordinates.
### Coordinate Transforms
#### Greenwich Mean Sidereal Time
You'll need to provide some of the coordinate transform functions with your current GMST aka GSTIME. You can use
Julian Day:
```js
const gmst = satellite.gstime(julianDay);
```
or a JavaScript Date:
```js
const gmst = satellite.gstime(new Date());
```
#### Transforms
Most of these are self explanatory from their names. Coords are arrays of three floats EX: [1.1, 1.2, 1.3] in
kilometers. Once again, read the following first.
The coordinate transforms are based off T.S. Kelso's columns:
* [Part I](http://celestrak.com/columns/v02n01/)
* [Part II](http://celestrak.com/columns/v02n02/)
* [Part III](http://celestrak.com/columns/v02n03/)
And the coursework for UC Boulder's ASEN students
* [Coodinate Transforms @ UC Boulder](http://ccar.colorado.edu/ASEN5070/handouts/coordsys.doc)
These four are used to convert between ECI, ECF, and Geodetic, as you need them. ECI and ECF coordinates are in
km or km/s. Geodetic coords are in radians.
```js
const ecfCoords = satellite.eciToEcf(eciCoords, gmst);
```
```js
const eciCoords = satellite.ecfToEci(ecfCoords, gmst);
```
```js
const geodeticCoords = satellite.eciToGeodetic(eciCoords, gmst);
```
```js
const ecfCoords = satellite.geodeticToEcf(geodeticCoords);
```
These function is used to compute the look angle, from your geodetic position to a satellite in ECF coordinates.
Make sure you convert the ECI output from sgp4() and propagate() to ECF first.
```js
const lookAngles = satellite.ecfToLookAngles(observerGeodetic, satelliteEcf);
```
#### Latitude and Longitude
These two functions will return human readable Latitude or Longitude strings (Ex: "125.35W" or "45.565N")
from `geodeticCoords`:
```js
const latitudeStr = satellite.degreesLat(geodeticRadians),
longitudeStr = satellite.degreesLong(geodeticRadians);
```
#### Sun position
This function returns Sun position at the given date. This is useful to further calculate if a given satellite
is in Earth umbra. Position is returned as geocentric equatorial vector pointing at the sun,
along with Right Ascension and Declination. This is the low precision formula and is valid for years from 1950
to 2050. Accuracy of apparent coordinates is 0.01 degrees.
```js
const jday = satellite.jday(new Date())
const sunPosition = satellite.sunPos(jday)
{
rsun: [1, 1, 1], // x, y, z; astronomical units
rtasc: 0.5, // radians
decl: 0.5 // radians
}
```
## Contributing
This repo follows [Gitflow Workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow).
Before starting a work on new [pull request](https://github.com/shashwatak/satellite-js/compare), please, checkout your
feature or bugfix branch from `develop` branch:
```bash
git checkout develop
git fetch origin
git merge origin/develop
git checkout -b my-feature
```
Make sure that your changes don't break the existing code by running
```bash
npm test
```
and that your code follows [Airbnb](https://www.npmjs.com/package/eslint-config-airbnb-base) style
```bash
npm run lint
npm run lint:test
```
Implementing new functions or features, please, if possible, provide tests to cover them and mention your works in
[Changelog](CHANGELOG.md). Please don't change version number in `package.json` and don't add it to `CHANGELOG.md`.
All these things should be done later with [raise-version](https://github.com/ezze/node-raise-version) when
merging to `master`:
```bash
npm run raise major
```
or
```bash
npm run raise minor
```
or
```bash
npm run raise patch
```
In order to get test code coverage run the following:
```bash
npm run test:coverage
```
## Building
The source code is written in [TypeScript](https://www.typescriptlang.org/) and uses a strict tsconfig.
In order to build the library follow these steps:
- install [Node.js](https://nodejs.org/) and [Node Package Manager](https://www.npmjs.com/);
- install all required packages with NPM by running the following command from repository's root directory:
```bash
npm install
```
- run the following NPM script to build everything:
```bash
npm run build
```
- run the following NPM script to run test specs `test/*.spec.js` files with [Mocha](https://mochajs.org/):
```bash
npm test
```
These is a full list of all available NPM scripts:
- `build` builds everything;
- `transpile` transpiles ES source files located in `src` directory to Common.js compatible modules and saves
the resulting files in `lib` directory;
- `dist` builds ES and UMD modules in `dist` directory;
- `dist:es` builds ES module in `dist` directory;
- `dist:umd` builds [UMD](https://github.com/umdjs/umd) module in `dist` directory (both non-compressed and
compressed versions);
- `dist:umd:dev` builds non-compressed version of UMD module in `dist` directory;
- `dist:umd:prod` builds compressed version of UMD module in `dist` directory;
- `watch:es` watches for changes in `src` directory and automatically rebuilds ES module;
- `copy` copies built library from `dist` to [SGP4 verification](#benchmarking) application's directory;
- `lint` lints sources code located in `src` directory with [ESLint](http://eslint.org/) with
[Airbnb shared configuration]((https://www.npmjs.com/package/eslint-config-airbnb));
- `lint:test` lints tests located in `test` directory with ESLint;
- `test` runs tests;
- `test:coverage` runs tests with [Istanbul](https://github.com/gotwarlost/istanbul) coverage summary;
## ES5 and satellite.min.js
Only the "src" directory is included in the Git repository, "dist" and "lib" directories are ignored. It's done intentionally to retain the size of the repository as small as possible. A full detailed explanation of why is located [here](https://github.com/shashwatak/satellite-js/issues/80#issuecomment-749225324).
You should install satellite.js with your package manager (npm or yarn) and then find satellite.js and satellite.min.js in node_modules/satellite.js/dist directory.
## Note about Code Conventions
Like Brandon Rhodes before me, I chose to maintain as little difference between this implementation and the prior
works. This is to make adapting future changes suggested by Vallado much simpler. Thus, some of the conventions
used in this library are very weird.
## How this was written
I took advantage of the fact that Python and JavaScript are nearly semantically identical. Most of the code is
just copied straight from Python. Brandon Rhodes did me the favor of including semi-colons on most of the lines of
code. JavaScript doesn't support multiple values returned per statement, so I had to rewrite the function calls.
Absolutely none of the mathematical logic had to be rewritten.
## Benchmarking
I've included a small testing app, that provides some benchmarking tools and verifies SGP4 and SDP4 using the
Test Criteria provided by SpaceTrack Report #3, and is based off
[System Benchmarking](http://celestrak.com/columns/v02n04/) by TS Kelso.
The testing app is a Chrome Packaged App that uses the `angular.js` framework.
Before running the app build the library and copy resulting files from `dist` directory to app's directory with
the following command:
```bash
npm run copy
```
To run the test, open up Chrome, go to the extensions page, and check "Developer Mode". Then, click "Load Unpacked App",
and select the `sgp4_verification` folder. Then run the app from within Chrome. The test file is located within
the `sgp4_verification` directory, as a JSON file called `spacetrack-report-3.json`.
## Acknowledgments
Major thanks go to Brandon Rhodes, TS Kelso, and David Vallado's team. Also, I'd like to thank Professor Steve
Petersen (AC6P) of UCSC for pointing me in the correct directions.
## License
All files marked with the License header at the top are Licensed. Any files unmarked by me or others are
unlicensed, and are kept only as a resource for [Shashwat Kandadai and other developers] for testing.
I chose the [MIT License](LICENSE.md) because this library is a derivative work off
[Brandon Rhodes sgp4](https://pypi.python.org/pypi/sgp4/), and that is licensed with MIT.
I worked in the Dining Hall at UCSC for a month, which means I signed a form that gives UCSC partial ownership of
anything I make while under their aegis, so I included them as owners of the copyright.
Please email all complaints to help@ucsc.edu
+3110
View File
File diff suppressed because it is too large Load Diff
+3151
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+30
View File
@@ -0,0 +1,30 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
export default tseslint.config(
eslint.configs.recommended,
tseslint.configs.strict,
tseslint.configs.stylistic,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
{
ignores: ['/dist', '/lib', '*.mjs']
},
{
rules: {
'@typescript-eslint/unified-signatures': ['error', {
'ignoreDifferentlyNamedParameters': true
}],
// since much of the propagation code is built on loops and if statements,
// and typescript doesn't follow when a variable is assigned there,
// this rule is disabled
'@typescript-eslint/no-non-null-assertion': 'off'
}
}
);
+5
View File
@@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
+22
View File
@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.xpdotp = exports.xke = exports.x2o3 = exports.vkmpersec = exports.twoPi = exports.tumin = exports.rad2deg = exports.pi = exports.mu = exports.minutesPerDay = exports.j4 = exports.j3oj2 = exports.j3 = exports.j2 = exports.earthRadius = exports.deg2rad = void 0;
var pi = exports.pi = Math.PI;
var twoPi = exports.twoPi = pi * 2;
var deg2rad = exports.deg2rad = pi / 180.0;
var rad2deg = exports.rad2deg = 180 / pi;
var minutesPerDay = exports.minutesPerDay = 1440.0;
var mu = exports.mu = 398600.8; // in km3 / s2
var earthRadius = exports.earthRadius = 6378.135; // in km
var xke = exports.xke = 60.0 / Math.sqrt(earthRadius * earthRadius * earthRadius / mu);
var vkmpersec = exports.vkmpersec = earthRadius * xke / 60.0;
var tumin = exports.tumin = 1.0 / xke;
var j2 = exports.j2 = 0.001082616;
var j3 = exports.j3 = -0.00000253881;
var j4 = exports.j4 = -0.00000165597;
var j3oj2 = exports.j3oj2 = j3 / j2;
var x2o3 = exports.x2o3 = 2.0 / 3.0;
var xpdotp = exports.xpdotp = 1440.0 / (2.0 * pi); // 229.1831180523293;
+27
View File
@@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = dopplerFactor;
var earthRotation = 7.292115E-5;
var c = 299792.458; // Speed of light in km/s
/**
* Negative range rate means the satellite is moving towards the observer and
* its frequency is shifted higher because 1 minus a negative range rate is
* positive. If the range rate is positive, the satellite is moving away from
* the observer and its frequency is shifted lower.
*/
function dopplerFactor(observerCoordsEcf, positionEcf, velocityEcf) {
var rangeX = positionEcf.x - observerCoordsEcf.x;
var rangeY = positionEcf.y - observerCoordsEcf.y;
var rangeZ = positionEcf.z - observerCoordsEcf.z;
var length = Math.sqrt(Math.pow(rangeX, 2) + Math.pow(rangeY, 2) + Math.pow(rangeZ, 2));
var rangeVel = {
x: velocityEcf.x + earthRotation * observerCoordsEcf.y,
y: velocityEcf.y - earthRotation * observerCoordsEcf.x,
z: velocityEcf.z
};
var rangeRate = (rangeX * rangeVel.x + rangeY * rangeVel.y + rangeZ * rangeVel.z) / length;
return 1 - rangeRate / c;
}
+145
View File
@@ -0,0 +1,145 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.days2mdhms = days2mdhms;
exports.invjday = invjday;
exports.jday = jday;
/* -----------------------------------------------------------------------------
*
* procedure days2mdhms
*
* this procedure converts the day of the year, days, to the equivalent month
* day, hour, minute and second.
*
* algorithm : set up array for the number of days per month
* find leap year - use 1900 because 2000 is a leap year
* loop through a temp value while the value is < the days
* perform int conversions to the correct day and month
* convert remainder into h m s using type conversions
*
* author : david vallado 719-573-2600 1 mar 2001
*
* inputs description range / units
* year - year 1900 .. 2100
* days - julian day of the year 0.0 .. 366.0
*
* outputs :
* mon - month 1 .. 12
* day - day 1 .. 28,29,30,31
* hr - hour 0 .. 23
* min - minute 0 .. 59
* sec - second 0.0 .. 59.999
*
* locals :
* dayofyr - day of year
* temp - temporary extended values
* inttemp - temporary int value
* i - index
* lmonth[12] - int array containing the number of days per month
*
* coupling :
* none.
* --------------------------------------------------------------------------- */
function days2mdhms(year, days) {
var lmonth = [31, year % 4 === 0 ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
var dayofyr = Math.floor(days);
// ----------------- find month and day of month ----------------
var i = 1;
var inttemp = 0;
// i starts from 1 so no null check is needed
while (dayofyr > inttemp + lmonth[i - 1] && i < 12) {
inttemp += lmonth[i - 1];
i += 1;
}
var mon = i;
var day = dayofyr - inttemp;
// ----------------- find hours minutes and seconds -------------
var temp = (days - dayofyr) * 24.0;
var hr = Math.floor(temp);
temp = (temp - hr) * 60.0;
var minute = Math.floor(temp);
var sec = (temp - minute) * 60.0;
return {
mon: mon,
day: day,
hr: hr,
minute: minute,
sec: sec
};
}
/* -----------------------------------------------------------------------------
*
* procedure jday
*
* this procedure finds the julian date given the year, month, day, and time.
* the julian date is defined by each elapsed day since noon, jan 1, 4713 bc.
*
* algorithm : calculate the answer in one step for efficiency
*
* author : david vallado 719-573-2600 1 mar 2001
*
* inputs description range / units
* year - year 1900 .. 2100
* mon - month 1 .. 12
* day - day 1 .. 28,29,30,31
* hr - universal time hour 0 .. 23
* min - universal time min 0 .. 59
* sec - universal time sec 0.0 .. 59.999
*
* outputs :
* jd - julian date days from 4713 bc
*
* locals :
* none.
*
* coupling :
* none.
*
* references :
* vallado 2007, 189, alg 14, ex 3-14
*
* --------------------------------------------------------------------------- */
function jdayInternal(year, mon, day, hr, minute, sec) {
var msec = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
return 367.0 * year - Math.floor(7 * (year + Math.floor((mon + 9) / 12.0)) * 0.25) + Math.floor(275 * mon / 9.0) + day + 1721013.5 + ((msec / 60000 + sec / 60.0 + minute) / 60.0 + hr) / 24.0 // ut in days
// # - 0.5*sgn(100.0*year + mon - 190002.5) + 0.5;
;
}
function jday(yearOrDate, mon, day, hr, minute, sec) {
var msec = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
if (yearOrDate instanceof Date) {
var date = yearOrDate;
return jdayInternal(date.getUTCFullYear(), date.getUTCMonth() + 1,
// Note, this function requires months in range 1-12.
date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds());
}
return jdayInternal(yearOrDate, mon, day, hr, minute, sec, msec);
}
function invjday(jd, asArray) {
// --------------- find year and days of the year -
var temp = jd - 2415019.5;
var tu = temp / 365.25;
var year = 1900 + Math.floor(tu);
var leapyrs = Math.floor((year - 1901) * 0.25);
// optional nudge by 8.64x10-7 sec to get even outputs
var days = temp - ((year - 1900) * 365.0 + leapyrs) + 0.00000000001;
// ------------ check for case of beginning of a year -----------
if (days < 1.0) {
year -= 1;
leapyrs = Math.floor((year - 1901) * 0.25);
days = temp - ((year - 1900) * 365.0 + leapyrs);
}
// ----------------- find remaing data -------------------------
var mdhms = days2mdhms(year, days);
var mon = mdhms.mon,
day = mdhms.day,
hr = mdhms.hr,
minute = mdhms.minute;
var sec = mdhms.sec - 0.00000086400;
if (asArray) {
return [year, mon, day, hr, minute, Math.floor(sec)];
}
return new Date(Date.UTC(year, mon - 1, day, hr, minute, Math.floor(sec)));
}
+181
View File
@@ -0,0 +1,181 @@
"use strict";
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
value: true
});
var _exportNames = {
constants: true,
jday: true,
invjday: true,
twoline2satrec: true,
json2satrec: true,
propagate: true,
sgp4: true,
gstime: true,
dopplerFactor: true,
radiansToDegrees: true,
degreesToRadians: true,
degreesLat: true,
degreesLong: true,
radiansLat: true,
radiansLong: true,
geodeticToEcf: true,
eciToGeodetic: true,
eciToEcf: true,
ecfToEci: true,
ecfToLookAngles: true,
sunPos: true,
SatRecError: true
};
Object.defineProperty(exports, "SatRecError", {
enumerable: true,
get: function get() {
return _SatRec.SatRecError;
}
});
exports.constants = void 0;
Object.defineProperty(exports, "degreesLat", {
enumerable: true,
get: function get() {
return _transforms.degreesLat;
}
});
Object.defineProperty(exports, "degreesLong", {
enumerable: true,
get: function get() {
return _transforms.degreesLong;
}
});
Object.defineProperty(exports, "degreesToRadians", {
enumerable: true,
get: function get() {
return _transforms.degreesToRadians;
}
});
Object.defineProperty(exports, "dopplerFactor", {
enumerable: true,
get: function get() {
return _dopplerFactor["default"];
}
});
Object.defineProperty(exports, "ecfToEci", {
enumerable: true,
get: function get() {
return _transforms.ecfToEci;
}
});
Object.defineProperty(exports, "ecfToLookAngles", {
enumerable: true,
get: function get() {
return _transforms.ecfToLookAngles;
}
});
Object.defineProperty(exports, "eciToEcf", {
enumerable: true,
get: function get() {
return _transforms.eciToEcf;
}
});
Object.defineProperty(exports, "eciToGeodetic", {
enumerable: true,
get: function get() {
return _transforms.eciToGeodetic;
}
});
Object.defineProperty(exports, "geodeticToEcf", {
enumerable: true,
get: function get() {
return _transforms.geodeticToEcf;
}
});
Object.defineProperty(exports, "gstime", {
enumerable: true,
get: function get() {
return _propagation.gstime;
}
});
Object.defineProperty(exports, "invjday", {
enumerable: true,
get: function get() {
return _ext.invjday;
}
});
Object.defineProperty(exports, "jday", {
enumerable: true,
get: function get() {
return _ext.jday;
}
});
Object.defineProperty(exports, "json2satrec", {
enumerable: true,
get: function get() {
return _io.json2satrec;
}
});
Object.defineProperty(exports, "propagate", {
enumerable: true,
get: function get() {
return _propagation.propagate;
}
});
Object.defineProperty(exports, "radiansLat", {
enumerable: true,
get: function get() {
return _transforms.radiansLat;
}
});
Object.defineProperty(exports, "radiansLong", {
enumerable: true,
get: function get() {
return _transforms.radiansLong;
}
});
Object.defineProperty(exports, "radiansToDegrees", {
enumerable: true,
get: function get() {
return _transforms.radiansToDegrees;
}
});
Object.defineProperty(exports, "sgp4", {
enumerable: true,
get: function get() {
return _propagation.sgp4;
}
});
Object.defineProperty(exports, "sunPos", {
enumerable: true,
get: function get() {
return _sun.sunPos;
}
});
Object.defineProperty(exports, "twoline2satrec", {
enumerable: true,
get: function get() {
return _io.twoline2satrec;
}
});
var constants_1 = _interopRequireWildcard(require("./constants"));
exports.constants = constants_1;
var _ext = require("./ext");
var _io = require("./io");
var _propagation = require("./propagation");
var _dopplerFactor = _interopRequireDefault(require("./dopplerFactor"));
var _transforms = require("./transforms");
var _sun = require("./sun");
var _SatRec = require("./propagation/SatRec.js");
var _commonTypes = require("./common-types.js");
Object.keys(_commonTypes).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _commonTypes[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _commonTypes[key];
}
});
});
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
+47
View File
@@ -0,0 +1,47 @@
"use strict";
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var constants = _interopRequireWildcard(require("./constants"));
var _ext = require("./ext");
var _io = require("./io");
var _propagation = require("./propagation");
var _SatRec = require("./propagation/SatRec.js");
var types = _interopRequireWildcard(require("./common-types.js"));
var _dopplerFactor = _interopRequireDefault(require("./dopplerFactor"));
var _transforms = require("./transforms");
var _sun = require("./sun");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
var _default = exports["default"] = Object.assign(Object.assign({
constants: constants,
// Propagation
propagate: _propagation.propagate,
sgp4: _propagation.sgp4,
twoline2satrec: _io.twoline2satrec,
json2satrec: _io.json2satrec,
gstime: _propagation.gstime,
jday: _ext.jday,
invjday: _ext.invjday,
dopplerFactor: _dopplerFactor["default"],
// Coordinate transforms
radiansToDegrees: _transforms.radiansToDegrees,
degreesToRadians: _transforms.degreesToRadians,
degreesLat: _transforms.degreesLat,
degreesLong: _transforms.degreesLong,
radiansLat: _transforms.radiansLat,
radiansLong: _transforms.radiansLong,
geodeticToEcf: _transforms.geodeticToEcf,
eciToGeodetic: _transforms.eciToGeodetic,
eciToEcf: _transforms.eciToEcf,
ecfToEci: _transforms.ecfToEci,
ecfToLookAngles: _transforms.ecfToLookAngles,
// Sun Position
sunPos: _sun.sunPos
}, types), {
SatRecError: _SatRec.SatRecError
});
+233
View File
@@ -0,0 +1,233 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.json2satrec = json2satrec;
exports.twoline2satrec = twoline2satrec;
var _constants = require("./constants");
var _ext = require("./ext");
var _sgp4init = _interopRequireDefault(require("./propagation/sgp4init"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/* -----------------------------------------------------------------------------
*
* function twoline2satrec
*
* this function converts the two line element set character string data to
* variables and initializes the sgp4 variables. several intermediate varaibles
* and quantities are determined. note that the result is a structure so multiple
* satellites can be processed simultaneously without having to reinitialize. the
* verification mode is an important option that permits quick checks of any
* changes to the underlying technical theory. this option works using a
* modified tle file in which the start, stop, and delta time values are
* included at the end of the second line of data. this only works with the
* verification mode. the catalog mode simply propagates from -1440 to 1440 min
* from epoch and is useful when performing entire catalog runs.
*
* author : david vallado 719-573-2600 1 mar 2001
*
* inputs :
* longstr1 - first line of the tle
* longstr2 - second line of the tle
* typerun - type of run verification 'v', catalog 'c',
* manual 'm'
* typeinput - type of manual input mfe 'm', epoch 'e', dayofyr 'd'
* opsmode - mode of operation afspc or improved 'a', 'i'
* whichconst - which set of constants to use 72, 84
*
* outputs :
* satrec - structure containing all the sgp4 satellite information
*
* coupling :
* getgravconst-
* days2mdhms - conversion of days to month, day, hour, minute, second
* jday - convert day month year hour minute second into julian date
* sgp4init - initialize the sgp4 variables
*
* references :
* norad spacetrack report #3
* vallado, crawford, hujsak, kelso 2006
--------------------------------------------------------------------------- */
/**
* Return a Satellite imported from two lines of TLE data.
*
* Provide the two TLE lines as strings `tleLine1` and `tleLine2`,
* and select which standard set of gravitational constants you want
* by providing `gravity_constants`:
*
* `sgp4.propagation.wgs72` - Standard WGS 72 model
* `sgp4.propagation.wgs84` - More recent WGS 84 model
* `sgp4.propagation.wgs72old` - Legacy support for old SGP4 behavior
*
* Normally, computations are made using letious recent improvements
* to the algorithm. If you want to turn some of these off and go
* back into "afspc" mode, then set `afspc_mode` to `True`.
*/
function twoline2satrec(longstr1, longstr2) {
var opsmode = 'i';
var error = 0;
var satnum = longstr1.substring(2, 7);
var epochyr = parseInt(longstr1.substring(18, 20), 10);
var epochdays = parseFloat(longstr1.substring(20, 32));
var ndot = parseFloat(longstr1.substring(33, 43));
var nddot = parseFloat("".concat(longstr1.substring(44, 45), ".").concat(longstr1.substring(45, 50), "E").concat(longstr1.substring(50, 52)));
var bstar = parseFloat("".concat(longstr1.substring(53, 54), ".").concat(longstr1.substring(54, 59), "E").concat(longstr1.substring(59, 61)));
// satrec.satnum = longstr2.substring(2, 7);
// ---- find standard orbital elements ----
var inclo = parseFloat(longstr2.substring(8, 16)) * _constants.deg2rad;
var nodeo = parseFloat(longstr2.substring(17, 25)) * _constants.deg2rad;
var ecco = parseFloat(".".concat(longstr2.substring(26, 33).replace(/\s/g, '0')));
var argpo = parseFloat(longstr2.substring(34, 42)) * _constants.deg2rad;
var mo = parseFloat(longstr2.substring(43, 51)) * _constants.deg2rad;
// ---- find no, ndot, nddot ----
var no = parseFloat(longstr2.substring(52, 63)) / _constants.xpdotp;
// satrec.nddot= satrec.nddot * Math.pow(10.0, nexp);
// satrec.bstar= satrec.bstar * Math.pow(10.0, ibexp);
// ---- convert to sgp4 units ----
// satrec.ndot /= (xpdotp * 1440.0); // ? * minperday
// satrec.nddot /= (xpdotp * 1440.0 * 1440);
// ----------------------------------------------------------------
// find sgp4epoch time of element set
// remember that sgp4 uses units of days from 0 jan 1950 (sgp4epoch)
// and minutes from the epoch (time)
// ----------------------------------------------------------------
// ---------------- temp fix for years from 1957-2056 -------------------
// --------- correct fix will occur when year is 4-digit in tle ---------
var year = epochyr < 57 ? epochyr + 2000 : epochyr + 1900;
var mdhmsResult = (0, _ext.days2mdhms)(year, epochdays);
var mon = mdhmsResult.mon,
day = mdhmsResult.day,
hr = mdhmsResult.hr,
minute = mdhmsResult.minute,
sec = mdhmsResult.sec;
var jdsatepoch = (0, _ext.jday)(year, mon, day, hr, minute, sec);
var satrec = {
error: error,
satnum: satnum,
epochyr: epochyr,
epochdays: epochdays,
ndot: ndot,
nddot: nddot,
bstar: bstar,
inclo: inclo,
nodeo: nodeo,
ecco: ecco,
argpo: argpo,
mo: mo,
no: no,
jdsatepoch: jdsatepoch
};
// ---------------- initialize the orbit at sgp4epoch -------------------
(0, _sgp4init["default"])(satrec, {
opsmode: opsmode,
satn: satrec.satnum,
epoch: satrec.jdsatepoch - 2433281.5,
xbstar: satrec.bstar,
xecco: satrec.ecco,
xargpo: satrec.argpo,
xinclo: satrec.inclo,
xmo: satrec.mo,
xno: satrec.no,
xnodeo: satrec.nodeo
});
return satrec;
}
/* -----------------------------------------------------------------------------
*
* function json2satrec
*
* this function converts the OMM json data to variables and initializes the sgp4
* variables. several intermediate varaibles and quantities are determined. note
* that the result is a structure so multiple satellites can be processed
* simultaneously without having to reinitialize. the verification mode is an
* important option that permits quick checks of any changes to the underlying
* technical theory. this option works using a modified tle file in which the
* start, stop, and delta time values are included at the end of the second line
* of data. this only works with the verification mode. the catalog mode simply
* propagates from -1440 to 1440 min from epoch and is useful when performing
* entire catalog runs.
*
* author : Hariharan Vitaladevuni 18 Aug 2023
* Theodore Kruczek 19 Aug 2023
*
* inputs :
* jsonobj - OMM json data
* opsmode - mode of operation afspc or improved 'a', 'i'. Default: 'i'.
*
* outputs :
* satrec - structure containing all the sgp4 satellite information
*
* coupling :
* days2mdhms - conversion of days to month, day, hour, minute, second
* jday - convert day month year hour minute second into julian date
* sgp4init - initialize the sgp4 variables
*
* warning : the epoch date in OMM format is more accurate than TLE format!
* this will result in extremely close, but different
* position/velocity values. Depending on your use case, it may
* be better to use twoline2satrec, but for the average user this
* will provide comparable results.
*
* references :
* https://celestrak.org/NORAD/documentation/gp-data-formats.php
--------------------------------------------------------------------------- */
function json2satrec(jsonobj) {
var opsmode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'i';
var error = 0;
var satnum = jsonobj.NORAD_CAT_ID.toString();
var epoch = new Date(jsonobj.EPOCH.endsWith('Z') ? jsonobj.EPOCH : jsonobj.EPOCH + 'Z');
var year = epoch.getUTCFullYear();
var epochyr = Number(year.toString().slice(-2));
var epochdays = (epoch.valueOf() - new Date(Date.UTC(year, 0, 1, 0, 0, 0)).valueOf()) / (86400 * 1000) + 1;
var ndot = Number(jsonobj.MEAN_MOTION_DOT);
var nddot = Number(jsonobj.MEAN_MOTION_DDOT);
var bstar = Number(jsonobj.BSTAR);
var inclo = Number(jsonobj.INCLINATION) * _constants.deg2rad;
var nodeo = Number(jsonobj.RA_OF_ASC_NODE) * _constants.deg2rad;
var ecco = Number(jsonobj.ECCENTRICITY);
var argpo = Number(jsonobj.ARG_OF_PERICENTER) * _constants.deg2rad;
var mo = Number(jsonobj.MEAN_ANOMALY) * _constants.deg2rad;
var no = Number(jsonobj.MEAN_MOTION) / _constants.xpdotp;
// ----------------------------------------------------------------
// find sgp4epoch time of element set
// remember that sgp4 uses units of days from 0 jan 1950 (sgp4epoch)
// and minutes from the epoch (time)
// ----------------------------------------------------------------
var mdhmsResult = (0, _ext.days2mdhms)(year, epochdays);
var mon = mdhmsResult.mon,
day = mdhmsResult.day,
hr = mdhmsResult.hr,
minute = mdhmsResult.minute,
sec = mdhmsResult.sec;
var jdsatepoch = (0, _ext.jday)(year, mon, day, hr, minute, sec);
var satrec = {
error: error,
satnum: satnum,
epochyr: epochyr,
epochdays: epochdays,
ndot: ndot,
nddot: nddot,
bstar: bstar,
inclo: inclo,
nodeo: nodeo,
ecco: ecco,
argpo: argpo,
mo: mo,
no: no,
jdsatepoch: jdsatepoch
};
// ---------------- initialize the orbit at sgp4epoch -------------------
(0, _sgp4init["default"])(satrec, {
opsmode: opsmode,
satn: satrec.satnum,
epoch: satrec.jdsatepoch - 2433281.5,
xbstar: satrec.bstar,
xecco: satrec.ecco,
xargpo: satrec.argpo,
xinclo: satrec.inclo,
xmo: satrec.mo,
xno: satrec.no,
xnodeo: satrec.nodeo
});
return satrec;
}
+27
View File
@@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "gstime", {
enumerable: true,
get: function get() {
return _gstime["default"];
}
});
Object.defineProperty(exports, "propagate", {
enumerable: true,
get: function get() {
return _propagate["default"];
}
});
Object.defineProperty(exports, "sgp4", {
enumerable: true,
get: function get() {
return _sgp["default"];
}
});
var _propagate = _interopRequireDefault(require("./propagation/propagate"));
var _sgp = _interopRequireDefault(require("./propagation/sgp4"));
var _gstime = _interopRequireDefault(require("./propagation/gstime"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
+34
View File
@@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SatRecError = void 0;
var SatRecError;
(function (SatRecError) {
/**
* No error, propagation for the last supplied date is successful
*/
SatRecError[SatRecError["None"] = 0] = "None";
/**
* Mean eccentricity is out of range 0 ≤ e < 1
*/
SatRecError[SatRecError["MeanEccentricityOutOfRange"] = 1] = "MeanEccentricityOutOfRange";
/**
* Mean motion has fallen below zero.
*/
SatRecError[SatRecError["MeanMotionBelowZero"] = 2] = "MeanMotionBelowZero";
/**
* Perturbed eccentricity is out of range 0 ≤ e < 1
*/
SatRecError[SatRecError["PerturbedEccentricityOutOfRange"] = 3] = "PerturbedEccentricityOutOfRange";
/**
* Length of the orbit’s semi-latus rectum has fallen below zero.
*/
SatRecError[SatRecError["SemiLatusRectumBelowZero"] = 4] = "SemiLatusRectumBelowZero";
// 5 is not used
/**
* Orbit has decayed: the computed position is underground.
*/
SatRecError[SatRecError["Decayed"] = 6] = "Decayed";
})(SatRecError || (exports.SatRecError = SatRecError = {}));
+244
View File
@@ -0,0 +1,244 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = dpper;
var _constants = require("../constants");
/* -----------------------------------------------------------------------------
*
* procedure dpper
*
* this procedure provides deep space long period periodic contributions
* to the mean elements. by design, these periodics are zero at epoch.
* this used to be dscom which included initialization, but it's really a
* recurring function.
*
* author : david vallado 719-573-2600 28 jun 2005
*
* inputs :
* e3 -
* ee2 -
* peo -
* pgho -
* pho -
* pinco -
* plo -
* se2 , se3 , sgh2, sgh3, sgh4, sh2, sh3, si2, si3, sl2, sl3, sl4 -
* t -
* xh2, xh3, xi2, xi3, xl2, xl3, xl4 -
* zmol -
* zmos -
* ep - eccentricity 0.0 - 1.0
* inclo - inclination - needed for lyddane modification
* nodep - right ascension of ascending node
* argpp - argument of perigee
* mp - mean anomaly
*
* outputs :
* ep - eccentricity 0.0 - 1.0
* inclp - inclination
* nodep - right ascension of ascending node
* argpp - argument of perigee
* mp - mean anomaly
*
* locals :
* alfdp -
* betdp -
* cosip , sinip , cosop , sinop ,
* dalf -
* dbet -
* dls -
* f2, f3 -
* pe -
* pgh -
* ph -
* pinc -
* pl -
* sel , ses , sghl , sghs , shl , shs , sil , sinzf , sis ,
* sll , sls
* xls -
* xnoh -
* zf -
* zm -
*
* coupling :
* none.
*
* references :
* hoots, roehrich, norad spacetrack report #3 1980
* hoots, norad spacetrack report #6 1986
* hoots, schumacher and glover 2004
* vallado, crawford, hujsak, kelso 2006
----------------------------------------------------------------------------*/
function dpper(satrec, options) {
var e3 = satrec.e3,
ee2 = satrec.ee2,
peo = satrec.peo,
pgho = satrec.pgho,
pho = satrec.pho,
pinco = satrec.pinco,
plo = satrec.plo,
se2 = satrec.se2,
se3 = satrec.se3,
sgh2 = satrec.sgh2,
sgh3 = satrec.sgh3,
sgh4 = satrec.sgh4,
sh2 = satrec.sh2,
sh3 = satrec.sh3,
si2 = satrec.si2,
si3 = satrec.si3,
sl2 = satrec.sl2,
sl3 = satrec.sl3,
sl4 = satrec.sl4,
t = satrec.t,
xgh2 = satrec.xgh2,
xgh3 = satrec.xgh3,
xgh4 = satrec.xgh4,
xh2 = satrec.xh2,
xh3 = satrec.xh3,
xi2 = satrec.xi2,
xi3 = satrec.xi3,
xl2 = satrec.xl2,
xl3 = satrec.xl3,
xl4 = satrec.xl4,
zmol = satrec.zmol,
zmos = satrec.zmos;
var init = options.init,
opsmode = options.opsmode;
var ep = options.ep,
inclp = options.inclp,
nodep = options.nodep,
argpp = options.argpp,
mp = options.mp;
// Copy satellite attributes into local variables for convenience
// and symmetry in writing formulae.
var alfdp;
var betdp;
var cosip;
var sinip;
var cosop;
var sinop;
var dalf;
var dbet;
var dls;
var f2;
var f3;
var pe;
var pgh;
var ph;
var pinc;
var pl;
var sinzf;
var xls;
var xnoh;
var zf;
var zm;
// ---------------------- constants -----------------------------
var zns = 1.19459e-5;
var zes = 0.01675;
var znl = 1.5835218e-4;
var zel = 0.05490;
// --------------- calculate time varying periodics -----------
zm = zmos + zns * t;
// be sure that the initial call has time set to zero
if (init === 'y') {
zm = zmos;
}
zf = zm + 2.0 * zes * Math.sin(zm);
sinzf = Math.sin(zf);
f2 = 0.5 * sinzf * sinzf - 0.25;
f3 = -0.5 * sinzf * Math.cos(zf);
var ses = se2 * f2 + se3 * f3;
var sis = si2 * f2 + si3 * f3;
var sls = sl2 * f2 + sl3 * f3 + sl4 * sinzf;
var sghs = sgh2 * f2 + sgh3 * f3 + sgh4 * sinzf;
var shs = sh2 * f2 + sh3 * f3;
zm = zmol + znl * t;
if (init === 'y') {
zm = zmol;
}
zf = zm + 2.0 * zel * Math.sin(zm);
sinzf = Math.sin(zf);
f2 = 0.5 * sinzf * sinzf - 0.25;
f3 = -0.5 * sinzf * Math.cos(zf);
var sel = ee2 * f2 + e3 * f3;
var sil = xi2 * f2 + xi3 * f3;
var sll = xl2 * f2 + xl3 * f3 + xl4 * sinzf;
var sghl = xgh2 * f2 + xgh3 * f3 + xgh4 * sinzf;
var shll = xh2 * f2 + xh3 * f3;
pe = ses + sel;
pinc = sis + sil;
pl = sls + sll;
pgh = sghs + sghl;
ph = shs + shll;
if (init === 'n') {
pe -= peo;
pinc -= pinco;
pl -= plo;
pgh -= pgho;
ph -= pho;
inclp += pinc;
ep += pe;
sinip = Math.sin(inclp);
cosip = Math.cos(inclp);
/* ----------------- apply periodics directly ------------ */
// sgp4fix for lyddane choice
// strn3 used original inclination - this is technically feasible
// gsfc used perturbed inclination - also technically feasible
// probably best to readjust the 0.2 limit value and limit discontinuity
// 0.2 rad = 11.45916 deg
// use next line for original strn3 approach and original inclination
// if (inclo >= 0.2)
// use next line for gsfc version and perturbed inclination
if (inclp >= 0.2) {
ph /= sinip;
pgh -= cosip * ph;
argpp += pgh;
nodep += ph;
mp += pl;
} else {
// ---- apply periodics with lyddane modification ----
sinop = Math.sin(nodep);
cosop = Math.cos(nodep);
alfdp = sinip * sinop;
betdp = sinip * cosop;
dalf = ph * cosop + pinc * cosip * sinop;
dbet = -ph * sinop + pinc * cosip * cosop;
alfdp += dalf;
betdp += dbet;
nodep %= _constants.twoPi;
// sgp4fix for afspc written intrinsic functions
// nodep used without a trigonometric function ahead
if (nodep < 0.0 && opsmode === 'a') {
nodep += _constants.twoPi;
}
xls = mp + argpp + cosip * nodep;
dls = pl + pgh - pinc * nodep * sinip;
xls += dls;
xnoh = nodep;
nodep = Math.atan2(alfdp, betdp);
// sgp4fix for afspc written intrinsic functions
// nodep used without a trigonometric function ahead
if (nodep < 0.0 && opsmode === 'a') {
nodep += _constants.twoPi;
}
if (Math.abs(xnoh - nodep) > _constants.pi) {
if (nodep < xnoh) {
nodep += _constants.twoPi;
} else {
nodep -= _constants.twoPi;
}
}
mp += pl;
argpp = xls - mp - cosip * nodep;
}
}
return {
ep: ep,
inclp: inclp,
nodep: nodep,
argpp: argpp,
mp: mp
};
}
+381
View File
@@ -0,0 +1,381 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = dscom;
var _constants = require("../constants");
/*-----------------------------------------------------------------------------
*
* procedure dscom
*
* this procedure provides deep space common items used by both the secular
* and periodics subroutines. input is provided as shown. this routine
* used to be called dpper, but the functions inside weren't well organized.
*
* author : david vallado 719-573-2600 28 jun 2005
*
* inputs :
* epoch -
* ep - eccentricity
* argpp - argument of perigee
* tc -
* inclp - inclination
* nodep - right ascension of ascending node
* np - mean motion
*
* outputs :
* sinim , cosim , sinomm , cosomm , snodm , cnodm
* day -
* e3 -
* ee2 -
* em - eccentricity
* emsq - eccentricity squared
* gam -
* peo -
* pgho -
* pho -
* pinco -
* plo -
* rtemsq -
* se2, se3 -
* sgh2, sgh3, sgh4 -
* sh2, sh3, si2, si3, sl2, sl3, sl4 -
* s1, s2, s3, s4, s5, s6, s7 -
* ss1, ss2, ss3, ss4, ss5, ss6, ss7, sz1, sz2, sz3 -
* sz11, sz12, sz13, sz21, sz22, sz23, sz31, sz32, sz33 -
* xgh2, xgh3, xgh4, xh2, xh3, xi2, xi3, xl2, xl3, xl4 -
* nm - mean motion
* z1, z2, z3, z11, z12, z13, z21, z22, z23, z31, z32, z33 -
* zmol -
* zmos -
*
* locals :
* a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 -
* betasq -
* cc -
* ctem, stem -
* x1, x2, x3, x4, x5, x6, x7, x8 -
* xnodce -
* xnoi -
* zcosg , zsing , zcosgl , zsingl , zcosh , zsinh , zcoshl , zsinhl ,
* zcosi , zsini , zcosil , zsinil ,
* zx -
* zy -
*
* coupling :
* none.
*
* references :
* hoots, roehrich, norad spacetrack report #3 1980
* hoots, norad spacetrack report #6 1986
* hoots, schumacher and glover 2004
* vallado, crawford, hujsak, kelso 2006
----------------------------------------------------------------------------*/
function dscom(options) {
var epoch = options.epoch,
ep = options.ep,
argpp = options.argpp,
tc = options.tc,
inclp = options.inclp,
nodep = options.nodep,
np = options.np;
var a1;
var a2;
var a3;
var a4;
var a5;
var a6;
var a7;
var a8;
var a9;
var a10;
var cc;
var x1;
var x2;
var x3;
var x4;
var x5;
var x6;
var x7;
var x8;
var zcosg;
var zsing;
var zcosh;
var zsinh;
var zcosi;
var zsini;
var ss1;
var ss2;
var ss3;
var ss4;
var ss5;
var ss6;
var ss7;
var sz1;
var sz2;
var sz3;
var sz11;
var sz12;
var sz13;
var sz21;
var sz22;
var sz23;
var sz31;
var sz32;
var sz33;
var s1;
var s2;
var s3;
var s4;
var s5;
var s6;
var s7;
var z1;
var z2;
var z3;
var z11;
var z12;
var z13;
var z21;
var z22;
var z23;
var z31;
var z32;
var z33;
// -------------------------- constants -------------------------
var zes = 0.01675;
var zel = 0.05490;
var c1ss = 2.9864797e-6;
var c1l = 4.7968065e-7;
var zsinis = 0.39785416;
var zcosis = 0.91744867;
var zcosgs = 0.1945905;
var zsings = -0.98088458;
// --------------------- local variables ------------------------
var nm = np;
var em = ep;
var snodm = Math.sin(nodep);
var cnodm = Math.cos(nodep);
var sinomm = Math.sin(argpp);
var cosomm = Math.cos(argpp);
var sinim = Math.sin(inclp);
var cosim = Math.cos(inclp);
var emsq = em * em;
var betasq = 1.0 - emsq;
var rtemsq = Math.sqrt(betasq);
// ----------------- initialize lunar solar terms ---------------
var peo = 0.0;
var pinco = 0.0;
var plo = 0.0;
var pgho = 0.0;
var pho = 0.0;
var day = epoch + 18261.5 + tc / 1440.0;
var xnodce = (4.5236020 - 9.2422029e-4 * day) % _constants.twoPi;
var stem = Math.sin(xnodce);
var ctem = Math.cos(xnodce);
var zcosil = 0.91375164 - 0.03568096 * ctem;
var zsinil = Math.sqrt(1.0 - zcosil * zcosil);
var zsinhl = 0.089683511 * stem / zsinil;
var zcoshl = Math.sqrt(1.0 - zsinhl * zsinhl);
var gam = 5.8351514 + 0.0019443680 * day;
var zx = 0.39785416 * stem / zsinil;
var zy = zcoshl * ctem + 0.91744867 * zsinhl * stem;
zx = Math.atan2(zx, zy);
zx += gam - xnodce;
var zcosgl = Math.cos(zx);
var zsingl = Math.sin(zx);
// ------------------------- do solar terms ---------------------
zcosg = zcosgs;
zsing = zsings;
zcosi = zcosis;
zsini = zsinis;
zcosh = cnodm;
zsinh = snodm;
cc = c1ss;
var xnoi = 1.0 / nm;
var lsflg = 0;
while (lsflg < 2) {
lsflg += 1;
a1 = zcosg * zcosh + zsing * zcosi * zsinh;
a3 = -zsing * zcosh + zcosg * zcosi * zsinh;
a7 = -zcosg * zsinh + zsing * zcosi * zcosh;
a8 = zsing * zsini;
a9 = zsing * zsinh + zcosg * zcosi * zcosh;
a10 = zcosg * zsini;
a2 = cosim * a7 + sinim * a8;
a4 = cosim * a9 + sinim * a10;
a5 = -sinim * a7 + cosim * a8;
a6 = -sinim * a9 + cosim * a10;
x1 = a1 * cosomm + a2 * sinomm;
x2 = a3 * cosomm + a4 * sinomm;
x3 = -a1 * sinomm + a2 * cosomm;
x4 = -a3 * sinomm + a4 * cosomm;
x5 = a5 * sinomm;
x6 = a6 * sinomm;
x7 = a5 * cosomm;
x8 = a6 * cosomm;
z31 = 12.0 * x1 * x1 - 3.0 * x3 * x3;
z32 = 24.0 * x1 * x2 - 6.0 * x3 * x4;
z33 = 12.0 * x2 * x2 - 3.0 * x4 * x4;
z1 = 3.0 * (a1 * a1 + a2 * a2) + z31 * emsq;
z2 = 6.0 * (a1 * a3 + a2 * a4) + z32 * emsq;
z3 = 3.0 * (a3 * a3 + a4 * a4) + z33 * emsq;
z11 = -6.0 * a1 * a5 + emsq * (-24.0 * x1 * x7 - 6.0 * x3 * x5);
z12 = -6.0 * (a1 * a6 + a3 * a5) + emsq * (-24.0 * (x2 * x7 + x1 * x8) + -6.0 * (x3 * x6 + x4 * x5));
z13 = -6.0 * a3 * a6 + emsq * (-24.0 * x2 * x8 - 6.0 * x4 * x6);
z21 = 6.0 * a2 * a5 + emsq * (24.0 * x1 * x5 - 6.0 * x3 * x7);
z22 = 6.0 * (a4 * a5 + a2 * a6) + emsq * (24.0 * (x2 * x5 + x1 * x6) - 6.0 * (x4 * x7 + x3 * x8));
z23 = 6.0 * a4 * a6 + emsq * (24.0 * x2 * x6 - 6.0 * x4 * x8);
z1 = z1 + z1 + betasq * z31;
z2 = z2 + z2 + betasq * z32;
z3 = z3 + z3 + betasq * z33;
s3 = cc * xnoi;
s2 = -0.5 * s3 / rtemsq;
s4 = s3 * rtemsq;
s1 = -15.0 * em * s4;
s5 = x1 * x3 + x2 * x4;
s6 = x2 * x3 + x1 * x4;
s7 = x2 * x4 - x1 * x3;
// ----------------------- do lunar terms -------------------
if (lsflg === 1) {
ss1 = s1;
ss2 = s2;
ss3 = s3;
ss4 = s4;
ss5 = s5;
ss6 = s6;
ss7 = s7;
sz1 = z1;
sz2 = z2;
sz3 = z3;
sz11 = z11;
sz12 = z12;
sz13 = z13;
sz21 = z21;
sz22 = z22;
sz23 = z23;
sz31 = z31;
sz32 = z32;
sz33 = z33;
zcosg = zcosgl;
zsing = zsingl;
zcosi = zcosil;
zsini = zsinil;
zcosh = zcoshl * cnodm + zsinhl * snodm;
zsinh = snodm * zcoshl - cnodm * zsinhl;
cc = c1l;
}
}
var zmol = (4.7199672 + (0.22997150 * day - gam)) % _constants.twoPi;
var zmos = (6.2565837 + 0.017201977 * day) % _constants.twoPi;
// ------------------------ do solar terms ----------------------
var se2 = 2.0 * ss1 * ss6;
var se3 = 2.0 * ss1 * ss7;
var si2 = 2.0 * ss2 * sz12;
var si3 = 2.0 * ss2 * (sz13 - sz11);
var sl2 = -2.0 * ss3 * sz2;
var sl3 = -2.0 * ss3 * (sz3 - sz1);
var sl4 = -2.0 * ss3 * (-21.0 - 9.0 * emsq) * zes;
var sgh2 = 2.0 * ss4 * sz32;
var sgh3 = 2.0 * ss4 * (sz33 - sz31);
var sgh4 = -18.0 * ss4 * zes;
var sh2 = -2.0 * ss2 * sz22;
var sh3 = -2.0 * ss2 * (sz23 - sz21);
// ------------------------ do lunar terms ----------------------
var ee2 = 2.0 * s1 * s6;
var e3 = 2.0 * s1 * s7;
var xi2 = 2.0 * s2 * z12;
var xi3 = 2.0 * s2 * (z13 - z11);
var xl2 = -2.0 * s3 * z2;
var xl3 = -2.0 * s3 * (z3 - z1);
var xl4 = -2.0 * s3 * (-21.0 - 9.0 * emsq) * zel;
var xgh2 = 2.0 * s4 * z32;
var xgh3 = 2.0 * s4 * (z33 - z31);
var xgh4 = -18.0 * s4 * zel;
var xh2 = -2.0 * s2 * z22;
var xh3 = -2.0 * s2 * (z23 - z21);
return {
snodm: snodm,
cnodm: cnodm,
sinim: sinim,
cosim: cosim,
sinomm: sinomm,
cosomm: cosomm,
day: day,
e3: e3,
ee2: ee2,
em: em,
emsq: emsq,
gam: gam,
peo: peo,
pgho: pgho,
pho: pho,
pinco: pinco,
plo: plo,
rtemsq: rtemsq,
se2: se2,
se3: se3,
sgh2: sgh2,
sgh3: sgh3,
sgh4: sgh4,
sh2: sh2,
sh3: sh3,
si2: si2,
si3: si3,
sl2: sl2,
sl3: sl3,
sl4: sl4,
s1: s1,
s2: s2,
s3: s3,
s4: s4,
s5: s5,
s6: s6,
s7: s7,
ss1: ss1,
ss2: ss2,
ss3: ss3,
ss4: ss4,
ss5: ss5,
ss6: ss6,
ss7: ss7,
sz1: sz1,
sz2: sz2,
sz3: sz3,
sz11: sz11,
sz12: sz12,
sz13: sz13,
sz21: sz21,
sz22: sz22,
sz23: sz23,
sz31: sz31,
sz32: sz32,
sz33: sz33,
xgh2: xgh2,
xgh3: xgh3,
xgh4: xgh4,
xh2: xh2,
xh3: xh3,
xi2: xi2,
xi3: xi3,
xl2: xl2,
xl3: xl3,
xl4: xl4,
nm: nm,
z1: z1,
z2: z2,
z3: z3,
z11: z11,
z12: z12,
z13: z13,
z21: z21,
z22: z22,
z23: z23,
z31: z31,
z32: z32,
z33: z33,
zmol: zmol,
zmos: zmos
};
}
+389
View File
@@ -0,0 +1,389 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = dsinit;
var _constants = require("../constants");
/*-----------------------------------------------------------------------------
*
* procedure dsinit
*
* this procedure provides deep space contributions to mean motion dot due
* to geopotential resonance with half day and one day orbits.
*
* author : david vallado 719-573-2600 28 jun 2005
*
* inputs :
* cosim, sinim-
* emsq - eccentricity squared
* argpo - argument of perigee
* s1, s2, s3, s4, s5 -
* ss1, ss2, ss3, ss4, ss5 -
* sz1, sz3, sz11, sz13, sz21, sz23, sz31, sz33 -
* t - time
* tc -
* gsto - greenwich sidereal time rad
* mo - mean anomaly
* mdot - mean anomaly dot (rate)
* no - mean motion
* nodeo - right ascension of ascending node
* nodedot - right ascension of ascending node dot (rate)
* xpidot -
* z1, z3, z11, z13, z21, z23, z31, z33 -
* eccm - eccentricity
* argpm - argument of perigee
* inclm - inclination
* mm - mean anomaly
* xn - mean motion
* nodem - right ascension of ascending node
*
* outputs :
* em - eccentricity
* argpm - argument of perigee
* inclm - inclination
* mm - mean anomaly
* nm - mean motion
* nodem - right ascension of ascending node
* irez - flag for resonance 0-none, 1-one day, 2-half day
* atime -
* d2201, d2211, d3210, d3222, d4410, d4422, d5220, d5232, d5421, d5433 -
* dedt -
* didt -
* dmdt -
* dndt -
* dnodt -
* domdt -
* del1, del2, del3 -
* ses , sghl , sghs , sgs , shl , shs , sis , sls
* theta -
* xfact -
* xlamo -
* xli -
* xni
*
* locals :
* ainv2 -
* aonv -
* cosisq -
* eoc -
* f220, f221, f311, f321, f322, f330, f441, f442, f522, f523, f542, f543 -
* g200, g201, g211, g300, g310, g322, g410, g422, g520, g521, g532, g533 -
* sini2 -
* temp -
* temp1 -
* theta -
* xno2 -
*
* coupling :
* getgravconst
*
* references :
* hoots, roehrich, norad spacetrack report #3 1980
* hoots, norad spacetrack report #6 1986
* hoots, schumacher and glover 2004
* vallado, crawford, hujsak, kelso 2006
----------------------------------------------------------------------------*/
function dsinit(options) {
var cosim = options.cosim,
argpo = options.argpo,
s1 = options.s1,
s2 = options.s2,
s3 = options.s3,
s4 = options.s4,
s5 = options.s5,
sinim = options.sinim,
ss1 = options.ss1,
ss2 = options.ss2,
ss3 = options.ss3,
ss4 = options.ss4,
ss5 = options.ss5,
sz1 = options.sz1,
sz3 = options.sz3,
sz11 = options.sz11,
sz13 = options.sz13,
sz21 = options.sz21,
sz23 = options.sz23,
sz31 = options.sz31,
sz33 = options.sz33,
t = options.t,
tc = options.tc,
gsto = options.gsto,
mo = options.mo,
mdot = options.mdot,
no = options.no,
nodeo = options.nodeo,
nodedot = options.nodedot,
xpidot = options.xpidot,
z1 = options.z1,
z3 = options.z3,
z11 = options.z11,
z13 = options.z13,
z21 = options.z21,
z23 = options.z23,
z31 = options.z31,
z33 = options.z33,
ecco = options.ecco,
eccsq = options.eccsq;
var emsq = options.emsq,
em = options.em,
argpm = options.argpm,
inclm = options.inclm,
mm = options.mm,
nm = options.nm,
nodem = options.nodem,
irez = options.irez,
atime = options.atime,
d2201 = options.d2201,
d2211 = options.d2211,
d3210 = options.d3210,
d3222 = options.d3222,
d4410 = options.d4410,
d4422 = options.d4422,
d5220 = options.d5220,
d5232 = options.d5232,
d5421 = options.d5421,
d5433 = options.d5433,
dedt = options.dedt,
didt = options.didt,
dmdt = options.dmdt,
dnodt = options.dnodt,
domdt = options.domdt,
del1 = options.del1,
del2 = options.del2,
del3 = options.del3,
xfact = options.xfact,
xlamo = options.xlamo,
xli = options.xli,
xni = options.xni;
var f220;
var f221;
var f311;
var f321;
var f322;
var f330;
var f441;
var f442;
var f522;
var f523;
var f542;
var f543;
var g200;
var g201;
var g211;
var g300;
var g310;
var g322;
var g410;
var g422;
var g520;
var g521;
var g532;
var g533;
var sini2;
var temp;
var temp1;
var xno2;
var ainv2;
var aonv;
var cosisq;
var eoc;
var q22 = 1.7891679e-6;
var q31 = 2.1460748e-6;
var q33 = 2.2123015e-7;
var root22 = 1.7891679e-6;
var root44 = 7.3636953e-9;
var root54 = 2.1765803e-9;
// eslint-disable-next-line no-loss-of-precision
var rptim = 4.37526908801129966e-3; // equates to 7.29211514668855e-5 rad/sec
var root32 = 3.7393792e-7;
var root52 = 1.1428639e-7;
var znl = 1.5835218e-4;
var zns = 1.19459e-5;
// -------------------- deep space initialization ------------
irez = 0;
if (nm < 0.0052359877 && nm > 0.0034906585) {
irez = 1;
}
if (nm >= 8.26e-3 && nm <= 9.24e-3 && em >= 0.5) {
irez = 2;
}
// ------------------------ do solar terms -------------------
var ses = ss1 * zns * ss5;
var sis = ss2 * zns * (sz11 + sz13);
var sls = -zns * ss3 * (sz1 + sz3 - 14.0 - 6.0 * emsq);
var sghs = ss4 * zns * (sz31 + sz33 - 6.0);
var shs = -zns * ss2 * (sz21 + sz23);
// sgp4fix for 180 deg incl
if (inclm < 5.2359877e-2 || inclm > _constants.pi - 5.2359877e-2) {
shs = 0.0;
}
if (sinim !== 0.0) {
shs /= sinim;
}
var sgs = sghs - cosim * shs;
// ------------------------- do lunar terms ------------------
dedt = ses + s1 * znl * s5;
didt = sis + s2 * znl * (z11 + z13);
dmdt = sls - znl * s3 * (z1 + z3 - 14.0 - 6.0 * emsq);
var sghl = s4 * znl * (z31 + z33 - 6.0);
var shll = -znl * s2 * (z21 + z23);
// sgp4fix for 180 deg incl
if (inclm < 5.2359877e-2 || inclm > _constants.pi - 5.2359877e-2) {
shll = 0.0;
}
domdt = sgs + sghl;
dnodt = shs;
if (sinim !== 0.0) {
domdt -= cosim / sinim * shll;
dnodt += shll / sinim;
}
// ----------- calculate deep space resonance effects --------
var dndt = 0.0;
var theta = (gsto + tc * rptim) % _constants.twoPi;
em += dedt * t;
inclm += didt * t;
argpm += domdt * t;
nodem += dnodt * t;
mm += dmdt * t;
// sgp4fix for negative inclinations
// the following if statement should be commented out
// if (inclm < 0.0)
// {
// inclm = -inclm;
// argpm = argpm - pi;
// nodem = nodem + pi;
// }
// -------------- initialize the resonance terms -------------
if (irez !== 0) {
aonv = Math.pow(nm / _constants.xke, _constants.x2o3);
// ---------- geopotential resonance for 12 hour orbits ------
if (irez === 2) {
cosisq = cosim * cosim;
var emo = em;
em = ecco;
var emsqo = emsq;
emsq = eccsq;
eoc = em * emsq;
g201 = -0.306 - (em - 0.64) * 0.440;
if (em <= 0.65) {
g211 = 3.616 - 13.2470 * em + 16.2900 * emsq;
g310 = -19.302 + 117.3900 * em - 228.4190 * emsq + 156.5910 * eoc;
g322 = -18.9068 + 109.7927 * em - 214.6334 * emsq + 146.5816 * eoc;
g410 = -41.122 + 242.6940 * em - 471.0940 * emsq + 313.9530 * eoc;
g422 = -146.407 + 841.8800 * em - 1629.014 * emsq + 1083.4350 * eoc;
g520 = -532.114 + 3017.977 * em - 5740.032 * emsq + 3708.2760 * eoc;
} else {
g211 = -72.099 + 331.819 * em - 508.738 * emsq + 266.724 * eoc;
g310 = -346.844 + 1582.851 * em - 2415.925 * emsq + 1246.113 * eoc;
g322 = -342.585 + 1554.908 * em - 2366.899 * emsq + 1215.972 * eoc;
g410 = -1052.797 + 4758.686 * em - 7193.992 * emsq + 3651.957 * eoc;
g422 = -3581.690 + 16178.110 * em - 24462.770 * emsq + 12422.520 * eoc;
if (em > 0.715) {
g520 = -5149.66 + 29936.92 * em - 54087.36 * emsq + 31324.56 * eoc;
} else {
g520 = 1464.74 - 4664.75 * em + 3763.64 * emsq;
}
}
if (em < 0.7) {
g533 = -919.22770 + 4988.6100 * em - 9064.7700 * emsq + 5542.21 * eoc;
g521 = -822.71072 + 4568.6173 * em - 8491.4146 * emsq + 5337.524 * eoc;
g532 = -853.66600 + 4690.2500 * em - 8624.7700 * emsq + 5341.4 * eoc;
} else {
g533 = -37995.780 + 161616.52 * em - 229838.20 * emsq + 109377.94 * eoc;
g521 = -51752.104 + 218913.95 * em - 309468.16 * emsq + 146349.42 * eoc;
g532 = -40023.880 + 170470.89 * em - 242699.48 * emsq + 115605.82 * eoc;
}
sini2 = sinim * sinim;
f220 = 0.75 * (1.0 + 2.0 * cosim + cosisq);
f221 = 1.5 * sini2;
f321 = 1.875 * sinim * (1.0 - 2.0 * cosim - 3.0 * cosisq);
f322 = -1.875 * sinim * (1.0 + 2.0 * cosim - 3.0 * cosisq);
f441 = 35.0 * sini2 * f220;
f442 = 39.3750 * sini2 * sini2;
f522 = 9.84375 * sinim * (sini2 * (1.0 - 2.0 * cosim - 5.0 * cosisq) + 0.33333333 * (-2.0 + 4.0 * cosim + 6.0 * cosisq));
f523 = sinim * (4.92187512 * sini2 * (-2.0 - 4.0 * cosim + 10.0 * cosisq) + 6.56250012 * (1.0 + 2.0 * cosim - 3.0 * cosisq));
f542 = 29.53125 * sinim * (2.0 - 8.0 * cosim + cosisq * (-12.0 + 8.0 * cosim + 10.0 * cosisq));
f543 = 29.53125 * sinim * (-2.0 - 8.0 * cosim + cosisq * (12.0 + 8.0 * cosim - 10.0 * cosisq));
xno2 = nm * nm;
ainv2 = aonv * aonv;
temp1 = 3.0 * xno2 * ainv2;
temp = temp1 * root22;
d2201 = temp * f220 * g201;
d2211 = temp * f221 * g211;
temp1 *= aonv;
temp = temp1 * root32;
d3210 = temp * f321 * g310;
d3222 = temp * f322 * g322;
temp1 *= aonv;
temp = 2.0 * temp1 * root44;
d4410 = temp * f441 * g410;
d4422 = temp * f442 * g422;
temp1 *= aonv;
temp = temp1 * root52;
d5220 = temp * f522 * g520;
d5232 = temp * f523 * g532;
temp = 2.0 * temp1 * root54;
d5421 = temp * f542 * g521;
d5433 = temp * f543 * g533;
xlamo = (mo + nodeo + nodeo - (theta + theta)) % _constants.twoPi;
xfact = mdot + dmdt + 2.0 * (nodedot + dnodt - rptim) - no;
em = emo;
emsq = emsqo;
}
// ---------------- synchronous resonance terms --------------
if (irez === 1) {
g200 = 1.0 + emsq * (-2.5 + 0.8125 * emsq);
g310 = 1.0 + 2.0 * emsq;
g300 = 1.0 + emsq * (-6.0 + 6.60937 * emsq);
f220 = 0.75 * (1.0 + cosim) * (1.0 + cosim);
f311 = 0.9375 * sinim * sinim * (1.0 + 3.0 * cosim) - 0.75 * (1.0 + cosim);
f330 = 1.0 + cosim;
f330 *= 1.875 * f330 * f330;
del1 = 3.0 * nm * nm * aonv * aonv;
del2 = 2.0 * del1 * f220 * g200 * q22;
del3 = 3.0 * del1 * f330 * g300 * q33 * aonv;
del1 = del1 * f311 * g310 * q31 * aonv;
xlamo = (mo + nodeo + argpo - theta) % _constants.twoPi;
xfact = mdot + xpidot + dmdt + domdt + dnodt - (no + rptim);
}
// ------------ for sgp4, initialize the integrator ----------
xli = xlamo;
xni = no;
atime = 0.0;
nm = no + dndt;
}
return {
em: em,
argpm: argpm,
inclm: inclm,
mm: mm,
nm: nm,
nodem: nodem,
irez: irez,
atime: atime,
d2201: d2201,
d2211: d2211,
d3210: d3210,
d3222: d3222,
d4410: d4410,
d4422: d4422,
d5220: d5220,
d5232: d5232,
d5421: d5421,
d5433: d5433,
dedt: dedt,
didt: didt,
dmdt: dmdt,
dndt: dndt,
dnodt: dnodt,
domdt: domdt,
del1: del1,
del2: del2,
del3: del3,
xfact: xfact,
xlamo: xlamo,
xli: xli,
xni: xni
};
}
+230
View File
@@ -0,0 +1,230 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = dspace;
var _constants = require("../constants");
/*-----------------------------------------------------------------------------
*
* procedure dspace
*
* this procedure provides deep space contributions to mean elements for
* perturbing third body. these effects have been averaged over one
* revolution of the sun and moon. for earth resonance effects, the
* effects have been averaged over no revolutions of the satellite.
* (mean motion)
*
* author : david vallado 719-573-2600 28 jun 2005
*
* inputs :
* d2201, d2211, d3210, d3222, d4410, d4422, d5220, d5232, d5421, d5433 -
* dedt -
* del1, del2, del3 -
* didt -
* dmdt -
* dnodt -
* domdt -
* irez - flag for resonance 0-none, 1-one day, 2-half day
* argpo - argument of perigee
* argpdot - argument of perigee dot (rate)
* t - time
* tc -
* gsto - gst
* xfact -
* xlamo -
* no - mean motion
* atime -
* em - eccentricity
* ft -
* argpm - argument of perigee
* inclm - inclination
* xli -
* mm - mean anomaly
* xni - mean motion
* nodem - right ascension of ascending node
*
* outputs :
* atime -
* em - eccentricity
* argpm - argument of perigee
* inclm - inclination
* xli -
* mm - mean anomaly
* xni -
* nodem - right ascension of ascending node
* dndt -
* nm - mean motion
*
* locals :
* delt -
* ft -
* theta -
* x2li -
* x2omi -
* xl -
* xldot -
* xnddt -
* xndt -
* xomi -
*
* coupling :
* none -
*
* references :
* hoots, roehrich, norad spacetrack report #3 1980
* hoots, norad spacetrack report #6 1986
* hoots, schumacher and glover 2004
* vallado, crawford, hujsak, kelso 2006
----------------------------------------------------------------------------*/
function dspace(options) {
var irez = options.irez,
d2201 = options.d2201,
d2211 = options.d2211,
d3210 = options.d3210,
d3222 = options.d3222,
d4410 = options.d4410,
d4422 = options.d4422,
d5220 = options.d5220,
d5232 = options.d5232,
d5421 = options.d5421,
d5433 = options.d5433,
dedt = options.dedt,
del1 = options.del1,
del2 = options.del2,
del3 = options.del3,
didt = options.didt,
dmdt = options.dmdt,
dnodt = options.dnodt,
domdt = options.domdt,
argpo = options.argpo,
argpdot = options.argpdot,
t = options.t,
tc = options.tc,
gsto = options.gsto,
xfact = options.xfact,
xlamo = options.xlamo,
no = options.no;
var atime = options.atime,
em = options.em,
argpm = options.argpm,
inclm = options.inclm,
xli = options.xli,
mm = options.mm,
xni = options.xni,
nodem = options.nodem,
nm = options.nm;
var fasx2 = 0.13130908;
var fasx4 = 2.8843198;
var fasx6 = 0.37448087;
var g22 = 5.7686396;
var g32 = 0.95240898;
var g44 = 1.8014998;
var g52 = 1.0508330;
var g54 = 4.4108898;
// eslint-disable-next-line no-loss-of-precision
var rptim = 4.37526908801129966e-3; // equates to 7.29211514668855e-5 rad/sec
var stepp = 720.0;
var stepn = -720.0;
var step2 = 259200.0;
var delt;
var x2li;
var x2omi;
var xl;
var xldot;
var xnddt;
var xndt;
var xomi;
var dndt = 0.0;
var ft = 0.0;
// ----------- calculate deep space resonance effects -----------
var theta = (gsto + tc * rptim) % _constants.twoPi;
em += dedt * t;
inclm += didt * t;
argpm += domdt * t;
nodem += dnodt * t;
mm += dmdt * t;
// sgp4fix for negative inclinations
// the following if statement should be commented out
// if (inclm < 0.0)
// {
// inclm = -inclm;
// argpm = argpm - pi;
// nodem = nodem + pi;
// }
/* - update resonances : numerical (euler-maclaurin) integration - */
/* ------------------------- epoch restart ---------------------- */
// sgp4fix for propagator problems
// the following integration works for negative time steps and periods
// the specific changes are unknown because the original code was so convoluted
// sgp4fix take out atime = 0.0 and fix for faster operation
if (irez !== 0) {
// sgp4fix streamline check
if (atime === 0.0 || t * atime <= 0.0 || Math.abs(t) < Math.abs(atime)) {
atime = 0.0;
xni = no;
xli = xlamo;
}
// sgp4fix move check outside loop
if (t > 0.0) {
delt = stepp;
} else {
delt = stepn;
}
var iretn = 381; // added for do loop
while (iretn === 381) {
// ------------------- dot terms calculated -------------
// ----------- near - synchronous resonance terms -------
if (irez !== 2) {
xndt = del1 * Math.sin(xli - fasx2) + del2 * Math.sin(2.0 * (xli - fasx4)) + del3 * Math.sin(3.0 * (xli - fasx6));
xldot = xni + xfact;
xnddt = del1 * Math.cos(xli - fasx2) + 2.0 * del2 * Math.cos(2.0 * (xli - fasx4)) + 3.0 * del3 * Math.cos(3.0 * (xli - fasx6));
xnddt *= xldot;
} else {
// --------- near - half-day resonance terms --------
xomi = argpo + argpdot * atime;
x2omi = xomi + xomi;
x2li = xli + xli;
xndt = d2201 * Math.sin(x2omi + xli - g22) + d2211 * Math.sin(xli - g22) + d3210 * Math.sin(xomi + xli - g32) + d3222 * Math.sin(-xomi + xli - g32) + d4410 * Math.sin(x2omi + x2li - g44) + d4422 * Math.sin(x2li - g44) + d5220 * Math.sin(xomi + xli - g52) + d5232 * Math.sin(-xomi + xli - g52) + d5421 * Math.sin(xomi + x2li - g54) + d5433 * Math.sin(-xomi + x2li - g54);
xldot = xni + xfact;
xnddt = d2201 * Math.cos(x2omi + xli - g22) + d2211 * Math.cos(xli - g22) + d3210 * Math.cos(xomi + xli - g32) + d3222 * Math.cos(-xomi + xli - g32) + d5220 * Math.cos(xomi + xli - g52) + d5232 * Math.cos(-xomi + xli - g52) + 2.0 * (d4410 * Math.cos(x2omi + x2li - g44) + d4422 * Math.cos(x2li - g44) + d5421 * Math.cos(xomi + x2li - g54) + d5433 * Math.cos(-xomi + x2li - g54));
xnddt *= xldot;
}
// ----------------------- integrator -------------------
// sgp4fix move end checks to end of routine
if (Math.abs(t - atime) >= stepp) {
iretn = 381;
} else {
ft = t - atime;
iretn = 0;
}
if (iretn === 381) {
xli += xldot * delt + xndt * step2;
xni += xndt * delt + xnddt * step2;
atime += delt;
}
}
nm = xni + xndt * ft + xnddt * ft * ft * 0.5;
xl = xli + xldot * ft + xndt * ft * ft * 0.5;
if (irez !== 1) {
mm = xl - 2.0 * nodem + 2.0 * theta;
dndt = nm - no;
} else {
mm = xl - nodem - argpm + theta;
dndt = nm - no;
}
nm = no + dndt;
}
return {
atime: atime,
em: em,
argpm: argpm,
inclm: inclm,
xli: xli,
mm: mm,
xni: xni,
nodem: nodem,
dndt: dndt,
nm: nm
};
}
+53
View File
@@ -0,0 +1,53 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _constants = require("../constants");
var _ext = require("../ext");
/* -----------------------------------------------------------------------------
*
* function gstime
*
* this function finds the greenwich sidereal time.
*
* author : david vallado 719-573-2600 1 mar 2001
*
* inputs description range / units
* jdut1 - julian date in ut1 days from 4713 bc
*
* outputs :
* gstime - greenwich sidereal time 0 to 2pi rad
*
* locals :
* temp - temporary variable for doubles rad
* tut1 - julian centuries from the
* jan 1, 2000 12 h epoch (ut1)
*
* coupling :
* none
*
* references :
* vallado 2004, 191, eq 3-45
* --------------------------------------------------------------------------- */
function gstimeInternal(jdut1) {
var tut1 = (jdut1 - 2451545.0) / 36525.0;
var temp = -6.2e-6 * tut1 * tut1 * tut1 + 0.093104 * tut1 * tut1 + (876600.0 * 3600 + 8640184.812866) * tut1 + 67310.54841; // # sec
temp = temp * _constants.deg2rad / 240.0 % _constants.twoPi; // 360/86400 = 1/240, to deg, to rad
// ------------------------ check quadrants ---------------------
if (temp < 0.0) {
temp += _constants.twoPi;
}
return temp;
}
function gstime(first, month, day, hour, minute, second, millisecond) {
if (first instanceof Date) {
return gstimeInternal((0, _ext.jday)(first));
} else if (month !== undefined) {
return gstimeInternal((0, _ext.jday)(first, month, day, hour, minute, second, millisecond));
} else {
return gstimeInternal(first);
}
}
var _default = exports["default"] = gstime;
+128
View File
@@ -0,0 +1,128 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = initl;
var _constants = require("../constants");
var _gstime = _interopRequireDefault(require("./gstime"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/*-----------------------------------------------------------------------------
*
* procedure initl
*
* this procedure initializes the sgp4 propagator. all the initialization is
* consolidated here instead of having multiple loops inside other routines.
*
* author : david vallado 719-573-2600 28 jun 2005
*
* inputs :
* ecco - eccentricity 0.0 - 1.0
* epoch - epoch time in days from jan 0, 1950. 0 hr
* inclo - inclination of satellite
* no - mean motion of satellite
* satn - satellite number
*
* outputs :
* ainv - 1.0 / a
* ao - semi major axis
* con41 -
* con42 - 1.0 - 5.0 cos(i)
* cosio - cosine of inclination
* cosio2 - cosio squared
* eccsq - eccentricity squared
* method - flag for deep space 'd', 'n'
* omeosq - 1.0 - ecco * ecco
* posq - semi-parameter squared
* rp - radius of perigee
* rteosq - square root of (1.0 - ecco*ecco)
* sinio - sine of inclination
* gsto - gst at time of observation rad
* no - mean motion of satellite
*
* locals :
* ak -
* d1 -
* del -
* adel -
* po -
*
* coupling :
* getgravconst
* gstime - find greenwich sidereal time from the julian date
*
* references :
* hoots, roehrich, norad spacetrack report #3 1980
* hoots, norad spacetrack report #6 1986
* hoots, schumacher and glover 2004
* vallado, crawford, hujsak, kelso 2006
----------------------------------------------------------------------------*/
function initl(options) {
var ecco = options.ecco,
epoch = options.epoch,
inclo = options.inclo,
opsmode = options.opsmode;
var no = options.no;
// sgp4fix use old way of finding gst
// ----------------------- earth constants ---------------------
// sgp4fix identify constants and allow alternate values
// ------------- calculate auxillary epoch quantities ----------
var eccsq = ecco * ecco;
var omeosq = 1.0 - eccsq;
var rteosq = Math.sqrt(omeosq);
var cosio = Math.cos(inclo);
var cosio2 = cosio * cosio;
// ------------------ un-kozai the mean motion -----------------
var ak = Math.pow(_constants.xke / no, _constants.x2o3);
var d1 = 0.75 * _constants.j2 * (3.0 * cosio2 - 1.0) / (rteosq * omeosq);
var delPrime = d1 / (ak * ak);
var adel = ak * (1.0 - delPrime * delPrime - delPrime * (1.0 / 3.0 + 134.0 * delPrime * delPrime / 81.0));
delPrime = d1 / (adel * adel);
no /= 1.0 + delPrime;
var ao = Math.pow(_constants.xke / no, _constants.x2o3);
var sinio = Math.sin(inclo);
var po = ao * omeosq;
var con42 = 1.0 - 5.0 * cosio2;
var con41 = -con42 - cosio2 - cosio2;
var ainv = 1.0 / ao;
var posq = po * po;
var rp = ao * (1.0 - ecco);
var method = 'n';
// sgp4fix modern approach to finding sidereal time
var gsto;
if (opsmode === 'a') {
// sgp4fix use old way of finding gst
// count integer number of days from 0 jan 1970
var ts70 = epoch - 7305.0;
var ds70 = Math.floor(ts70 + 1.0e-8);
var tfrac = ts70 - ds70;
// find greenwich location at epoch
var c1 = 1.72027916940703639e-2; // eslint-disable-line no-loss-of-precision
var thgr70 = 1.7321343856509374; // eslint-disable-line no-loss-of-precision
var fk5r = 5.07551419432269442e-15; // eslint-disable-line no-loss-of-precision
var c1p2p = c1 + _constants.twoPi;
gsto = (thgr70 + c1 * ds70 + c1p2p * tfrac + ts70 * ts70 * fk5r) % _constants.twoPi;
if (gsto < 0.0) {
gsto += _constants.twoPi;
}
} else {
gsto = (0, _gstime["default"])(epoch + 2433281.5);
}
return {
no: no,
method: method,
ainv: ainv,
ao: ao,
con41: con41,
con42: con42,
cosio: cosio,
cosio2: cosio2,
eccsq: eccsq,
omeosq: omeosq,
posq: posq,
rp: rp,
rteosq: rteosq,
sinio: sinio,
gsto: gsto
};
}
+19
View File
@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = propagate;
var _constants = require("../constants");
var _ext = require("../ext");
var _sgp = _interopRequireDefault(require("./sgp4"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function propagate(satrec) {
for (var _len = arguments.length, jdayArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
jdayArgs[_key - 1] = arguments[_key];
}
// Return a position and velocity vector for a given date and time.
var j = _ext.jday.apply(void 0, jdayArgs);
var m = (j - satrec.jdsatepoch) * _constants.minutesPerDay;
return (0, _sgp["default"])(satrec, m);
}
+399
View File
@@ -0,0 +1,399 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = sgp4;
var _constants = require("../constants");
var _dpper = _interopRequireDefault(require("./dpper"));
var _dspace = _interopRequireDefault(require("./dspace"));
var _SatRec = require("./SatRec.js");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/*----------------------------------------------------------------------------
*
* procedure sgp4
*
* this procedure is the sgp4 prediction model from space command. this is an
* updated and combined version of sgp4 and sdp4, which were originally
* published separately in spacetrack report //3. this version follows the
* methodology from the aiaa paper (2006) describing the history and
* development of the code.
*
* author : david vallado 719-573-2600 28 jun 2005
*
* inputs :
* satrec - initialised structure from sgp4init() call.
* tsince - time since epoch (minutes)
*
* outputs :
* r - position vector km
* v - velocity km/sec
* return code - non-zero on error.
* 1 - mean elements, ecc >= 1.0 or ecc < -0.001 or a < 0.95 er
* 2 - mean motion less than 0.0
* 3 - pert elements, ecc < 0.0 or ecc > 1.0
* 4 - semi-latus rectum < 0.0
* 5 - epoch elements are sub-orbital
* 6 - satellite has decayed
*
* locals :
* am -
* axnl, aynl -
* betal -
* cosim , sinim , cosomm , sinomm , cnod , snod , cos2u ,
* sin2u , coseo1 , sineo1 , cosi , sini , cosip , sinip ,
* cosisq , cossu , sinsu , cosu , sinu
* delm -
* delomg -
* dndt -
* eccm -
* emsq -
* ecose -
* el2 -
* eo1 -
* eccp -
* esine -
* argpm -
* argpp -
* omgadf -
* pl -
* r -
* rtemsq -
* rdotl -
* rl -
* rvdot -
* rvdotl -
* su -
* t2 , t3 , t4 , tc
* tem5, temp , temp1 , temp2 , tempa , tempe , templ
* u , ux , uy , uz , vx , vy , vz
* inclm - inclination
* mm - mean anomaly
* nm - mean motion
* nodem - right asc of ascending node
* xinc -
* xincp -
* xl -
* xlm -
* mp -
* xmdf -
* xmx -
* xmy -
* nodedf -
* xnode -
* nodep -
* np -
*
* coupling :
* getgravconst-
* dpper
* dspace
*
* references :
* hoots, roehrich, norad spacetrack report //3 1980
* hoots, norad spacetrack report //6 1986
* hoots, schumacher and glover 2004
* vallado, crawford, hujsak, kelso 2006
----------------------------------------------------------------------------*/
function sgp4(satrec, tsince) {
var coseo1;
var sineo1;
var cosip;
var sinip;
var cosisq;
var delm;
var delomg;
var eo1;
var argpm;
var argpp;
var su;
var t3;
var t4;
var tc;
var tem5;
var temp;
var tempa;
var tempe;
var templ;
var inclm;
var mm;
var nm;
var nodem;
var xincp;
var xlm;
var mp;
var nodep;
/* ------------------ set mathematical constants --------------- */
// sgp4fix divisor for divide by zero check on inclination
// the old check used 1.0 + cos(pi-1.0e-9), but then compared it to
// 1.5 e-12, so the threshold was changed to 1.5e-12 for consistency
var temp4 = 1.5e-12;
// --------------------- clear sgp4 error flag -----------------
satrec.t = tsince;
satrec.error = _SatRec.SatRecError.None;
// ------- update for secular gravity and atmospheric drag -----
var xmdf = satrec.mo + satrec.mdot * satrec.t;
var argpdf = satrec.argpo + satrec.argpdot * satrec.t;
var nodedf = satrec.nodeo + satrec.nodedot * satrec.t;
argpm = argpdf;
mm = xmdf;
var t2 = satrec.t * satrec.t;
nodem = nodedf + satrec.nodecf * t2;
tempa = 1.0 - satrec.cc1 * satrec.t;
tempe = satrec.bstar * satrec.cc4 * satrec.t;
templ = satrec.t2cof * t2;
if (satrec.isimp !== 1) {
delomg = satrec.omgcof * satrec.t;
// sgp4fix use mutliply for speed instead of pow
var delmtemp = 1.0 + satrec.eta * Math.cos(xmdf);
delm = satrec.xmcof * (delmtemp * delmtemp * delmtemp - satrec.delmo);
temp = delomg + delm;
mm = xmdf + temp;
argpm = argpdf - temp;
t3 = t2 * satrec.t;
t4 = t3 * satrec.t;
tempa = tempa - satrec.d2 * t2 - satrec.d3 * t3 - satrec.d4 * t4;
tempe += satrec.bstar * satrec.cc5 * (Math.sin(mm) - satrec.sinmao);
templ = templ + satrec.t3cof * t3 + t4 * (satrec.t4cof + satrec.t * satrec.t5cof);
}
nm = satrec.no;
var em = satrec.ecco;
inclm = satrec.inclo;
if (satrec.method === 'd') {
tc = satrec.t;
var dspaceOptions = {
irez: satrec.irez,
d2201: satrec.d2201,
d2211: satrec.d2211,
d3210: satrec.d3210,
d3222: satrec.d3222,
d4410: satrec.d4410,
d4422: satrec.d4422,
d5220: satrec.d5220,
d5232: satrec.d5232,
d5421: satrec.d5421,
d5433: satrec.d5433,
dedt: satrec.dedt,
del1: satrec.del1,
del2: satrec.del2,
del3: satrec.del3,
didt: satrec.didt,
dmdt: satrec.dmdt,
dnodt: satrec.dnodt,
domdt: satrec.domdt,
argpo: satrec.argpo,
argpdot: satrec.argpdot,
t: satrec.t,
tc: tc,
gsto: satrec.gsto,
xfact: satrec.xfact,
xlamo: satrec.xlamo,
no: satrec.no,
atime: satrec.atime,
em: em,
argpm: argpm,
inclm: inclm,
xli: satrec.xli,
mm: mm,
xni: satrec.xni,
nodem: nodem,
nm: nm
};
var dspaceResult = (0, _dspace["default"])(dspaceOptions);
em = dspaceResult.em;
argpm = dspaceResult.argpm;
inclm = dspaceResult.inclm;
mm = dspaceResult.mm;
nodem = dspaceResult.nodem;
nm = dspaceResult.nm;
}
if (nm <= 0.0) {
// printf("// error nm %f\n", nm);
satrec.error = _SatRec.SatRecError.MeanMotionBelowZero;
// sgp4fix add return
return null;
}
var am = Math.pow(_constants.xke / nm, _constants.x2o3) * tempa * tempa;
nm = _constants.xke / Math.pow(am, 1.5);
em -= tempe;
// fix tolerance for error recognition
// sgp4fix am is fixed from the previous nm check
if (em >= 1.0 || em < -0.001) {
// || (am < 0.95)
// printf("// error em %f\n", em);
satrec.error = _SatRec.SatRecError.MeanEccentricityOutOfRange;
// sgp4fix to return if there is an error in eccentricity
return null;
}
// sgp4fix fix tolerance to avoid a divide by zero
if (em < 1.0e-6) {
em = 1.0e-6;
}
mm += satrec.no * templ;
xlm = mm + argpm + nodem;
nodem %= _constants.twoPi;
argpm %= _constants.twoPi;
xlm %= _constants.twoPi;
mm = (xlm - argpm - nodem) % _constants.twoPi;
var meanElements = {
am: am,
em: em,
im: inclm,
Om: nodem,
om: argpm,
mm: mm,
nm: nm
};
// ----------------- compute extra mean quantities -------------
var sinim = Math.sin(inclm);
var cosim = Math.cos(inclm);
// -------------------- add lunar-solar periodics --------------
var ep = em;
xincp = inclm;
argpp = argpm;
nodep = nodem;
mp = mm;
sinip = sinim;
cosip = cosim;
if (satrec.method === 'd') {
var dpperParameters = {
inclo: satrec.inclo,
init: 'n',
ep: ep,
inclp: xincp,
nodep: nodep,
argpp: argpp,
mp: mp,
opsmode: satrec.operationmode
};
var dpperResult = (0, _dpper["default"])(satrec, dpperParameters);
ep = dpperResult.ep;
nodep = dpperResult.nodep;
argpp = dpperResult.argpp;
mp = dpperResult.mp;
xincp = dpperResult.inclp;
if (xincp < 0.0) {
xincp = -xincp;
nodep += _constants.pi;
argpp -= _constants.pi;
}
if (ep < 0.0 || ep > 1.0) {
// printf("// error ep %f\n", ep);
satrec.error = _SatRec.SatRecError.PerturbedEccentricityOutOfRange;
// sgp4fix add return
return null;
}
}
// -------------------- long period periodics ------------------
if (satrec.method === 'd') {
sinip = Math.sin(xincp);
cosip = Math.cos(xincp);
satrec.aycof = -0.5 * _constants.j3oj2 * sinip;
// sgp4fix for divide by zero for xincp = 180 deg
if (Math.abs(cosip + 1.0) > 1.5e-12) {
satrec.xlcof = -0.25 * _constants.j3oj2 * sinip * (3.0 + 5.0 * cosip) / (1.0 + cosip);
} else {
satrec.xlcof = -0.25 * _constants.j3oj2 * sinip * (3.0 + 5.0 * cosip) / temp4;
}
}
var axnl = ep * Math.cos(argpp);
temp = 1.0 / (am * (1.0 - ep * ep));
var aynl = ep * Math.sin(argpp) + temp * satrec.aycof;
var xl = mp + argpp + nodep + temp * satrec.xlcof * axnl;
// --------------------- solve kepler's equation ---------------
var u = (xl - nodep) % _constants.twoPi;
eo1 = u;
tem5 = 9999.9;
var ktr = 1;
// sgp4fix for kepler iteration
// the following iteration needs better limits on corrections
while (Math.abs(tem5) >= 1.0e-12 && ktr <= 10) {
sineo1 = Math.sin(eo1);
coseo1 = Math.cos(eo1);
tem5 = 1.0 - coseo1 * axnl - sineo1 * aynl;
tem5 = (u - aynl * coseo1 + axnl * sineo1 - eo1) / tem5;
if (Math.abs(tem5) >= 0.95) {
if (tem5 > 0.0) {
tem5 = 0.95;
} else {
tem5 = -0.95;
}
}
eo1 += tem5;
ktr += 1;
}
// ------------- short period preliminary quantities -----------
var ecose = axnl * coseo1 + aynl * sineo1;
var esine = axnl * sineo1 - aynl * coseo1;
var el2 = axnl * axnl + aynl * aynl;
var pl = am * (1.0 - el2);
if (pl < 0.0) {
// printf("// error pl %f\n", pl);
satrec.error = _SatRec.SatRecError.SemiLatusRectumBelowZero;
// sgp4fix add return
return null;
}
var rl = am * (1.0 - ecose);
var rdotl = Math.sqrt(am) * esine / rl;
var rvdotl = Math.sqrt(pl) / rl;
var betal = Math.sqrt(1.0 - el2);
temp = esine / (1.0 + betal);
var sinu = am / rl * (sineo1 - aynl - axnl * temp);
var cosu = am / rl * (coseo1 - axnl + aynl * temp);
su = Math.atan2(sinu, cosu);
var sin2u = (cosu + cosu) * sinu;
var cos2u = 1.0 - 2.0 * sinu * sinu;
temp = 1.0 / pl;
var temp1 = 0.5 * _constants.j2 * temp;
var temp2 = temp1 * temp;
// -------------- update for short period periodics ------------
if (satrec.method === 'd') {
cosisq = cosip * cosip;
satrec.con41 = 3.0 * cosisq - 1.0;
satrec.x1mth2 = 1.0 - cosisq;
satrec.x7thm1 = 7.0 * cosisq - 1.0;
}
var mrt = rl * (1.0 - 1.5 * temp2 * betal * satrec.con41) + 0.5 * temp1 * satrec.x1mth2 * cos2u;
// sgp4fix for decaying satellites
if (mrt < 1.0) {
// printf("// decay condition %11.6f \n",mrt);
satrec.error = _SatRec.SatRecError.Decayed;
return null;
}
su -= 0.25 * temp2 * satrec.x7thm1 * sin2u;
var xnode = nodep + 1.5 * temp2 * cosip * sin2u;
var xinc = xincp + 1.5 * temp2 * cosip * sinip * cos2u;
var mvt = rdotl - nm * temp1 * satrec.x1mth2 * sin2u / _constants.xke;
var rvdot = rvdotl + nm * temp1 * (satrec.x1mth2 * cos2u + 1.5 * satrec.con41) / _constants.xke;
// --------------------- orientation vectors -------------------
var sinsu = Math.sin(su);
var cossu = Math.cos(su);
var snod = Math.sin(xnode);
var cnod = Math.cos(xnode);
var sini = Math.sin(xinc);
var cosi = Math.cos(xinc);
var xmx = -snod * cosi;
var xmy = cnod * cosi;
var ux = xmx * sinsu + cnod * cossu;
var uy = xmy * sinsu + snod * cossu;
var uz = sini * sinsu;
var vx = xmx * cossu - cnod * sinsu;
var vy = xmy * cossu - snod * sinsu;
var vz = sini * cossu;
// --------- position and velocity (in km and km/sec) ----------
var r = {
x: mrt * ux * _constants.earthRadius,
y: mrt * uy * _constants.earthRadius,
z: mrt * uz * _constants.earthRadius
};
var v = {
x: (mvt * ux + rvdot * vx) * _constants.vkmpersec,
y: (mvt * uy + rvdot * vy) * _constants.vkmpersec,
z: (mvt * uz + rvdot * vz) * _constants.vkmpersec
};
return {
position: r,
velocity: v,
meanElements: meanElements
};
}
+617
View File
@@ -0,0 +1,617 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = sgp4init;
var _constants = require("../constants");
var _dpper = _interopRequireDefault(require("./dpper"));
var _dscom = _interopRequireDefault(require("./dscom"));
var _dsinit = _interopRequireDefault(require("./dsinit"));
var _initl = _interopRequireDefault(require("./initl"));
var _sgp = _interopRequireDefault(require("./sgp4"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/*-----------------------------------------------------------------------------
*
* procedure sgp4init
*
* this procedure initializes variables for sgp4.
*
* author : david vallado 719-573-2600 28 jun 2005
* author : david vallado 719-573-2600 28 jun 2005
*
* inputs :
* opsmode - mode of operation afspc or improved 'a', 'i'
* satn - satellite number
* bstar - sgp4 type drag coefficient kg/m2er
* ecco - eccentricity
* epoch - epoch time in days from jan 0, 1950. 0 hr
* argpo - argument of perigee (output if ds)
* inclo - inclination
* mo - mean anomaly (output if ds)
* no - mean motion
* nodeo - right ascension of ascending node
*
* outputs :
* rec - common values for subsequent calls
* return code - non-zero on error.
* 1 - mean elements, ecc >= 1.0 or ecc < -0.001 or a < 0.95 er
* 2 - mean motion less than 0.0
* 3 - pert elements, ecc < 0.0 or ecc > 1.0
* 4 - semi-latus rectum < 0.0
* 5 - epoch elements are sub-orbital
* 6 - satellite has decayed
*
* locals :
* cnodm , snodm , cosim , sinim , cosomm , sinomm
* cc1sq , cc2 , cc3
* coef , coef1
* cosio4 -
* day -
* dndt -
* em - eccentricity
* emsq - eccentricity squared
* eeta -
* etasq -
* gam -
* argpm - argument of perigee
* nodem -
* inclm - inclination
* mm - mean anomaly
* nm - mean motion
* perige - perigee
* pinvsq -
* psisq -
* qzms24 -
* rtemsq -
* s1, s2, s3, s4, s5, s6, s7 -
* sfour -
* ss1, ss2, ss3, ss4, ss5, ss6, ss7 -
* sz1, sz2, sz3
* sz11, sz12, sz13, sz21, sz22, sz23, sz31, sz32, sz33 -
* tc -
* temp -
* temp1, temp2, temp3 -
* tsi -
* xpidot -
* xhdot1 -
* z1, z2, z3 -
* z11, z12, z13, z21, z22, z23, z31, z32, z33 -
*
* coupling :
* getgravconst-
* initl -
* dscom -
* dpper -
* dsinit -
* sgp4 -
*
* references :
* hoots, roehrich, norad spacetrack report #3 1980
* hoots, norad spacetrack report #6 1986
* hoots, schumacher and glover 2004
* vallado, crawford, hujsak, kelso 2006
----------------------------------------------------------------------------*/
function sgp4init(satrecInit, options) {
var opsmode = options.opsmode,
satn = options.satn,
epoch = options.epoch,
xbstar = options.xbstar,
xecco = options.xecco,
xargpo = options.xargpo,
xinclo = options.xinclo,
xmo = options.xmo,
xno = options.xno,
xnodeo = options.xnodeo;
var cosim;
var sinim;
var cc1sq;
var cc2;
var cc3;
var coef;
var coef1;
var cosio4;
var em;
var emsq;
var eeta;
var etasq;
var argpm;
var nodem;
var inclm;
var mm;
var nm;
var perige;
var pinvsq;
var psisq;
var qzms24;
var s1;
var s2;
var s3;
var s4;
var s5;
var sfour;
var ss1;
var ss2;
var ss3;
var ss4;
var ss5;
var sz1;
var sz3;
var sz11;
var sz13;
var sz21;
var sz23;
var sz31;
var sz33;
var tc;
var temp;
var temp1;
var temp2;
var temp3;
var tsi;
var xpidot;
var xhdot1;
var z1;
var z3;
var z11;
var z13;
var z21;
var z23;
var z31;
var z33;
/* ------------------------ initialization --------------------- */
// sgp4fix divisor for divide by zero check on inclination
// the old check used 1.0 + Math.cos(pi-1.0e-9), but then compared it to
// 1.5 e-12, so the threshold was changed to 1.5e-12 for consistency
var temp4 = 1.5e-12;
var satrec = satrecInit;
// ----------- set all near earth variables to zero ------------
satrec.isimp = 0;
satrec.method = 'n';
satrec.aycof = 0.0;
satrec.con41 = 0.0;
satrec.cc1 = 0.0;
satrec.cc4 = 0.0;
satrec.cc5 = 0.0;
satrec.d2 = 0.0;
satrec.d3 = 0.0;
satrec.d4 = 0.0;
satrec.delmo = 0.0;
satrec.eta = 0.0;
satrec.argpdot = 0.0;
satrec.omgcof = 0.0;
satrec.sinmao = 0.0;
satrec.t = 0.0;
satrec.t2cof = 0.0;
satrec.t3cof = 0.0;
satrec.t4cof = 0.0;
satrec.t5cof = 0.0;
satrec.x1mth2 = 0.0;
satrec.x7thm1 = 0.0;
satrec.mdot = 0.0;
satrec.nodedot = 0.0;
satrec.xlcof = 0.0;
satrec.xmcof = 0.0;
satrec.nodecf = 0.0;
// ----------- set all deep space variables to zero ------------
satrec.irez = 0;
satrec.d2201 = 0.0;
satrec.d2211 = 0.0;
satrec.d3210 = 0.0;
satrec.d3222 = 0.0;
satrec.d4410 = 0.0;
satrec.d4422 = 0.0;
satrec.d5220 = 0.0;
satrec.d5232 = 0.0;
satrec.d5421 = 0.0;
satrec.d5433 = 0.0;
satrec.dedt = 0.0;
satrec.del1 = 0.0;
satrec.del2 = 0.0;
satrec.del3 = 0.0;
satrec.didt = 0.0;
satrec.dmdt = 0.0;
satrec.dnodt = 0.0;
satrec.domdt = 0.0;
satrec.e3 = 0.0;
satrec.ee2 = 0.0;
satrec.peo = 0.0;
satrec.pgho = 0.0;
satrec.pho = 0.0;
satrec.pinco = 0.0;
satrec.plo = 0.0;
satrec.se2 = 0.0;
satrec.se3 = 0.0;
satrec.sgh2 = 0.0;
satrec.sgh3 = 0.0;
satrec.sgh4 = 0.0;
satrec.sh2 = 0.0;
satrec.sh3 = 0.0;
satrec.si2 = 0.0;
satrec.si3 = 0.0;
satrec.sl2 = 0.0;
satrec.sl3 = 0.0;
satrec.sl4 = 0.0;
satrec.gsto = 0.0;
satrec.xfact = 0.0;
satrec.xgh2 = 0.0;
satrec.xgh3 = 0.0;
satrec.xgh4 = 0.0;
satrec.xh2 = 0.0;
satrec.xh3 = 0.0;
satrec.xi2 = 0.0;
satrec.xi3 = 0.0;
satrec.xl2 = 0.0;
satrec.xl3 = 0.0;
satrec.xl4 = 0.0;
satrec.xlamo = 0.0;
satrec.zmol = 0.0;
satrec.zmos = 0.0;
satrec.atime = 0.0;
satrec.xli = 0.0;
satrec.xni = 0.0;
// sgp4fix - note the following variables are also passed directly via satrec.
// it is possible to streamline the sgp4init call by deleting the "x"
// variables, but the user would need to set the satrec.* values first. we
// include the additional assignments in case twoline2rv is not used.
satrec.bstar = xbstar;
satrec.ecco = xecco;
satrec.argpo = xargpo;
satrec.inclo = xinclo;
satrec.mo = xmo;
satrec.no = xno;
satrec.nodeo = xnodeo;
// sgp4fix add opsmode
satrec.operationmode = opsmode;
// ------------------------ earth constants -----------------------
// sgp4fix identify constants and allow alternate values
var ss = 78.0 / _constants.earthRadius + 1.0;
// sgp4fix use multiply for speed instead of pow
var qzms2ttemp = (120.0 - 78.0) / _constants.earthRadius;
var qzms2t = qzms2ttemp * qzms2ttemp * qzms2ttemp * qzms2ttemp;
satrec.init = 'y';
satrec.t = 0.0;
var initlOptions = {
satn: satn,
ecco: satrec.ecco,
epoch: epoch,
inclo: satrec.inclo,
no: satrec.no,
method: satrec.method,
opsmode: satrec.operationmode
};
var initlResult = (0, _initl["default"])(initlOptions);
var ao = initlResult.ao,
con42 = initlResult.con42,
cosio = initlResult.cosio,
cosio2 = initlResult.cosio2,
eccsq = initlResult.eccsq,
omeosq = initlResult.omeosq,
posq = initlResult.posq,
rp = initlResult.rp,
rteosq = initlResult.rteosq,
sinio = initlResult.sinio;
satrec.no = initlResult.no;
satrec.con41 = initlResult.con41;
satrec.gsto = initlResult.gsto;
satrec.a = Math.pow(satrec.no * _constants.tumin, -2.0 / 3.0);
satrec.alta = satrec.a * (1.0 + satrec.ecco) - 1.0;
satrec.altp = satrec.a * (1.0 - satrec.ecco) - 1.0;
satrec.error = 0;
// sgp4fix remove this check as it is unnecessary
// the mrt check in sgp4 handles decaying satellite cases even if the starting
// condition is below the surface of te earth
// if (rp < 1.0)
// {
// printf("// *** satn%d epoch elts sub-orbital ***\n", satn);
// satrec.error = 5;
// }
if (omeosq >= 0.0 || satrec.no >= 0.0) {
satrec.isimp = 0;
if (rp < 220.0 / _constants.earthRadius + 1.0) {
satrec.isimp = 1;
}
sfour = ss;
qzms24 = qzms2t;
perige = (rp - 1.0) * _constants.earthRadius;
// - for perigees below 156 km, s and qoms2t are altered -
if (perige < 156.0) {
sfour = perige - 78.0;
if (perige < 98.0) {
sfour = 20.0;
}
// sgp4fix use multiply for speed instead of pow
var qzms24temp = (120.0 - sfour) / _constants.earthRadius;
qzms24 = qzms24temp * qzms24temp * qzms24temp * qzms24temp;
sfour = sfour / _constants.earthRadius + 1.0;
}
pinvsq = 1.0 / posq;
tsi = 1.0 / (ao - sfour);
satrec.eta = ao * satrec.ecco * tsi;
etasq = satrec.eta * satrec.eta;
eeta = satrec.ecco * satrec.eta;
psisq = Math.abs(1.0 - etasq);
coef = qzms24 * Math.pow(tsi, 4.0);
coef1 = coef / Math.pow(psisq, 3.5);
cc2 = coef1 * satrec.no * (ao * (1.0 + 1.5 * etasq + eeta * (4.0 + etasq)) + 0.375 * _constants.j2 * tsi / psisq * satrec.con41 * (8.0 + 3.0 * etasq * (8.0 + etasq)));
satrec.cc1 = satrec.bstar * cc2;
cc3 = 0.0;
if (satrec.ecco > 1.0e-4) {
cc3 = -2.0 * coef * tsi * _constants.j3oj2 * satrec.no * sinio / satrec.ecco;
}
satrec.x1mth2 = 1.0 - cosio2;
satrec.cc4 = 2.0 * satrec.no * coef1 * ao * omeosq * (satrec.eta * (2.0 + 0.5 * etasq) + satrec.ecco * (0.5 + 2.0 * etasq) - _constants.j2 * tsi / (ao * psisq) * (-3.0 * satrec.con41 * (1.0 - 2.0 * eeta + etasq * (1.5 - 0.5 * eeta)) + 0.75 * satrec.x1mth2 * (2.0 * etasq - eeta * (1.0 + etasq)) * Math.cos(2.0 * satrec.argpo)));
satrec.cc5 = 2.0 * coef1 * ao * omeosq * (1.0 + 2.75 * (etasq + eeta) + eeta * etasq);
cosio4 = cosio2 * cosio2;
temp1 = 1.5 * _constants.j2 * pinvsq * satrec.no;
temp2 = 0.5 * temp1 * _constants.j2 * pinvsq;
temp3 = -0.46875 * _constants.j4 * pinvsq * pinvsq * satrec.no;
satrec.mdot = satrec.no + 0.5 * temp1 * rteosq * satrec.con41 + 0.0625 * temp2 * rteosq * (13.0 - 78.0 * cosio2 + 137.0 * cosio4);
satrec.argpdot = -0.5 * temp1 * con42 + 0.0625 * temp2 * (7.0 - 114.0 * cosio2 + 395.0 * cosio4) + temp3 * (3.0 - 36.0 * cosio2 + 49.0 * cosio4);
xhdot1 = -temp1 * cosio;
satrec.nodedot = xhdot1 + (0.5 * temp2 * (4.0 - 19.0 * cosio2) + 2.0 * temp3 * (3.0 - 7.0 * cosio2)) * cosio;
xpidot = satrec.argpdot + satrec.nodedot;
satrec.omgcof = satrec.bstar * cc3 * Math.cos(satrec.argpo);
satrec.xmcof = 0.0;
if (satrec.ecco > 1.0e-4) {
satrec.xmcof = -_constants.x2o3 * coef * satrec.bstar / eeta;
}
satrec.nodecf = 3.5 * omeosq * xhdot1 * satrec.cc1;
satrec.t2cof = 1.5 * satrec.cc1;
// sgp4fix for divide by zero with xinco = 180 deg
if (Math.abs(cosio + 1.0) > 1.5e-12) {
satrec.xlcof = -0.25 * _constants.j3oj2 * sinio * (3.0 + 5.0 * cosio) / (1.0 + cosio);
} else {
satrec.xlcof = -0.25 * _constants.j3oj2 * sinio * (3.0 + 5.0 * cosio) / temp4;
}
satrec.aycof = -0.5 * _constants.j3oj2 * sinio;
// sgp4fix use multiply for speed instead of pow
var delmotemp = 1.0 + satrec.eta * Math.cos(satrec.mo);
satrec.delmo = delmotemp * delmotemp * delmotemp;
satrec.sinmao = Math.sin(satrec.mo);
satrec.x7thm1 = 7.0 * cosio2 - 1.0;
// --------------- deep space initialization -------------
if (2 * _constants.pi / satrec.no >= 225.0) {
satrec.method = 'd';
satrec.isimp = 1;
tc = 0.0;
inclm = satrec.inclo;
var dscomOptions = {
epoch: epoch,
ep: satrec.ecco,
argpp: satrec.argpo,
tc: tc,
inclp: satrec.inclo,
nodep: satrec.nodeo,
np: satrec.no,
e3: satrec.e3,
ee2: satrec.ee2,
peo: satrec.peo,
pgho: satrec.pgho,
pho: satrec.pho,
pinco: satrec.pinco,
plo: satrec.plo,
se2: satrec.se2,
se3: satrec.se3,
sgh2: satrec.sgh2,
sgh3: satrec.sgh3,
sgh4: satrec.sgh4,
sh2: satrec.sh2,
sh3: satrec.sh3,
si2: satrec.si2,
si3: satrec.si3,
sl2: satrec.sl2,
sl3: satrec.sl3,
sl4: satrec.sl4,
xgh2: satrec.xgh2,
xgh3: satrec.xgh3,
xgh4: satrec.xgh4,
xh2: satrec.xh2,
xh3: satrec.xh3,
xi2: satrec.xi2,
xi3: satrec.xi3,
xl2: satrec.xl2,
xl3: satrec.xl3,
xl4: satrec.xl4,
zmol: satrec.zmol,
zmos: satrec.zmos
};
var dscomResult = (0, _dscom["default"])(dscomOptions);
satrec.e3 = dscomResult.e3;
satrec.ee2 = dscomResult.ee2;
satrec.peo = dscomResult.peo;
satrec.pgho = dscomResult.pgho;
satrec.pho = dscomResult.pho;
satrec.pinco = dscomResult.pinco;
satrec.plo = dscomResult.plo;
satrec.se2 = dscomResult.se2;
satrec.se3 = dscomResult.se3;
satrec.sgh2 = dscomResult.sgh2;
satrec.sgh3 = dscomResult.sgh3;
satrec.sgh4 = dscomResult.sgh4;
satrec.sh2 = dscomResult.sh2;
satrec.sh3 = dscomResult.sh3;
satrec.si2 = dscomResult.si2;
satrec.si3 = dscomResult.si3;
satrec.sl2 = dscomResult.sl2;
satrec.sl3 = dscomResult.sl3;
satrec.sl4 = dscomResult.sl4;
sinim = dscomResult.sinim;
cosim = dscomResult.cosim;
em = dscomResult.em;
emsq = dscomResult.emsq;
s1 = dscomResult.s1;
s2 = dscomResult.s2;
s3 = dscomResult.s3;
s4 = dscomResult.s4;
s5 = dscomResult.s5;
ss1 = dscomResult.ss1;
ss2 = dscomResult.ss2;
ss3 = dscomResult.ss3;
ss4 = dscomResult.ss4;
ss5 = dscomResult.ss5;
sz1 = dscomResult.sz1;
sz3 = dscomResult.sz3;
sz11 = dscomResult.sz11;
sz13 = dscomResult.sz13;
sz21 = dscomResult.sz21;
sz23 = dscomResult.sz23;
sz31 = dscomResult.sz31;
sz33 = dscomResult.sz33;
satrec.xgh2 = dscomResult.xgh2;
satrec.xgh3 = dscomResult.xgh3;
satrec.xgh4 = dscomResult.xgh4;
satrec.xh2 = dscomResult.xh2;
satrec.xh3 = dscomResult.xh3;
satrec.xi2 = dscomResult.xi2;
satrec.xi3 = dscomResult.xi3;
satrec.xl2 = dscomResult.xl2;
satrec.xl3 = dscomResult.xl3;
satrec.xl4 = dscomResult.xl4;
satrec.zmol = dscomResult.zmol;
satrec.zmos = dscomResult.zmos;
nm = dscomResult.nm;
z1 = dscomResult.z1;
z3 = dscomResult.z3;
z11 = dscomResult.z11;
z13 = dscomResult.z13;
z21 = dscomResult.z21;
z23 = dscomResult.z23;
z31 = dscomResult.z31;
z33 = dscomResult.z33;
var dpperOptions = {
inclo: inclm,
init: satrec.init,
ep: satrec.ecco,
inclp: satrec.inclo,
nodep: satrec.nodeo,
argpp: satrec.argpo,
mp: satrec.mo,
opsmode: satrec.operationmode
};
var dpperResult = (0, _dpper["default"])(satrec, dpperOptions);
satrec.ecco = dpperResult.ep;
satrec.inclo = dpperResult.inclp;
satrec.nodeo = dpperResult.nodep;
satrec.argpo = dpperResult.argpp;
satrec.mo = dpperResult.mp;
argpm = 0.0;
nodem = 0.0;
mm = 0.0;
var dsinitOptions = {
cosim: cosim,
emsq: emsq,
argpo: satrec.argpo,
s1: s1,
s2: s2,
s3: s3,
s4: s4,
s5: s5,
sinim: sinim,
ss1: ss1,
ss2: ss2,
ss3: ss3,
ss4: ss4,
ss5: ss5,
sz1: sz1,
sz3: sz3,
sz11: sz11,
sz13: sz13,
sz21: sz21,
sz23: sz23,
sz31: sz31,
sz33: sz33,
t: satrec.t,
tc: tc,
gsto: satrec.gsto,
mo: satrec.mo,
mdot: satrec.mdot,
no: satrec.no,
nodeo: satrec.nodeo,
nodedot: satrec.nodedot,
xpidot: xpidot,
z1: z1,
z3: z3,
z11: z11,
z13: z13,
z21: z21,
z23: z23,
z31: z31,
z33: z33,
ecco: satrec.ecco,
eccsq: eccsq,
em: em,
argpm: argpm,
inclm: inclm,
mm: mm,
nm: nm,
nodem: nodem,
irez: satrec.irez,
atime: satrec.atime,
d2201: satrec.d2201,
d2211: satrec.d2211,
d3210: satrec.d3210,
d3222: satrec.d3222,
d4410: satrec.d4410,
d4422: satrec.d4422,
d5220: satrec.d5220,
d5232: satrec.d5232,
d5421: satrec.d5421,
d5433: satrec.d5433,
dedt: satrec.dedt,
didt: satrec.didt,
dmdt: satrec.dmdt,
dnodt: satrec.dnodt,
domdt: satrec.domdt,
del1: satrec.del1,
del2: satrec.del2,
del3: satrec.del3,
xfact: satrec.xfact,
xlamo: satrec.xlamo,
xli: satrec.xli,
xni: satrec.xni
};
var dsinitResult = (0, _dsinit["default"])(dsinitOptions);
satrec.irez = dsinitResult.irez;
satrec.atime = dsinitResult.atime;
satrec.d2201 = dsinitResult.d2201;
satrec.d2211 = dsinitResult.d2211;
satrec.d3210 = dsinitResult.d3210;
satrec.d3222 = dsinitResult.d3222;
satrec.d4410 = dsinitResult.d4410;
satrec.d4422 = dsinitResult.d4422;
satrec.d5220 = dsinitResult.d5220;
satrec.d5232 = dsinitResult.d5232;
satrec.d5421 = dsinitResult.d5421;
satrec.d5433 = dsinitResult.d5433;
satrec.dedt = dsinitResult.dedt;
satrec.didt = dsinitResult.didt;
satrec.dmdt = dsinitResult.dmdt;
satrec.dnodt = dsinitResult.dnodt;
satrec.domdt = dsinitResult.domdt;
satrec.del1 = dsinitResult.del1;
satrec.del2 = dsinitResult.del2;
satrec.del3 = dsinitResult.del3;
satrec.xfact = dsinitResult.xfact;
satrec.xlamo = dsinitResult.xlamo;
satrec.xli = dsinitResult.xli;
satrec.xni = dsinitResult.xni;
}
// ----------- set variables if not deep space -----------
if (satrec.isimp !== 1) {
cc1sq = satrec.cc1 * satrec.cc1;
satrec.d2 = 4.0 * ao * tsi * cc1sq;
temp = satrec.d2 * tsi * satrec.cc1 / 3.0;
satrec.d3 = (17.0 * ao + sfour) * temp;
satrec.d4 = 0.5 * temp * ao * tsi * (221.0 * ao + 31.0 * sfour) * satrec.cc1;
satrec.t3cof = satrec.d2 + 2.0 * cc1sq;
satrec.t4cof = 0.25 * (3.0 * satrec.d3 + satrec.cc1 * (12.0 * satrec.d2 + 10.0 * cc1sq));
satrec.t5cof = 0.2 * (3.0 * satrec.d4 + 12.0 * satrec.cc1 * satrec.d3 + 6.0 * satrec.d2 * satrec.d2 + 15.0 * cc1sq * (2.0 * satrec.d2 + cc1sq));
}
/* finally propogate to zero epoch to initialize all others. */
// sgp4fix take out check to let satellites process until they are actually below earth surface
// if(satrec.error == 0)
}
(0, _sgp["default"])(satrec, 0);
satrec.init = 'n';
}
+131
View File
@@ -0,0 +1,131 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.sunPos = sunPos;
var _constants = require("./constants");
////////////////////////////////////////////////////////////////////////////////////
/* Line by Line MATLAB-to-Javascript conversion of "sun.mat" from Vallado package */
////////////////////////////////////////////////////////////////////////////////////
/* -----------------------------------------------------------------------------
*
* function sunPos
*
* this function calculates the geocentric equatorial position vector
* the sun given the julian date. this is the low precision formula and
* is valid for years from 1950 to 2050. accuaracy of apparent coordinates
* is 0.01 degrees. notice many of the calculations are performed in
* degrees, and are not changed until later. this is due to the fact that
* the almanac uses degrees exclusively in their formulations.
*
* author : david vallado 719-573-2600 1 mar 2001
*
* inputs description range / units
* jd - julian date days from 4713 bc
*
* outputs :
* rsun - ijk position vector of the sun au
* rtasc - right ascension rad
* decl - declination rad
*
* coupling :
* -
*
* references :
* VALLADO, DAVID A. (2022) ‘Computer software in MATLAB’, in Fundamentals of astrodynamics and applications. 5th edn.
* Computer software in MATLAB: http://celestrak.org/software/vallado-sw.php
* --------------------------------------------------------------------------- */
function sunPos(jday) {
// ------------------------- implementation -----------------
// ------------------- initialize values --------------------
var tut1 = (jday - 2451545) / 36525;
var meanlong = (280.460 + 36000.77 * tut1) % 360; //deg
var ttdb = tut1; // is this declaration required instead of replacing `ttdb` with `tut1`
var meananomaly = (357.5277233 + 35999.05034 * ttdb * _constants.deg2rad) % _constants.twoPi; //rad
if (meananomaly < 0) {
meananomaly += _constants.twoPi;
}
var eclplong_raw = (meanlong + 1.914666471 * Math.sin(meananomaly) + 0.019994643 * Math.sin(2.0 * meananomaly)) % 360.0 * _constants.deg2rad; //rad
var obliquity = (23.439291 - 0.0130042 * ttdb) * _constants.deg2rad; //rad
// --------- find magnitude of sun vector, and it's components ------
var magr = 1.000140612 - 0.016708617 * Math.cos(meananomaly) - 0.000139589 * Math.cos(2.0 * meananomaly); // in au's
var rsun = [magr * Math.cos(eclplong_raw), magr * Math.cos(obliquity) * Math.sin(eclplong_raw), magr * Math.sin(obliquity) * Math.sin(eclplong_raw)];
var rtasc_raw = Math.atan(Math.cos(obliquity) * Math.tan(eclplong_raw));
// --- check that rtasc is in the same quadrant as eclplong_raw ----
var eclplong = eclplong_raw;
if (eclplong < 0.0) {
eclplong += _constants.twoPi; // make sure it's in 0 to 2pi range
}
var rtasc = rtasc_raw;
if (Math.abs(eclplong_raw - rtasc) > _constants.pi * 0.5) {
rtasc += 0.5 * _constants.pi * Math.round((eclplong_raw - rtasc_raw) / (0.5 * _constants.pi));
}
var decl = Math.asin(Math.sin(obliquity) * Math.sin(eclplong_raw));
return {
rsun: rsun,
rtasc: rtasc,
decl: decl
};
}
/* Original MATLAB code for Sun position from Vallado package (sun.mat) */
/*
function [rsun,rtasc,decl] = sun ( jd );
twopi = 2.0*pi;
deg2rad = pi/180.0;
show = 'n';
% ------------------------- implementation -----------------
% ------------------- initialize values --------------------
tut1= ( jd - 2451545.0 )/ 36525.0;
if show == 'y'
fprintf(1,'tut1 %14.9f \n',tut1);
end
meanlong= 280.460 + 36000.77*tut1;
meanlong= rem( meanlong,360.0 ); %deg
ttdb= tut1;
meananomaly= 357.5277233 + 35999.05034 *ttdb;
meananomaly= rem( meananomaly*deg2rad,twopi ); %rad
if ( meananomaly < 0.0 )
meananomaly= twopi + meananomaly;
end
eclplong_raw= meanlong + 1.914666471 *sin(meananomaly) ...
+ 0.019994643 *sin(2.0 *meananomaly); %deg
eclplong_raw= rem( eclplong_raw,360.0 ); %deg
obliquity= 23.439291 - 0.0130042 *ttdb; %deg
eclplong_raw = eclplong_raw *deg2rad;
obliquity= obliquity *deg2rad;
% --------- find magnitude of sun vector, ) components ------
magr= 1.000140612 - 0.016708617 *cos( meananomaly ) ...
- 0.000139589 *cos( 2.0 *meananomaly ); % in au's
rsun(1)= magr*cos( eclplong_raw );
rsun(2)= magr*cos(obliquity)*sin(eclplong_raw);
rsun(3)= magr*sin(obliquity)*sin(eclplong_raw);
if show == 'y'
fprintf(1,'meanlon %11.6f meanan %11.6f eclplon %11.6f obli %11.6f \n', ...
meanlong,meananomaly/deg2rad,eclplong_raw/deg2rad,obliquity/deg2rad);
fprintf(1,'rs %11.9f %11.9f %11.9f \n',rsun);
fprintf(1,'magr %14.7f \n',magr);
end
rtasc= atan( cos(obliquity)*tan(eclplong_raw) );
% --- check that rtasc is in the same quadrant as eclplong_raw ----
if ( eclplong_raw < 0.0 )
eclplong_raw= eclplong_raw + twopi; % make sure it's in 0 to 2pi range
end
if ( abs( eclplong_raw-rtasc ) > pi*0.5 )
rtasc= rtasc + 0.5 *pi*round( (eclplong_raw-rtasc)/(0.5 *pi));
end
decl = asin( sin(obliquity)*sin(eclplong_raw) );
*/
+167
View File
@@ -0,0 +1,167 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.degreesLat = degreesLat;
exports.degreesLong = degreesLong;
exports.degreesToRadians = degreesToRadians;
exports.ecfToEci = ecfToEci;
exports.ecfToLookAngles = ecfToLookAngles;
exports.eciToEcf = eciToEcf;
exports.eciToGeodetic = eciToGeodetic;
exports.geodeticToEcf = geodeticToEcf;
exports.radiansLat = radiansLat;
exports.radiansLong = radiansLong;
exports.radiansToDegrees = radiansToDegrees;
var _constants = require("./constants");
function radiansToDegrees(radians) {
return radians * _constants.rad2deg;
}
function degreesToRadians(degrees) {
return degrees * _constants.deg2rad;
}
function degreesLat(radians) {
if (radians < -_constants.pi / 2 || radians > _constants.pi / 2) {
throw new RangeError('Latitude radians must be in range [-pi/2; pi/2].');
}
return radiansToDegrees(radians);
}
function degreesLong(radians) {
if (radians < -_constants.pi || radians > _constants.pi) {
throw new RangeError('Longitude radians must be in range [-pi; pi].');
}
return radiansToDegrees(radians);
}
function radiansLat(degrees) {
if (degrees < -90 || degrees > 90) {
throw new RangeError('Latitude degrees must be in range [-90; 90].');
}
return degreesToRadians(degrees);
}
function radiansLong(degrees) {
if (degrees < -180 || degrees > 180) {
throw new RangeError('Longitude degrees must be in range [-180; 180].');
}
return degreesToRadians(degrees);
}
function geodeticToEcf(_ref) {
var longitude = _ref.longitude,
latitude = _ref.latitude,
height = _ref.height;
var a = 6378.137;
var b = 6356.7523142;
var f = (a - b) / a;
var e2 = 2 * f - f * f;
var normal = a / Math.sqrt(1 - e2 * (Math.sin(latitude) * Math.sin(latitude)));
var x = (normal + height) * Math.cos(latitude) * Math.cos(longitude);
var y = (normal + height) * Math.cos(latitude) * Math.sin(longitude);
var z = (normal * (1 - e2) + height) * Math.sin(latitude);
return {
x: x,
y: y,
z: z
};
}
function eciToGeodetic(eci, gmst) {
// http://www.celestrak.com/columns/v02n03/
var a = 6378.137;
var b = 6356.7523142;
var R = Math.sqrt(eci.x * eci.x + eci.y * eci.y);
var f = (a - b) / a;
var e2 = 2 * f - f * f;
var longitude = Math.atan2(eci.y, eci.x) - gmst;
while (longitude < -_constants.pi) {
longitude += _constants.twoPi;
}
while (longitude > _constants.pi) {
longitude -= _constants.twoPi;
}
var kmax = 20;
var k = 0;
var latitude = Math.atan2(eci.z, Math.sqrt(eci.x * eci.x + eci.y * eci.y));
var C;
while (k++ < kmax) {
C = 1 / Math.sqrt(1 - e2 * (Math.sin(latitude) * Math.sin(latitude)));
latitude = Math.atan2(eci.z + a * C * e2 * Math.sin(latitude), R);
}
var height = R / Math.cos(latitude) - a * C;
return {
longitude: longitude,
latitude: latitude,
height: height
};
}
function ecfToEci(ecf, gmst) {
// ccar.colorado.edu/ASEN5070/handouts/coordsys.doc
//
// [X] [C -S 0][X]
// [Y] = [S C 0][Y]
// [Z]eci [0 0 1][Z]ecf
//
var X = ecf.x * Math.cos(gmst) - ecf.y * Math.sin(gmst);
var Y = ecf.x * Math.sin(gmst) + ecf.y * Math.cos(gmst);
var Z = ecf.z;
return {
x: X,
y: Y,
z: Z
};
}
function eciToEcf(eci, gmst) {
// ccar.colorado.edu/ASEN5070/handouts/coordsys.doc
//
// [X] [C -S 0][X]
// [Y] = [S C 0][Y]
// [Z]eci [0 0 1][Z]ecf
//
//
// Inverse:
// [X] [C S 0][X]
// [Y] = [-S C 0][Y]
// [Z]ecf [0 0 1][Z]eci
var x = eci.x * Math.cos(gmst) + eci.y * Math.sin(gmst);
var y = eci.x * -Math.sin(gmst) + eci.y * Math.cos(gmst);
var z = eci.z;
return {
x: x,
y: y,
z: z
};
}
function topocentric(observerGeodetic, satelliteEcf) {
// http://www.celestrak.com/columns/v02n02/
// TS Kelso's method, except I'm using ECF frame
// and he uses ECI.
var longitude = observerGeodetic.longitude,
latitude = observerGeodetic.latitude;
var observerEcf = geodeticToEcf(observerGeodetic);
var rx = satelliteEcf.x - observerEcf.x;
var ry = satelliteEcf.y - observerEcf.y;
var rz = satelliteEcf.z - observerEcf.z;
var topS = Math.sin(latitude) * Math.cos(longitude) * rx + Math.sin(latitude) * Math.sin(longitude) * ry - Math.cos(latitude) * rz;
var topE = -Math.sin(longitude) * rx + Math.cos(longitude) * ry;
var topZ = Math.cos(latitude) * Math.cos(longitude) * rx + Math.cos(latitude) * Math.sin(longitude) * ry + Math.sin(latitude) * rz;
return {
topS: topS,
topE: topE,
topZ: topZ
};
}
function topocentricToLookAngles(tc) {
var topS = tc.topS,
topE = tc.topE,
topZ = tc.topZ;
var rangeSat = Math.sqrt(topS * topS + topE * topE + topZ * topZ);
var El = Math.asin(topZ / rangeSat);
var Az = Math.atan2(-topE, topS) + _constants.pi;
return {
azimuth: Az,
elevation: El,
rangeSat: rangeSat // Range in km
};
}
function ecfToLookAngles(observerGeodetic, satelliteEcf) {
var topocentricCoords = topocentric(observerGeodetic, satelliteEcf);
return topocentricToLookAngles(topocentricCoords);
}
+83
View File
@@ -0,0 +1,83 @@
{
"name": "satellite.js",
"version": "6.0.2",
"description": "SGP4/SDP4 calculation library",
"main": "lib/index.js",
"jsnext:main": "dist/satellite.es.js",
"types": "types/index.d.ts",
"module": "dist/satellite.es.js",
"scripts": {
"build": "rimraf lib dist compiled types && tsc && npm run transpile && npm run dist",
"transpile": "babel compiled --out-dir lib --ignore indexUmd.js",
"dist": "npm run dist:es && npm run dist:umd:dev && npm run dist:umd:prod",
"dist:es": "rollup --bundleConfigAsCjs --config rollup.config.es.js",
"dist:umd": "rollup --bundleConfigAsCjs --config rollup.config.js",
"dist:umd:dev": "cross-env NODE_ENV=development npm run dist:umd",
"dist:umd:prod": "cross-env NODE_ENV=production npm run dist:umd",
"watch:es": "node --require @babel/register rollup.watch.es.js",
"copy": "copyfiles -u 1 'dist/**/*' sgp4_verification/lib/sgp4",
"lint": "eslint src",
"lint:test": "eslint test",
"test": "jest",
"test:coverage": "jest --coverage",
"raise": "raise-version"
},
"repository": {
"type": "git",
"url": "git://github.com/shashwatak/satellite-js"
},
"keywords": [
"sgp4",
"sdp4",
"satellite",
"TLE",
"two-line elements",
"OMM",
"sgp4prop"
],
"author": "Shashwat Kandadai <shashwatak@gmail.com> (https://github.com/shashwatak)",
"contributors": [
"Dmitriy Pushkov <ezze@ezze.org> (http://www.ezze.org)"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/shashwatak/satellite-js/issues"
},
"devDependencies": {
"@babel/cli": "^7.20.7",
"@babel/core": "^7.20.12",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-json-strings": "^7.18.6",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-import-meta": "^7.10.4",
"@babel/preset-env": "^7.20.2",
"@babel/register": "^7.18.9",
"@eslint/js": "^9.22.0",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-terser": "^0.2.1",
"chokidar": "^3.5.3",
"copyfiles": "^2.4.1",
"cross-env": "^7.0.3",
"eslint": "^9.22.0",
"eslint-plugin-import": "^2.26.0",
"glob": "^8.0.3",
"jest": "^29.7.0",
"prepend-file": "^2.0.1",
"raise-version": "^0.5.0",
"rimraf": "^3.0.2",
"rollup": "^3.9.1",
"typescript": "^5.8.2",
"typescript-eslint": "^8.26.1"
},
"jest": {
"testPathIgnorePatterns": [
"node_modules",
"test/propagation/sgp4Catalog.test.js"
]
},
"homepage": "https://github.com/shashwatak/satellite-js",
"directories": {
"lib": "lib",
"test": "test"
}
}
Binary file not shown.
+27
View File
@@ -0,0 +1,27 @@
{
"compilerOptions": {
"target": "ES6",
"strict": true,
"allowUnusedLabels": false,
"allowUnreachableCode": false,
"exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"isolatedModules": true,
"esModuleInterop": true,
"skipLibCheck": true,
"declaration": true,
"declarationDir": "./types",
"outDir": "./compiled",
},
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Strictest (minus esModuleInterop)",
"include": [
"src/**.ts",
],
}
+215
View File
@@ -0,0 +1,215 @@
/**
* Type alias documents units are kilometer (km)
*/
export type Kilometer = number;
/**
* Type alias documents units are kilometer per second (km/s)
*/
export type KilometerPerSecond = number;
/**
* Type alias documents units are radians
*/
export type Radians = number;
/**
* Type alias documents units are degrees
*/
export type Degrees = number;
/**
* Type alias documents units for mean motion are radians per minute
*/
export type RadiansPerMinute = number;
/**
* Type alias documents units for semi-major axis (earth radii)
*/
export type EarthRadii = number;
/**
* Coordinate frame Earth Centered Inertial (ECI)
* https://en.wikipedia.org/wiki/Earth-centered_inertial
*/
export interface EciVec3<T> {
x: T;
y: T;
z: T;
}
/**
* Coordinate frame Earth Centered Fixed (ECF)
* https://en.wikipedia.org/wiki/ECEF
*/
export interface EcfVec3<T> {
x: T;
y: T;
z: T;
}
/**
* A set of "singly averaged mean elements" that describe shape of the
* satellite’s orbit at the propagation date. They are averaged
* with respect to the mean anomaly and include the effects of secular
* gravity, atmospheric drag, and - in Deep Space mode - of those
* pertubations from the Sun and Moon that SGP4 averages over an entire
* revolution of each of those bodies. They omit both the shorter-term
* and longer-term periodic pertubations from the Sun and Moon that
* SGP4 applies right before computing each position.
*/
export interface MeanElements {
/**
* Average semi-major axis (earth radii).
*/
am: EarthRadii;
/**
* Average eccentricity.
*/
em: number;
/**
* Average inclination (radians).
*/
im: Radians;
/**
* Average right ascension of ascending node (radians).
*/
Om: Radians;
/**
* Average argument of perigee (radians).
*/
om: Radians;
/**
* Average mean anomaly (radians).
*/
mm: Radians;
/**
* Average mean motion (radians/minute).
*/
nm: RadiansPerMinute;
}
/**
* The position_velocity result is a key-value pair of ECI coordinates.
* These are the base results from which all other coordinates are derived.
* If there is an error the position and velocity will be false.
* The meanElements are the averaged elements of the orbit at the
* moment of propagation.
*/
export interface PositionAndVelocity {
position: EciVec3<Kilometer>;
velocity: EciVec3<KilometerPerSecond>;
meanElements: MeanElements;
}
/**
* https://en.wikipedia.org/wiki/Geographic_coordinate_system#Latitude_and_longitude
*/
export interface GeodeticLocation {
longitude: Radians;
latitude: Radians;
height: Kilometer;
}
/**
* You will need GMST for some of the coordinate transforms.
* GMST - Greenwich Mean Sidereal Time
* http://en.wikipedia.org/wiki/Sidereal_time#Definition
*/
export type GMSTime = number;
/**
* https://en.wikipedia.org/wiki/Azimuth
*/
export interface LookAngles {
azimuth: Radians;
elevation: Radians;
rangeSat: Kilometer;
}
type StartsWith<T extends string> = `${T}${string}`;
/**
* This is the base interface for the OMM JSON object as specified in Orbit Data Messages
* recommended standard, version 3.0.
*
* Note that this is not a 1:1 mapping. Only the fields that are necessary to propagate
* a satellite orbit are made required. For example, CCSDS_OMM_VERS is required by the spec,
* but is not present in Celestrak OMM output, and is not required to propagate the satellite,
* so it is made optional here.
*
* Numeric fields may be represented as strings or numbers in the original json, depending on
* the source. This is because the spec doesn't specify the type, and different sources use
* different types: at the time of writing, Celestrak uses numbers, while SpaceTrack uses strings.
*/
export interface OMMJsonObjectV3 {
/**
* The version is restricted in TypeScript to only among the ones this library supports.
* Versions are incremented on breaking changes, so it is adviced you validate this field.
*
* NOTE: This is required field in OMM spec, but Celestrak omits it, so we make it optional
* and assume version 3.0 if not present.
*/
CCSDS_OMM_VERS?: StartsWith<'3.'>;
COMMENT?: string;
CLASSIFICATION?: string;
OBJECT_NAME: string;
/**
* Recommended, but not required, to be an International spacecraft designator.
*/
OBJECT_ID: string;
/**
* NOTE: This is required field in OMM spec, but Celestrak omits it, so we make it optional.
* If present, it is restricted to only the value this library supports.
*/
CENTER_NAME?: 'EARTH';
/**
* NOTE: This is required field in OMM spec, but Celestrak omits it, so we make it optional.
* If present, it is restricted to only 'TEME' as it is the only value that can come with
* SGP ephemeris type.
*/
REF_FRAME?: 'TEME';
/**
* NOTE: This is required field in OMM spec, but Celestrak omits it, so we make it optional
*/
REF_FRAME_EPOCH?: string;
/**
* NOTE: This is required field in OMM spec, but Celestrak omits it, so we make it optional
*/
TIME_SYSTEM?: 'UTC';
/**
* NOTE: This is required field in OMM spec, but Celestrak omits it, so we make it optional
*/
MEAN_ELEMENT_THEORY?: 'SGP4';
/**
* NOTE: This is required field in OMM spec, but Celestrak omits it, so we make it optional
*/
CREATION_DATE?: string;
/**
* NOTE: This is required field in OMM spec, but Celestrak omits it, so we make it optional
*/
ORIGINATOR?: string;
/**
* ISO datetime
*/
EPOCH: string;
MEAN_MOTION: string | number;
ECCENTRICITY: string | number;
/**
* Degrees
*/
INCLINATION: number | string;
RA_OF_ASC_NODE: number | string;
/**
* Degrees
*/
ARG_OF_PERICENTER: number | string;
/**
* Degrees
*/
MEAN_ANOMALY: number | string;
/**
* The only value supported by this library
*/
EPHEMERIS_TYPE?: 0 | "0";
CLASSIFICATION_TYPE?: "U" | "C";
NORAD_CAT_ID: string | number;
ELEMENT_SET_NO: string | number;
REV_AT_EPOCH?: string | number;
BSTAR: string | number;
MEAN_MOTION_DOT: string | number;
MEAN_MOTION_DDOT: string | number;
/**
* This handles additional metadata, such as OBJECT_TYPE, COUNTRY_CODE etc
*/
[key: string]: unknown;
}
export type OMMJsonObject = OMMJsonObjectV3;
export type SupportedOMMVersion = NonNullable<OMMJsonObject['CCSDS_OMM_VERS']>;
export {};
+16
View File
@@ -0,0 +1,16 @@
export declare const pi: number;
export declare const twoPi: number;
export declare const deg2rad: number;
export declare const rad2deg: number;
export declare const minutesPerDay = 1440;
export declare const mu = 398600.8;
export declare const earthRadius = 6378.135;
export declare const xke: number;
export declare const vkmpersec: number;
export declare const tumin: number;
export declare const j2 = 0.001082616;
export declare const j3 = -0.00000253881;
export declare const j4 = -0.00000165597;
export declare const j3oj2: number;
export declare const x2o3: number;
export declare const xpdotp: number;
+8
View File
@@ -0,0 +1,8 @@
import { EcfVec3, Kilometer, KilometerPerSecond } from './common-types.js';
/**
* Negative range rate means the satellite is moving towards the observer and
* its frequency is shifted higher because 1 minus a negative range rate is
* positive. If the range rate is positive, the satellite is moving away from
* the observer and its frequency is shifted lower.
*/
export default function dopplerFactor(observerCoordsEcf: EcfVec3<Kilometer>, positionEcf: EcfVec3<Kilometer>, velocityEcf: EcfVec3<KilometerPerSecond>): number;
+12
View File
@@ -0,0 +1,12 @@
export type JDay = number;
export declare function days2mdhms(year: number, days: number): {
mon: number;
day: number;
hr: number;
minute: number;
sec: number;
};
export declare function jday(year: Date): JDay;
export declare function jday(year: number, mon: number, day: number, hr: number, minute: number, sec: number, msec?: number): JDay;
export declare function invjday(jd: JDay, asArray: true): [year: number, mon: number, day: number, hr: number, minute: number, sec: number];
export declare function invjday(jd: JDay, asArray?: false): Date;
+9
View File
@@ -0,0 +1,9 @@
export * as constants from './constants';
export { jday, invjday } from './ext';
export { twoline2satrec, json2satrec } from './io';
export { propagate, sgp4, gstime } from './propagation';
export { default as dopplerFactor } from './dopplerFactor';
export { radiansToDegrees, degreesToRadians, degreesLat, degreesLong, radiansLat, radiansLong, geodeticToEcf, eciToGeodetic, eciToEcf, ecfToEci, ecfToLookAngles, } from './transforms';
export { sunPos } from './sun';
export { type SatRec, SatRecError } from './propagation/SatRec.js';
export * from './common-types.js';
+33
View File
@@ -0,0 +1,33 @@
import * as constants from './constants';
import { jday, invjday } from './ext';
import { twoline2satrec, json2satrec } from './io';
import { propagate, sgp4, gstime } from './propagation';
import { SatRecError } from './propagation/SatRec.js';
import dopplerFactor from './dopplerFactor';
import { radiansToDegrees, degreesToRadians, degreesLat, degreesLong, radiansLat, radiansLong, geodeticToEcf, eciToGeodetic, eciToEcf, ecfToEci, ecfToLookAngles } from './transforms';
import { sunPos } from './sun';
declare const _default: {
SatRecError: typeof SatRecError;
constants: typeof constants;
propagate: typeof propagate;
sgp4: typeof sgp4;
twoline2satrec: typeof twoline2satrec;
json2satrec: typeof json2satrec;
gstime: typeof gstime;
jday: typeof jday;
invjday: typeof invjday;
dopplerFactor: typeof dopplerFactor;
radiansToDegrees: typeof radiansToDegrees;
degreesToRadians: typeof degreesToRadians;
degreesLat: typeof degreesLat;
degreesLong: typeof degreesLong;
radiansLat: typeof radiansLat;
radiansLong: typeof radiansLong;
geodeticToEcf: typeof geodeticToEcf;
eciToGeodetic: typeof eciToGeodetic;
eciToEcf: typeof eciToEcf;
ecfToEci: typeof ecfToEci;
ecfToLookAngles: typeof ecfToLookAngles;
sunPos: typeof sunPos;
};
export default _default;
+18
View File
@@ -0,0 +1,18 @@
import { OMMJsonObject } from './common-types.js';
/**
* Return a Satellite imported from two lines of TLE data.
*
* Provide the two TLE lines as strings `tleLine1` and `tleLine2`,
* and select which standard set of gravitational constants you want
* by providing `gravity_constants`:
*
* `sgp4.propagation.wgs72` - Standard WGS 72 model
* `sgp4.propagation.wgs84` - More recent WGS 84 model
* `sgp4.propagation.wgs72old` - Legacy support for old SGP4 behavior
*
* Normally, computations are made using letious recent improvements
* to the algorithm. If you want to turn some of these off and go
* back into "afspc" mode, then set `afspc_mode` to `True`.
*/
export declare function twoline2satrec(longstr1: string, longstr2: string): import("./propagation/SatRec.js").SatRec;
export declare function json2satrec(jsonobj: OMMJsonObject, opsmode?: 'a' | 'i'): import("./propagation/SatRec.js").SatRec;
+3
View File
@@ -0,0 +1,3 @@
export { default as propagate } from './propagation/propagate';
export { default as sgp4 } from './propagation/sgp4';
export { default as gstime } from './propagation/gstime';
+196
View File
@@ -0,0 +1,196 @@
export declare enum SatRecError {
/**
* No error, propagation for the last supplied date is successful
*/
None = 0,
/**
* Mean eccentricity is out of range 0 ≤ e < 1
*/
MeanEccentricityOutOfRange = 1,
/**
* Mean motion has fallen below zero.
*/
MeanMotionBelowZero = 2,
/**
* Perturbed eccentricity is out of range 0 ≤ e < 1
*/
PerturbedEccentricityOutOfRange = 3,
/**
* Length of the orbit’s semi-latus rectum has fallen below zero.
*/
SemiLatusRectumBelowZero = 4,
/**
* Orbit has decayed: the computed position is underground.
*/
Decayed = 6
}
/**
* A structure that contains all the information needed to propagate a satellite's orbit using the SGP4 model.
*
* Mostly you can consider it opaque as you only need to pass it to `propagate` function.
* All properties should be considered read-only as they're used and set by SGP4 model internally.
*
* This interface is a direct translation of C++ struct `elsetrec` from the source code by David Vallado;
* all changes to the original struct are documented.
*/
export interface SatRec {
/**
* Stringified satellite number, usually from NORAD catalog
*/
satnum: string;
/**
* Full four-digit year of this element set's epoch moment
*/
epochyr: number;
epochtynumrev: number;
/**
* Error code produced by the most recent SGP4 propagation you performed with this element set.
*/
error: SatRecError;
/**
* A single character that directs SGP4 to either operate in its modern 'i' improved mode or
* in its legacy 'a' AFSPC mode.
*/
operationmode: 'a' | 'i';
init: 'y' | 'n';
/**
* A single character, chosen automatically when the orbital elements were loaded, that
* indicates whether SGP4 has chosen to use its built-in 'n' Near Earth or 'd' Deep Space
* mode for this satellite.
*/
method: 'n' | 'd';
isimp: number;
aycof: number;
con41: number;
cc1: number;
cc4: number;
cc5: number;
d2: number;
d3: number;
d4: number;
delmo: number;
eta: number;
argpdot: number;
omgcof: number;
sinmao: number;
/**
* The time you gave when you most recently asked SGP4 to compute this satellite’s position,
* measured in minutes before (negative) or after (positive) the satellite’s epoch.
*/
t: number;
t2cof: number;
t3cof: number;
t4cof: number;
t5cof: number;
x1mth2: number;
x7thm1: number;
mdot: number;
nodedot: number;
xlcof: number;
xmcof: number;
nodecf: number;
irez: number;
d2201: number;
d2211: number;
d3210: number;
d3222: number;
d4410: number;
d4422: number;
d5220: number;
d5232: number;
d5421: number;
d5433: number;
dedt: number;
del1: number;
del2: number;
del3: number;
didt: number;
dmdt: number;
dnodt: number;
domdt: number;
e3: number;
ee2: number;
peo: number;
pgho: number;
pho: number;
pinco: number;
plo: number;
se2: number;
se3: number;
sgh2: number;
sgh3: number;
sgh4: number;
sh2: number;
sh3: number;
si2: number;
si3: number;
sl2: number;
sl3: number;
sl4: number;
gsto: number;
xfact: number;
xgh2: number;
xgh3: number;
xgh4: number;
xh2: number;
xh3: number;
xi2: number;
xi3: number;
xl2: number;
xl3: number;
xl4: number;
xlamo: number;
zmol: number;
zmos: number;
atime: number;
xli: number;
xni: number;
a: number;
altp: number;
alta: number;
/**
* Fractional days into the year of the epoch moment in UTC.
*/
epochdays: number;
/**
* Julian date of the epoch (computed from epochyr and epochdays).
*/
jdsatepoch: number;
/**
* Second time derivative of the mean motion (ignored by SGP4).
*/
nddot: number;
/**
* First time derivative of the mean motion (ignored by SGP4).
*/
ndot: number;
/**
* Ballistic drag coefficient B* in inverse earth radii.
*/
bstar: number;
/**
* Inclination in radians.
*/
inclo: number;
/**
* Right ascension of ascending node in radians.
*/
nodeo: number;
/**
* Eccentricity.
*/
ecco: number;
/**
* Argument of perigee in radians.
*/
argpo: number;
/**
* Mean anomaly in radians.
*/
mo: number;
/**
* Mean motion in radians per minute.
*/
no: number;
}
export type SatRecInit = Pick<SatRec, "error" | "satnum" | "epochyr" | "epochdays" | "ndot" | "nddot" | "bstar" | "inclo" | "nodeo" | "ecco" | "argpo" | "mo" | "no" | "jdsatepoch">;
+18
View File
@@ -0,0 +1,18 @@
import { SatRec } from './SatRec.js';
interface DpperOptions {
init: 'y' | 'n';
opsmode: 'a' | 'i';
ep: number;
inclp: number;
nodep: number;
argpp: number;
mp: number;
}
export default function dpper(satrec: SatRec, options: DpperOptions): {
ep: number;
inclp: number;
nodep: number;
argpp: number;
mp: number;
};
export {};
+93
View File
@@ -0,0 +1,93 @@
interface DscomOptions {
epoch: number;
ep: number;
argpp: number;
tc: number;
inclp: number;
nodep: number;
np: number;
}
export default function dscom(options: DscomOptions): {
snodm: number;
cnodm: number;
sinim: number;
cosim: number;
sinomm: number;
cosomm: number;
day: number;
e3: number;
ee2: number;
em: number;
emsq: number;
gam: number;
peo: number;
pgho: number;
pho: number;
pinco: number;
plo: number;
rtemsq: number;
se2: number;
se3: number;
sgh2: number;
sgh3: number;
sgh4: number;
sh2: number;
sh3: number;
si2: number;
si3: number;
sl2: number;
sl3: number;
sl4: number;
s1: number | undefined;
s2: number | undefined;
s3: number | undefined;
s4: number | undefined;
s5: number | undefined;
s6: number | undefined;
s7: number | undefined;
ss1: number | undefined;
ss2: number | undefined;
ss3: number | undefined;
ss4: number | undefined;
ss5: number | undefined;
ss6: number | undefined;
ss7: number | undefined;
sz1: number | undefined;
sz2: number | undefined;
sz3: number | undefined;
sz11: number | undefined;
sz12: number | undefined;
sz13: number | undefined;
sz21: number | undefined;
sz22: number | undefined;
sz23: number | undefined;
sz31: number | undefined;
sz32: number | undefined;
sz33: number | undefined;
xgh2: number;
xgh3: number;
xgh4: number;
xh2: number;
xh3: number;
xi2: number;
xi3: number;
xl2: number;
xl3: number;
xl4: number;
nm: number;
z1: number | undefined;
z2: number | undefined;
z3: number | undefined;
z11: number | undefined;
z12: number | undefined;
z13: number | undefined;
z21: number | undefined;
z22: number | undefined;
z23: number | undefined;
z31: number | undefined;
z32: number | undefined;
z33: number | undefined;
zmol: number;
zmos: number;
};
export {};
+107
View File
@@ -0,0 +1,107 @@
interface DsinitOptions {
cosim: number;
emsq: number;
argpo: number;
s1: number;
s2: number;
s3: number;
s4: number;
s5: number;
sinim: number;
ss1: number;
ss2: number;
ss3: number;
ss4: number;
ss5: number;
sz1: number;
sz3: number;
sz11: number;
sz13: number;
sz21: number;
sz23: number;
sz31: number;
sz33: number;
t: number;
tc: number;
gsto: number;
mo: number;
mdot: number;
no: number;
nodeo: number;
nodedot: number;
xpidot: number;
z1: number;
z3: number;
z11: number;
z13: number;
z21: number;
z23: number;
z31: number;
z33: number;
ecco: number;
eccsq: number;
em: number;
argpm: number;
inclm: number;
mm: number;
nm: number;
nodem: number;
irez: number;
atime: number;
d2201: number;
d2211: number;
d3210: number;
d3222: number;
d4410: number;
d4422: number;
d5220: number;
d5232: number;
d5421: number;
d5433: number;
dedt: number;
didt: number;
dmdt: number;
dnodt: number;
domdt: number;
del1: number;
del2: number;
del3: number;
xfact: number;
xlamo: number;
xli: number;
xni: number;
}
export default function dsinit(options: DsinitOptions): {
em: number;
argpm: number;
inclm: number;
mm: number;
nm: number;
nodem: number;
irez: number;
atime: number;
d2201: number;
d2211: number;
d3210: number;
d3222: number;
d4410: number;
d4422: number;
d5220: number;
d5232: number;
d5421: number;
d5433: number;
dedt: number;
didt: number;
dmdt: number;
dndt: number;
dnodt: number;
domdt: number;
del1: number;
del2: number;
del3: number;
xfact: number;
xlamo: number;
xli: number;
xni: number;
};
export {};
+51
View File
@@ -0,0 +1,51 @@
interface DspaceOptions {
irez: number;
d2201: number;
d2211: number;
d3210: number;
d3222: number;
d4410: number;
d4422: number;
d5220: number;
d5232: number;
d5421: number;
d5433: number;
dedt: number;
del1: number;
del2: number;
del3: number;
didt: number;
dmdt: number;
dnodt: number;
domdt: number;
argpo: number;
argpdot: number;
t: number;
tc: number;
gsto: number;
xfact: number;
xlamo: number;
no: number;
atime: number;
em: number;
argpm: number;
inclm: number;
xli: number;
mm: number;
xni: number;
nodem: number;
nm: number;
}
export default function dspace(options: DspaceOptions): {
atime: number;
em: number;
argpm: number;
inclm: number;
xli: number;
mm: number;
xni: number;
nodem: number;
dndt: number;
nm: number;
};
export {};
+5
View File
@@ -0,0 +1,5 @@
import { GMSTime } from '../common-types.js';
declare function gstime(jd: number): GMSTime;
declare function gstime(date: Date): GMSTime;
declare function gstime(year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond?: number): GMSTime;
export default gstime;
+25
View File
@@ -0,0 +1,25 @@
interface InitlOptions {
opsmode: 'a' | 'i';
ecco: number;
epoch: number;
inclo: number;
no: number;
}
export default function initl(options: InitlOptions): {
no: number;
method: string;
ainv: number;
ao: number;
con41: number;
con42: number;
cosio: number;
cosio2: number;
eccsq: number;
omeosq: number;
posq: number;
rp: number;
rteosq: number;
sinio: number;
gsto: number;
};
export {};
+5
View File
@@ -0,0 +1,5 @@
import { PositionAndVelocity } from '../common-types.js';
import { SatRec } from './SatRec.js';
export declare function propagate(satrec: SatRec, date: Date): PositionAndVelocity;
export declare function propagate(satrec: SatRec, year: number, month: number, day: number, hour: number, minute: number, second: number, ms?: number): PositionAndVelocity;
export default function propagate(satrec: SatRec, ...jdayArgs: [Date] | [number, number, number, number, number, number, (number | undefined)?]): PositionAndVelocity | null;
+3
View File
@@ -0,0 +1,3 @@
import { PositionAndVelocity } from '../common-types.js';
import { SatRec } from './SatRec.js';
export default function sgp4(satrec: SatRec, tsince: number): PositionAndVelocity | null;
+14
View File
@@ -0,0 +1,14 @@
import { SatRec, SatRecInit } from './SatRec.js';
export interface Sgp4InitOptions {
opsmode: 'a' | 'i';
satn: string;
epoch: number;
xbstar: number;
xecco: number;
xargpo: number;
xinclo: number;
xmo: number;
xno: number;
xnodeo: number;
}
export default function sgp4init(satrecInit: SatRecInit, options: Sgp4InitOptions): asserts satrecInit is SatRec;
+6
View File
@@ -0,0 +1,6 @@
import { JDay } from './ext.js';
export declare function sunPos(jday: JDay): {
rsun: number[];
rtasc: number;
decl: number;
};
+12
View File
@@ -0,0 +1,12 @@
import { Degrees, EcfVec3, EciVec3, GeodeticLocation, GMSTime, Kilometer, LookAngles, Radians } from './common-types.js';
export declare function radiansToDegrees(radians: Radians): Degrees;
export declare function degreesToRadians(degrees: Degrees): Radians;
export declare function degreesLat(radians: Radians): Degrees;
export declare function degreesLong(radians: Radians): Degrees;
export declare function radiansLat(degrees: Degrees): Radians;
export declare function radiansLong(degrees: Degrees): Radians;
export declare function geodeticToEcf({ longitude, latitude, height, }: GeodeticLocation): EcfVec3<Kilometer>;
export declare function eciToGeodetic(eci: EciVec3<Kilometer>, gmst: GMSTime): GeodeticLocation;
export declare function ecfToEci(ecf: EcfVec3<number>, gmst: GMSTime): EciVec3<number>;
export declare function eciToEcf(eci: EciVec3<number>, gmst: GMSTime): EcfVec3<number>;
export declare function ecfToLookAngles(observerGeodetic: GeodeticLocation, satelliteEcf: EcfVec3<Kilometer>): LookAngles;