ootk 1.0.7 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/{asc → .asc}/asconfig.json +0 -0
  2. package/{asc → .asc}/assembly/index.ts +0 -0
  3. package/{asc → .asc}/ex/asconfig.json +0 -0
  4. package/{asc → .asc}/ex/assembly/index.ts +0 -0
  5. package/{asc → .asc}/ex/index.html +0 -0
  6. package/{asc → .asc}/ex/package.json +0 -0
  7. package/{asc → .asc}/ex/tests/index.js +0 -0
  8. package/{asc → .asc}/package.json +0 -0
  9. package/{asc → .asc}/tests/index.js +0 -0
  10. package/.eslintrc.json +244 -0
  11. package/CHANGELOG.md +21 -1
  12. package/LICENSE.MD +299 -21
  13. package/README.md +17 -22
  14. package/dist/ootk.d.ts +16 -20
  15. package/dist/ootk.js +2 -1
  16. package/dist/ootk.js.LICENSE.txt +77 -0
  17. package/lib/objects/base-object.d.ts +40 -0
  18. package/lib/objects/base-object.js +109 -0
  19. package/lib/objects/base-object.js.map +1 -0
  20. package/lib/objects/detailed-sat.d.ts +66 -0
  21. package/lib/objects/detailed-sat.js +149 -0
  22. package/lib/objects/detailed-sat.js.map +1 -0
  23. package/lib/objects/index.d.ts +4 -0
  24. package/lib/objects/index.js +5 -0
  25. package/lib/objects/index.js.map +1 -0
  26. package/lib/objects/sat.d.ts +88 -0
  27. package/lib/objects/sat.js +141 -0
  28. package/lib/objects/sat.js.map +1 -0
  29. package/lib/objects/sensor.d.ts +40 -0
  30. package/lib/objects/sensor.js +88 -0
  31. package/lib/objects/sensor.js.map +1 -0
  32. package/lib/objects/space-object.d.ts +38 -0
  33. package/lib/objects/space-object.js +60 -0
  34. package/lib/objects/space-object.js.map +1 -0
  35. package/lib/objects/star.d.ts +46 -0
  36. package/lib/objects/star.js +91 -0
  37. package/lib/objects/star.js.map +1 -0
  38. package/lib/ootk.d.ts +16 -20
  39. package/lib/ootk.js +16 -20
  40. package/lib/ootk.js.map +1 -1
  41. package/{dist → lib/sgp4}/sgp4.d.ts +14 -21
  42. package/lib/{sgp4.js → sgp4/sgp4.js} +1064 -898
  43. package/lib/sgp4/sgp4.js.map +1 -0
  44. package/lib/tle/tle-format-data.d.ts +6 -0
  45. package/lib/tle/tle-format-data.js +10 -0
  46. package/lib/tle/tle-format-data.js.map +1 -0
  47. package/lib/tle/tle.d.ts +374 -0
  48. package/lib/tle/tle.js +611 -0
  49. package/lib/tle/tle.js.map +1 -0
  50. package/{dist → lib/transforms}/transforms.d.ts +14 -17
  51. package/lib/{transforms.js → transforms/transforms.js} +44 -40
  52. package/lib/transforms/transforms.js.map +1 -0
  53. package/lib/{utils → types}/types.d.ts +111 -3
  54. package/lib/types/types.js +34 -0
  55. package/lib/types/types.js.map +1 -0
  56. package/lib/utils/constants.d.ts +19 -15
  57. package/lib/utils/constants.js +20 -16
  58. package/lib/utils/constants.js.map +1 -1
  59. package/lib/utils/moon-math.d.ts +104 -0
  60. package/lib/utils/moon-math.js +387 -0
  61. package/lib/utils/moon-math.js.map +1 -0
  62. package/lib/utils/sun-math.d.ts +230 -0
  63. package/lib/utils/sun-math.js +421 -0
  64. package/lib/utils/sun-math.js.map +1 -0
  65. package/lib/utils/utils.d.ts +36 -0
  66. package/lib/utils/utils.js +81 -0
  67. package/lib/utils/utils.js.map +1 -0
  68. package/package.json +4 -3
  69. package/dist/utils.d.ts +0 -33
  70. package/lib/sgp4.d.ts +0 -89
  71. package/lib/sgp4.js.map +0 -1
  72. package/lib/transforms.d.ts +0 -58
  73. package/lib/transforms.js.map +0 -1
  74. package/lib/utils/types.js +0 -2
  75. package/lib/utils/types.js.map +0 -1
  76. package/lib/utils.d.ts +0 -33
  77. package/lib/utils.js +0 -60
  78. package/lib/utils.js.map +0 -1
@@ -0,0 +1,387 @@
1
+ /**
2
+ * @author Theodore Kruczek.
3
+ * @description Orbital Object ToolKit (OOTK) is a collection of tools for working
4
+ * with satellites and other orbital objects.
5
+ *
6
+ * @file MoonMath is a an extension to SunMath for calculating the position of the moon
7
+ * and its phases. This was originally created by Vladimir Agafonkin. Robert Gester's
8
+ * update was referenced for documentation. There were a couple of bugs in both versions
9
+ * so there will be some differences if you are migrating from either to this library.
10
+ *
11
+ *
12
+ * @license AGPL-3.0-or-later
13
+ * @Copyright (c) 2020-2022 Theodore Kruczek
14
+ *
15
+ * @Copyright (c) 2011-2015, Vladimir Agafonkin
16
+ * SunCalc is a JavaScript library for calculating sun/moon position and light phases.
17
+ * https://github.com/mourner/suncalc
18
+ *
19
+ * Reworked and enhanced by Robert Gester
20
+ * @Copyright (c) 2022 Robert Gester
21
+ * https://github.com/hypnos3/suncalc3
22
+ *
23
+ * moon calculations, based on http://aa.quae.nl/en/reken/hemelpositie.html formulas
24
+ *
25
+ * Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
26
+ * terms of the GNU Affero General Public License as published by the Free Software
27
+ * Foundation, either version 3 of the License, or (at your option) any later version.
28
+ *
29
+ * Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
30
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
31
+ * See the GNU Affero General Public License for more details.
32
+ *
33
+ * You should have received a copy of the GNU Affero General Public License along with
34
+ * Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
35
+ */
36
+ import { DEG2RAD } from './constants';
37
+ import { MS_PER_DAY } from '../utils/constants';
38
+ import { SunMath } from './sun-math';
39
+ var MoonMath = /** @class */ (function () {
40
+ function MoonMath() {
41
+ }
42
+ MoonMath.moonCoords = function (d) {
43
+ // geocentric ecliptic coordinates of the moon
44
+ var L = DEG2RAD * (218.316 + 13.176396 * d); // ecliptic longitude
45
+ var M = DEG2RAD * (134.963 + 13.064993 * d); // mean anomaly
46
+ var F = DEG2RAD * (93.272 + 13.22935 * d); // mean distance
47
+ var l = L + DEG2RAD * 6.289 * Math.sin(M); // longitude
48
+ var b = DEG2RAD * 5.128 * Math.sin(F); // latitude
49
+ var dt = 385001 - 20905 * Math.cos(M); // distance to the moon in km
50
+ return {
51
+ ra: SunMath.rightAscension(l, b),
52
+ dec: SunMath.declination(l, b),
53
+ dist: dt,
54
+ };
55
+ };
56
+ MoonMath.hoursLater = function (date, h) {
57
+ return new Date(date.getTime() + (h * MS_PER_DAY) / 24);
58
+ };
59
+ MoonMath.getMoonPosition = function (date, lat, lon) {
60
+ var lw = DEG2RAD * -lon;
61
+ var phi = DEG2RAD * lat;
62
+ var d = SunMath.date2jSince2000(date);
63
+ var c = MoonMath.moonCoords(d);
64
+ var H = SunMath.siderealTime(d, lw) - c.ra;
65
+ var h = SunMath.elevation(H, phi, c.dec);
66
+ // formula 14.1 of "Astronomical Algorithms" 2nd edition by Jean Meeus (Willmann-Bell, Richmond) 1998.
67
+ var pa = Math.atan2(Math.sin(H), Math.tan(phi) * Math.cos(c.dec) - Math.sin(c.dec) * Math.cos(H));
68
+ h += SunMath.astroRefraction(h); // altitude correction for refraction
69
+ return {
70
+ az: SunMath.azimuth(H, phi, c.dec),
71
+ el: h,
72
+ rng: c.dist,
73
+ parallacticAngle: pa,
74
+ };
75
+ };
76
+ /**
77
+ * calculations for illumination parameters of the moon,
78
+ * based on http://idlastro.gsfc.nasa.gov/ftp/pro/astro/mphase.pro formulas and
79
+ * Chapter 48 of "Astronomical Algorithms" 2nd edition by Jean Meeus (Willmann-Bell, Richmond) 1998.
80
+ * @param {number | Date} date Date object or timestamp for calculating moon-illumination
81
+ * @return {MoonIlluminationData} result object of moon-illumination
82
+ */
83
+ // eslint-disable-next-line max-statements
84
+ MoonMath.getMoonIllumination = function (date) {
85
+ var dateValue = date instanceof Date ? date.getTime() : date;
86
+ var lunarDaysMs = 2551442778; // The duration in days of a lunar cycle is 29.53058770576 days.
87
+ var firstNewMoon2000 = 947178840000; // first newMoon in the year 2000 2000-01-06 18:14
88
+ var d = SunMath.date2jSince2000(new Date(dateValue));
89
+ var s = SunMath.getSunRaDec(d);
90
+ var m = MoonMath.moonCoords(d);
91
+ var sdist = 149598000; // distance from Earth to Sun in km
92
+ var phi = Math.acos(Math.sin(s.dec) * Math.sin(m.dec) + Math.cos(s.dec) * Math.cos(m.dec) * Math.cos(s.ra - m.ra));
93
+ var inc = Math.atan2(sdist * Math.sin(phi), m.dist - sdist * Math.cos(phi));
94
+ var angle = Math.atan2(Math.cos(s.dec) * Math.sin(s.ra - m.ra), Math.sin(s.dec) * Math.cos(m.dec) - Math.cos(s.dec) * Math.sin(m.dec) * Math.cos(s.ra - m.ra));
95
+ var phaseValue = 0.5 + (0.5 * inc * (angle < 0 ? -1 : 1)) / Math.PI;
96
+ // calculates the difference in ms between the sirst fullMoon 2000 and given Date
97
+ var diffBase = dateValue - firstNewMoon2000;
98
+ // Calculate modulus to drop completed cycles
99
+ var cycleModMs = diffBase % lunarDaysMs;
100
+ // If negative number (date before new moon 2000) add lunarDaysMs
101
+ if (cycleModMs < 0) {
102
+ cycleModMs += lunarDaysMs;
103
+ }
104
+ var nextNewMoon = lunarDaysMs - cycleModMs + dateValue;
105
+ var nextFullMoon = lunarDaysMs / 2 - cycleModMs + dateValue;
106
+ if (nextFullMoon < dateValue) {
107
+ nextFullMoon += lunarDaysMs;
108
+ }
109
+ var quater = lunarDaysMs / 4;
110
+ var nextFirstQuarter = quater - cycleModMs + dateValue;
111
+ if (nextFirstQuarter < dateValue) {
112
+ nextFirstQuarter += lunarDaysMs;
113
+ }
114
+ var nextThirdQuarter = lunarDaysMs - quater - cycleModMs + dateValue;
115
+ if (nextThirdQuarter < dateValue) {
116
+ nextThirdQuarter += lunarDaysMs;
117
+ }
118
+ /*
119
+ * Calculate the fraction of the moon cycle
120
+ * const currentfrac = cycleModMs / lunarDaysMs;
121
+ */
122
+ var next = Math.min(nextNewMoon, nextFirstQuarter, nextFullMoon, nextThirdQuarter);
123
+ // eslint-disable-next-line init-declarations
124
+ var phase;
125
+ for (var index = 0; index < MoonMath.moonCycles.length; index++) {
126
+ var element = MoonMath.moonCycles[index];
127
+ if (phaseValue >= element.from && phaseValue <= element.to) {
128
+ phase = element;
129
+ break;
130
+ }
131
+ }
132
+ var type = '';
133
+ if (next === nextNewMoon) {
134
+ type = 'newMoon';
135
+ }
136
+ else if (next === nextFirstQuarter) {
137
+ type = 'firstQuarter';
138
+ }
139
+ else if (next === nextFullMoon) {
140
+ type = 'fullMoon';
141
+ }
142
+ else {
143
+ type = 'thirdQuarter';
144
+ }
145
+ return {
146
+ fraction: (1 + Math.cos(inc)) / 2,
147
+ phase: phase,
148
+ phaseValue: phaseValue,
149
+ angle: angle,
150
+ next: {
151
+ value: next,
152
+ date: new Date(next).toISOString(),
153
+ type: type,
154
+ newMoon: {
155
+ value: nextNewMoon,
156
+ date: new Date(nextNewMoon).toISOString(),
157
+ },
158
+ fullMoon: {
159
+ value: nextFullMoon,
160
+ date: new Date(nextFullMoon).toISOString(),
161
+ },
162
+ firstQuarter: {
163
+ value: nextFirstQuarter,
164
+ date: new Date(nextFirstQuarter).toISOString(),
165
+ },
166
+ thirdQuarter: {
167
+ value: nextThirdQuarter,
168
+ date: new Date(nextThirdQuarter).toISOString(),
169
+ },
170
+ },
171
+ };
172
+ };
173
+ /**
174
+ * calculations for moon rise/set times are based on http://www.stargazing.net/kepler/moonrise.html article
175
+ * @param {number|Date} dateValue Date object or timestamp for calculating moon-times
176
+ * @param {number} lat latitude for calculating moon-times
177
+ * @param {number} lon longitude for calculating moon-times
178
+ * @param {boolean} [isUtc] defines if the calculation should be in utc or local time (default is local)
179
+ * @return {IMoonTimes} result object of sunTime
180
+ */
181
+ MoonMath.getMoonTimes = function (dateValue, lat, lon, isUtc) {
182
+ if (isUtc === void 0) { isUtc = false; }
183
+ var t = new Date(dateValue);
184
+ if (isUtc) {
185
+ t.setUTCHours(0, 0, 0, 0);
186
+ }
187
+ else {
188
+ t.setHours(0, 0, 0, 0);
189
+ }
190
+ var _a = MoonMath.calculateRiseSetTimes(t, lat, lon), rise = _a.rise, set = _a.set, ye = _a.ye;
191
+ var result = {
192
+ rise: null,
193
+ set: null,
194
+ ye: null,
195
+ alwaysUp: null,
196
+ alwaysDown: null,
197
+ highest: null,
198
+ };
199
+ if (rise) {
200
+ result.rise = new Date(MoonMath.hoursLater(dateValue, rise));
201
+ }
202
+ else {
203
+ result.rise = NaN;
204
+ }
205
+ if (set) {
206
+ result.set = new Date(MoonMath.hoursLater(dateValue, set));
207
+ }
208
+ else {
209
+ result.set = NaN;
210
+ }
211
+ if (!rise && !set) {
212
+ if (ye > 0) {
213
+ result.alwaysUp = true;
214
+ result.alwaysDown = false;
215
+ }
216
+ else {
217
+ result.alwaysUp = false;
218
+ result.alwaysDown = true;
219
+ }
220
+ }
221
+ else if (rise && set) {
222
+ result.alwaysUp = false;
223
+ result.alwaysDown = false;
224
+ result.highest = new Date(MoonMath.hoursLater(dateValue, Math.min(rise, set) + Math.abs(set - rise) / 2));
225
+ }
226
+ else {
227
+ result.alwaysUp = false;
228
+ result.alwaysDown = false;
229
+ }
230
+ return result;
231
+ };
232
+ // eslint-disable-next-line max-statements
233
+ MoonMath.calculateRiseSetTimes = function (t, lat, lon) {
234
+ var hc = 0.133 * DEG2RAD;
235
+ var h0 = MoonMath.getMoonPosition(t, lat, lon).el - hc;
236
+ var h1 = 0;
237
+ var h2 = 0;
238
+ var rise = 0;
239
+ var set = 0;
240
+ var a = 0;
241
+ var b = 0;
242
+ var xe = 0;
243
+ var ye = 0;
244
+ var d = 0;
245
+ var roots = 0;
246
+ var x1 = 0;
247
+ var x2 = 0;
248
+ var dx = 0;
249
+ // go in 2-hour chunks, each time seeing if a 3-point quadratic curve crosses zero (which means rise or set)
250
+ for (var i = 1; i <= 24; i += 2) {
251
+ h1 = MoonMath.getMoonPosition(MoonMath.hoursLater(t, i), lat, lon).el - hc;
252
+ h2 = MoonMath.getMoonPosition(MoonMath.hoursLater(t, i + 1), lat, lon).el - hc;
253
+ a = (h0 + h2) / 2 - h1;
254
+ b = (h2 - h0) / 2;
255
+ xe = -b / (2 * a);
256
+ ye = (a * xe + b) * xe + h1;
257
+ d = b * b - 4 * a * h1;
258
+ roots = 0;
259
+ if (d >= 0) {
260
+ dx = Math.sqrt(d) / (Math.abs(a) * 2);
261
+ x1 = xe - dx;
262
+ x2 = xe + dx;
263
+ if (Math.abs(x1) <= 1) {
264
+ roots++;
265
+ }
266
+ if (Math.abs(x2) <= 1) {
267
+ roots++;
268
+ }
269
+ if (x1 < -1) {
270
+ x1 = x2;
271
+ }
272
+ }
273
+ if (roots === 1) {
274
+ if (h0 < 0) {
275
+ rise = i + x1;
276
+ }
277
+ else {
278
+ set = i + x1;
279
+ }
280
+ }
281
+ else if (roots === 2) {
282
+ rise = i + (ye < 0 ? x2 : x1);
283
+ set = i + (ye < 0 ? x1 : x2);
284
+ }
285
+ if (rise && set) {
286
+ break;
287
+ }
288
+ h0 = h2;
289
+ }
290
+ return { rise: rise, set: set, ye: ye };
291
+ };
292
+ MoonMath.moonCycles = [
293
+ {
294
+ from: 0,
295
+ to: 0.033863193308711,
296
+ id: 'newMoon',
297
+ emoji: '🌚',
298
+ code: ':new_moon_with_face:',
299
+ name: 'New Moon',
300
+ weight: 1,
301
+ css: 'wi-moon-new',
302
+ },
303
+ {
304
+ from: 0.033863193308711,
305
+ to: 0.216136806691289,
306
+ id: 'waxingCrescentMoon',
307
+ emoji: '🌒',
308
+ code: ':waxing_crescent_moon:',
309
+ name: 'Waxing Crescent',
310
+ weight: 6.3825,
311
+ css: 'wi-moon-wax-cres',
312
+ },
313
+ {
314
+ from: 0.216136806691289,
315
+ to: 0.283863193308711,
316
+ id: 'firstQuarterMoon',
317
+ emoji: '🌓',
318
+ code: ':first_quarter_moon:',
319
+ name: 'First Quarter',
320
+ weight: 1,
321
+ css: 'wi-moon-first-quart',
322
+ },
323
+ {
324
+ from: 0.283863193308711,
325
+ to: 0.466136806691289,
326
+ id: 'waxingGibbousMoon',
327
+ emoji: '🌔',
328
+ code: ':waxing_gibbous_moon:',
329
+ name: 'Waxing Gibbous',
330
+ weight: 6.3825,
331
+ css: 'wi-moon-wax-gibb',
332
+ },
333
+ {
334
+ from: 0.466136806691289,
335
+ to: 0.533863193308711,
336
+ id: 'fullMoon',
337
+ emoji: '🌝',
338
+ code: ':full_moon_with_face:',
339
+ name: 'Full Moon',
340
+ weight: 1,
341
+ css: 'wi-moon-full',
342
+ },
343
+ {
344
+ from: 0.533863193308711,
345
+ to: 0.716136806691289,
346
+ id: 'waningGibbousMoon',
347
+ emoji: '🌖',
348
+ code: ':waning_gibbous_moon:',
349
+ name: 'Waning Gibbous',
350
+ weight: 6.3825,
351
+ css: 'wi-moon-wan-gibb',
352
+ },
353
+ {
354
+ from: 0.716136806691289,
355
+ to: 0.783863193308711,
356
+ id: 'thirdQuarterMoon',
357
+ emoji: '🌗',
358
+ code: ':last_quarter_moon:',
359
+ name: 'third Quarter',
360
+ weight: 1,
361
+ css: 'wi-moon-third-quart',
362
+ },
363
+ {
364
+ from: 0.783863193308711,
365
+ to: 0.966136806691289,
366
+ id: 'waningCrescentMoon',
367
+ emoji: '🌘',
368
+ code: ':waning_crescent_moon:',
369
+ name: 'Waning Crescent',
370
+ weight: 6.3825,
371
+ css: 'wi-moon-wan-cres',
372
+ },
373
+ {
374
+ from: 0.966136806691289,
375
+ to: 1,
376
+ id: 'newMoon',
377
+ emoji: '🌚',
378
+ code: ':new_moon_with_face:',
379
+ name: 'New Moon',
380
+ weight: 1,
381
+ css: 'wi-moon-new',
382
+ },
383
+ ];
384
+ return MoonMath;
385
+ }());
386
+ export { MoonMath };
387
+ //# sourceMappingURL=moon-math.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moon-math.js","sourceRoot":"","sources":["../../src/utils/moon-math.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,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qB;SAC3B;QACD;YACE,IAAI,EAAE,iBAAiB;YACvB,EAAE,EAAE,iBAAiB;YACrB,EAAE,EAAE,oBAAoB;YACxB,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,wBAAwB;YAC9B,IAAI,EAAE,iBAAiB;YACvB,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,kBAAkB;SACxB;QACD;YACE,IAAI,EAAE,iBAAiB;YACvB,EAAE,EAAE,CAAC;YACL,EAAE,EAAE,SAAS;YACb,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,sBAAsB;YAC5B,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,CAAC;YACT,GAAG,EAAE,aAAa;SACnB;KACF,CAAC;IA8OJ,eAAC;CAAA,AAnXD,IAmXC;SAnXY,QAAQ"}
@@ -0,0 +1,230 @@
1
+ /**
2
+ * @author Theodore Kruczek.
3
+ * @description Orbital Object ToolKit (OOTK) is a collection of tools for working
4
+ * with satellites and other orbital objects.
5
+ *
6
+ * @file SunMath is a collection of functions for calculating the position of the sun
7
+ * and other stars. This was originally created by Vladimir Agafonkin. Robert Gester's
8
+ * update was referenced for documentation. There were a couple of bugs in both versions
9
+ * so there will be some differences if you are migrating from either to this library.
10
+ *
11
+ *
12
+ * @license AGPL-3.0-or-later
13
+ * @Copyright (c) 2020-2022 Theodore Kruczek
14
+ *
15
+ * @Copyright (c) 2011-2015, Vladimir Agafonkin
16
+ * SunCalc is a JavaScript library for calculating sun/moon position and light phases.
17
+ * https://github.com/mourner/suncalc
18
+ *
19
+ * Reworked and enhanced by Robert Gester
20
+ * @Copyright (c) 2022 Robert Gester
21
+ * https://github.com/hypnos3/suncalc3
22
+ *
23
+ * sun calculations are based on http://aa.quae.nl/en/reken/zonpositie.html formulas
24
+ *
25
+ * Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
26
+ * terms of the GNU Affero General Public License as published by the Free Software
27
+ * Foundation, either version 3 of the License, or (at your option) any later version.
28
+ *
29
+ * Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
30
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
31
+ * See the GNU Affero General Public License for more details.
32
+ *
33
+ * You should have received a copy of the GNU Affero General Public License along with
34
+ * Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
35
+ */
36
+ import { AzEl, Meters, SunTime } from '../types/types';
37
+ import { Degrees, Radians } from '../ootk';
38
+ export declare class SunMath {
39
+ private static readonly J1970;
40
+ private static readonly J2000;
41
+ private static readonly J0;
42
+ private static readonly e;
43
+ private static times;
44
+ private static julianCycle;
45
+ /**
46
+ * calculates the obderver angle
47
+ * @param {number} alt the observer altitude (in meters) relative to the horizon
48
+ * @returns {number} height for further calculations
49
+ */
50
+ private static observerAngle;
51
+ /**
52
+ * get solar mean anomaly
53
+ * @param {number} d - julian day
54
+ * @returns {number} solar mean anomaly
55
+ */
56
+ private static solarMeanAnomaly;
57
+ /**
58
+ * convert Julian calendar to date object
59
+ * @param {number} julian day number in Julian calendar to convert
60
+ * @return {number} result date as timestamp
61
+ */
62
+ static julian2date(julian: number): Date;
63
+ /**
64
+ * get number of days for a dateValue since 2000
65
+ *
66
+ * See: https://en.wikipedia.org/wiki/Epoch_(astronomy)
67
+ *
68
+ * @param {number} date date as timestamp to get days
69
+ * @return {number} count of days
70
+ */
71
+ static date2jSince2000(date: Date): number;
72
+ /**
73
+ * get right ascension
74
+ * @param {number} l - ecliptic longitude
75
+ * @param {number} b - ecliptic latitude
76
+ * @returns {number} right ascension
77
+ */
78
+ static rightAscension(l: number, b: number): Radians;
79
+ /**
80
+ * get declination
81
+ * @param {number} l - ecliptic longitude
82
+ * @param {number} b - ecliptic latitude
83
+ * @returns {number} declination
84
+ */
85
+ static declination(l: number, b: number): Radians;
86
+ /**
87
+ * get azimuth
88
+ * @param {number} H - siderealTime
89
+ * @param {Radians} phi - latitude
90
+ * @param {Radians} dec - The declination of the sun
91
+ * @returns {Radians} azimuth in rad
92
+ */
93
+ static azimuth(H: number, phi: Radians, dec: Radians): Radians;
94
+ /**
95
+ * get elevation (sometimes called altitude)
96
+ * @param {number} H - siderealTime
97
+ * @param {Radians} phi - latitude
98
+ * @param {Radians} dec - The declination of the sun
99
+ * @returns {Radians} elevation
100
+ */
101
+ static elevation(H: number, phi: Radians, dec: Radians): Radians;
102
+ /**
103
+ * side real time
104
+ * @param {number} d - julian day
105
+ * @param {Radians} lw - longitude of the observer
106
+ * @returns {number} sidereal time
107
+ */
108
+ static siderealTime(d: number, lw: Radians): number;
109
+ /**
110
+ * get astro refraction
111
+ * @param {Radians} h - elevation
112
+ * @returns {number} refraction
113
+ */
114
+ static astroRefraction(h: Degrees): Radians;
115
+ /**
116
+ * ecliptic longitude
117
+ * @param {number} M - solar mean anomaly
118
+ * @returns {number} ecliptic longitude
119
+ */
120
+ static eclipticLongitude(M: number): number;
121
+ /**
122
+ * ecliptic latitude
123
+ * @param {number} B - ?
124
+ * @returns {number} ecliptic latitude
125
+ */
126
+ static eclipticLatitude(B: number): number;
127
+ /**
128
+ * Julian cycle
129
+ * @param {number} d - number of days
130
+ * @param {number} lw - rad * -lng;
131
+ * @returns {number} julian cycle
132
+ */
133
+ static julianCyle(d: number, lw: number): number;
134
+ /**
135
+ * approx transit
136
+ * @param {number} Ht - hourAngle
137
+ * @param {number} lw - rad * -lng
138
+ * @param {number} n - Julian cycle
139
+ * @returns {number} approx transit
140
+ */
141
+ static approxTransit(Ht: number, lw: number, n: number): number;
142
+ /**
143
+ * solar transit in Julian
144
+ * @param {number} ds - approxTransit
145
+ * @param {number} M - solar mean anomal
146
+ * @param {number} L - ecliptic longitude
147
+ * @returns {number} solar transit in Julian
148
+ */
149
+ static solarTransitJulian(ds: number, M: number, L: number): number;
150
+ /**
151
+ * hour angle
152
+ * @param {number} h - heigh at 0
153
+ * @param {number} phi - rad * lat;
154
+ * @param {number} dec - declination
155
+ * @returns {number} hour angle
156
+ */
157
+ static hourAngle(h: number, phi: number, dec: number): number;
158
+ /**
159
+ * returns set time for the given sun altitude
160
+ * @param {number} h - heigh at 0
161
+ * @param {number} lw - rad * -lng
162
+ * @param {number} phi - rad * lat;
163
+ * @param {number} dec - declination
164
+ * @param {number} n - Julian cycle
165
+ * @param {number} M - solar mean anomal
166
+ * @param {number} L - ecliptic longitude
167
+ * @returns {number} set time
168
+ */
169
+ static getSetJulian(h: number, lw: number, phi: number, dec: number, n: number, M: number, L: number): number;
170
+ /**
171
+ * returns set time for the given sun altitude
172
+ * @param {Meters} alt - altitude at 0
173
+ * @param {Radians} lw - -lng
174
+ * @param {Radians} phi - lat;
175
+ * @param {Radians} dec - declination
176
+ * @param {number} n - Julian cycle
177
+ * @param {number} M - solar mean anomal
178
+ * @param {number} L - ecliptic longitude
179
+ * @return {J2000Value} sunset time in days since 2000
180
+ */
181
+ private static getSetJ;
182
+ /**
183
+ * calculates sun times for a given date and latitude/longitude
184
+ * @param {Date|number} dateVal Date object for calculating sun-times
185
+ * @param {number} lat latitude for calculating sun-times
186
+ * @param {number} lon longitude for calculating sun-times
187
+ * @param {number} [alt=0] the observer height (in meters) relative to the horizon
188
+ * @param {boolean} [isUtc=false] defines if the calculation should be in utc or local time (default is local)
189
+ * @return {SunTime} result object of sunTime
190
+ */
191
+ static getTimes(dateVal: Date, lat: Degrees, lon: Degrees, alt?: Meters, isUtc?: boolean): SunTime;
192
+ private static calculateJnoon;
193
+ /**
194
+ * calculates time for a given azimuth angle for a given date and latitude/longitude
195
+ * @param {number|Date} dateValue Date object or timestamp for calculating sun-time
196
+ * @param {Degrees} lat latitude for calculating sun-time
197
+ * @param {Degrees} lon longitude for calculating sun-time
198
+ * @param {Radians | Degrees} az azimuth for calculating sun-time
199
+ * @param {boolean} [isDegrees] true if the az angle is in degree and not in rad
200
+ * @return {Date} result time of sun-time
201
+ */
202
+ static getSunTimeByAzimuth(dateValue: any, lat: Degrees, lon: Degrees, az: Radians | Degrees, isDegrees?: boolean): Date;
203
+ /**
204
+ * get azimuth
205
+ * @param {number} H - siderealTime
206
+ * @param {Radians} phi - latitude
207
+ * @param {Radians} dec - The declination of the sun
208
+ * @returns {Radians} azimuth
209
+ */
210
+ private static getAzimuth;
211
+ /**
212
+ * Convert Date to Solar Date/Time
213
+ *
214
+ * Based on https://www.pveducation.org/pvcdrom/properties-of-sunlight/solar-time
215
+ *
216
+ * See: https://github.com/mourner/suncalc/pull/156
217
+ *
218
+ * @param {date} date - Date to calculate for
219
+ * @param {number} utcOffset - UTC offset in hours
220
+ * @param {Degrees} lon - Longitude in degrees
221
+ * @returns {Date} - Date Object in Solar Time
222
+ */
223
+ static getSolarTime(date: Date, utcOffset: number, lon: number): Date;
224
+ static getStarAzEl(date: Date, lat: Degrees, lon: Degrees, ra: number, dec: number): AzEl;
225
+ static getSunAzEl(date: Date, lat: Degrees, lon: Degrees): AzEl;
226
+ static getSunRaDec(d: number): {
227
+ dec: number;
228
+ ra: number;
229
+ };
230
+ }