1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.meanLunarMonth = undefined;
|
7 |
|
8 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | exports.meanNew = meanNew;
|
19 | exports.meanFirst = meanFirst;
|
20 | exports.meanFull = meanFull;
|
21 | exports.meanLast = meanLast;
|
22 | exports.newMoon = newMoon;
|
23 | exports.first = first;
|
24 | exports.full = full;
|
25 | exports.last = last;
|
26 |
|
27 | var _base = require('./base');
|
28 |
|
29 | var _base2 = _interopRequireDefault(_base);
|
30 |
|
31 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
32 |
|
33 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
34 |
|
35 | var ck = 1 / 1236.85;
|
36 |
|
37 |
|
38 |
|
39 |
|
40 | var meanLunarMonth = exports.meanLunarMonth = 29.530588861;
|
41 |
|
42 |
|
43 | function mean(T) {
|
44 | return _base2.default.horner(T, 2451550.09766, 29.530588861 / ck, 0.00015437, -0.00000015, 0.00000000073);
|
45 | }
|
46 |
|
47 |
|
48 | function snap(y, q) {
|
49 | var k = (y - 2000) * 12.3685;
|
50 | return Math.floor(k - q + 0.5) + q;
|
51 | }
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 | function meanNew(year) {
|
61 | return mean(snap(year, 0) * ck);
|
62 | }
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 | function meanFirst(year) {
|
72 | return mean(snap(year, 0.25) * ck);
|
73 | }
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 | function meanFull(year) {
|
83 | return mean(snap(year, 0.5) * ck);
|
84 | }
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 | function meanLast(year) {
|
94 | return mean(snap(year, 0.75) * ck);
|
95 | }
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 | function newMoon(year) {
|
104 | var m = new Mp(year, 0);
|
105 | return mean(m.T) + m.nfc(nc) + m.a();
|
106 | }
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 | function first(year, month, day) {
|
115 | var m = new Mp(year, 0.25);
|
116 | return mean(m.T) + m.flc() + m.w() + m.a();
|
117 | }
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 | function full(year, month, day) {
|
126 | var m = new Mp(year, 0.5);
|
127 | return mean(m.T) + m.nfc(fc) + m.a();
|
128 | }
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 | function last(year, month, day) {
|
137 | var m = new Mp(year, 0.75);
|
138 | return mean(m.T) + m.flc() - m.w() + m.a();
|
139 | }
|
140 |
|
141 | var p = Math.PI / 180;
|
142 |
|
143 | var Mp = function () {
|
144 | function Mp(y, q) {
|
145 | _classCallCheck(this, Mp);
|
146 |
|
147 | this.A = new Array(14);
|
148 | this.k = snap(y, q);
|
149 | this.T = this.k * ck;
|
150 | this.E = _base2.default.horner(this.T, 1, -0.002516, -0.0000074);
|
151 | this.M = _base2.default.horner(this.T, 2.5534 * p, 29.1053567 * p / ck, -0.0000014 * p, -0.00000011 * p);
|
152 | this.M_ = _base2.default.horner(this.T, 201.5643 * p, 385.81693528 * p / ck, 0.0107582 * p, 0.00001238 * p, -0.000000058 * p);
|
153 | this.F = _base2.default.horner(this.T, 160.7108 * p, 390.67050284 * p / ck, -0.0016118 * p, -0.00000227 * p, 0.000000011 * p);
|
154 | this.Ω = _base2.default.horner(this.T, 124.7746 * p, -1.56375588 * p / ck, 0.0020672 * p, 0.00000215 * p);
|
155 | this.A[0] = 299.7 * p + 0.107408 * p * this.k - 0.009173 * this.T * this.T;
|
156 | this.A[1] = 251.88 * p + 0.016321 * p * this.k;
|
157 | this.A[2] = 251.83 * p + 26.651886 * p * this.k;
|
158 | this.A[3] = 349.42 * p + 36.412478 * p * this.k;
|
159 | this.A[4] = 84.66 * p + 18.206239 * p * this.k;
|
160 | this.A[5] = 141.74 * p + 53.303771 * p * this.k;
|
161 | this.A[6] = 207.17 * p + 2.453732 * p * this.k;
|
162 | this.A[7] = 154.84 * p + 7.30686 * p * this.k;
|
163 | this.A[8] = 34.52 * p + 27.261239 * p * this.k;
|
164 | this.A[9] = 207.19 * p + 0.121824 * p * this.k;
|
165 | this.A[10] = 291.34 * p + 1.844379 * p * this.k;
|
166 | this.A[11] = 161.72 * p + 24.198154 * p * this.k;
|
167 | this.A[12] = 239.56 * p + 25.513099 * p * this.k;
|
168 | this.A[13] = 331.55 * p + 3.592518 * p * this.k;
|
169 | }
|
170 |
|
171 |
|
172 |
|
173 |
|
174 | _createClass(Mp, [{
|
175 | key: 'nfc',
|
176 | value: function nfc(c) {
|
177 | return c[0] * Math.sin(this.M_) + c[1] * Math.sin(this.M) * this.E + c[2] * Math.sin(2 * this.M_) + c[3] * Math.sin(2 * this.F) + c[4] * Math.sin(this.M_ - this.M) * this.E + c[5] * Math.sin(this.M_ + this.M) * this.E + c[6] * Math.sin(2 * this.M) * this.E * this.E + c[7] * Math.sin(this.M_ - 2 * this.F) + c[8] * Math.sin(this.M_ + 2 * this.F) + c[9] * Math.sin(2 * this.M_ + this.M) * this.E + c[10] * Math.sin(3 * this.M_) + c[11] * Math.sin(this.M + 2 * this.F) * this.E + c[12] * Math.sin(this.M - 2 * this.F) * this.E + c[13] * Math.sin(2 * this.M_ - this.M) * this.E + c[14] * Math.sin(this.Ω) + c[15] * Math.sin(this.M_ + 2 * this.M) + c[16] * Math.sin(2 * (this.M_ - this.F)) + c[17] * Math.sin(3 * this.M) + c[18] * Math.sin(this.M_ + this.M - 2 * this.F) + c[19] * Math.sin(2 * (this.M_ + this.F)) + c[20] * Math.sin(this.M_ + this.M + 2 * this.F) + c[21] * Math.sin(this.M_ - this.M + 2 * this.F) + c[22] * Math.sin(this.M_ - this.M - 2 * this.F) + c[23] * Math.sin(3 * this.M_ + this.M) + c[24] * Math.sin(4 * this.M_);
|
178 | }
|
179 |
|
180 |
|
181 |
|
182 | }, {
|
183 | key: 'flc',
|
184 | value: function flc() {
|
185 | return -0.62801 * Math.sin(this.M_) + 0.17172 * Math.sin(this.M) * this.E + -0.01183 * Math.sin(this.M_ + this.M) * this.E + 0.00862 * Math.sin(2 * this.M_) + 0.00804 * Math.sin(2 * this.F) + 0.00454 * Math.sin(this.M_ - this.M) * this.E + 0.00204 * Math.sin(2 * this.M) * this.E * this.E + -0.0018 * Math.sin(this.M_ - 2 * this.F) + -0.0007 * Math.sin(this.M_ + 2 * this.F) + -0.0004 * Math.sin(3 * this.M_) + -0.00034 * Math.sin(2 * this.M_ - this.M) + 0.00032 * Math.sin(this.M + 2 * this.F) * this.E + 0.00032 * Math.sin(this.M - 2 * this.F) * this.E + -0.00028 * Math.sin(this.M_ + 2 * this.M) * this.E * this.E + 0.00027 * Math.sin(2 * this.M_ + this.M) * this.E + -0.00017 * Math.sin(this.Ω) + -0.00005 * Math.sin(this.M_ - this.M - 2 * this.F) + 0.00004 * Math.sin(2 * this.M_ + 2 * this.F) + -0.00004 * Math.sin(this.M_ + this.M + 2 * this.F) + 0.00004 * Math.sin(this.M_ - 2 * this.M) + 0.00003 * Math.sin(this.M_ + this.M - 2 * this.F) + 0.00003 * Math.sin(3 * this.M) + 0.00002 * Math.sin(2 * this.M_ - 2 * this.F) + 0.00002 * Math.sin(this.M_ - this.M + 2 * this.F) + -0.00002 * Math.sin(3 * this.M_ + this.M);
|
186 | }
|
187 | }, {
|
188 | key: 'w',
|
189 | value: function w() {
|
190 | return 0.00306 - 0.00038 * this.E * Math.cos(this.M) + 0.00026 * Math.cos(this.M_) - 0.00002 * (Math.cos(this.M_ - this.M) - Math.cos(this.M_ + this.M) - Math.cos(2 * this.F));
|
191 | }
|
192 |
|
193 |
|
194 |
|
195 | }, {
|
196 | key: 'a',
|
197 | value: function a() {
|
198 | var _this = this;
|
199 |
|
200 | var a = 0;
|
201 | ac.forEach(function (c, i) {
|
202 | a += c * Math.sin(_this.A[i]);
|
203 | });
|
204 | return a;
|
205 | }
|
206 | }]);
|
207 |
|
208 | return Mp;
|
209 | }();
|
210 |
|
211 |
|
212 |
|
213 |
|
214 | var nc = [-0.4072, 0.17241, 0.01608, 0.01039, 0.00739, -0.00514, 0.00208, -0.00111, -0.00057, 0.00056, -0.00042, 0.00042, 0.00038, -0.00024, -0.00017, -0.00007, 0.00004, 0.00004, 0.00003, 0.00003, -0.00003, 0.00003, -0.00002, -0.00002, 0.00002];
|
215 |
|
216 |
|
217 | var fc = [-0.40614, 0.17302, 0.01614, 0.01043, 0.00734, -0.00515, 0.00209, -0.00111, -0.00057, 0.00056, -0.00042, 0.00042, 0.00038, -0.00024, -0.00017, -0.00007, 0.00004, 0.00004, 0.00003, 0.00003, -0.00003, 0.00003, -0.00002, -0.00002, 0.00002];
|
218 |
|
219 |
|
220 | var ac = [0.000325, 0.000165, 0.000164, 0.000126, 0.00011, 0.000062, 0.00006, 0.000056, 0.000047, 0.000042, 0.000040, 0.000037, 0.000035, 0.000023];
|
221 |
|
222 | exports.default = {
|
223 | meanLunarMonth: meanLunarMonth,
|
224 | meanNew: meanNew,
|
225 | meanFirst: meanFirst,
|
226 | meanFull: meanFull,
|
227 | meanLast: meanLast,
|
228 | newMoon: newMoon,
|
229 | new: newMoon,
|
230 | first: first,
|
231 | full: full,
|
232 | last: last
|
233 | }; |
\ | No newline at end of file |