when_exe 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/locales.rb +2 -2
- data/bin/when.rb +2 -2
- data/lib/when_exe.rb +161 -55
- data/lib/when_exe/basictypes.rb +34 -26
- data/lib/when_exe/calendarnote.rb +654 -0
- data/lib/when_exe/calendartypes.rb +49 -474
- data/lib/when_exe/coordinates.rb +141 -34
- data/lib/when_exe/core/compatibility.rb +22 -2
- data/lib/when_exe/core/extension.rb +47 -3
- data/lib/when_exe/ephemeris.rb +82 -109
- data/lib/when_exe/googlecalendar.rb +1 -1
- data/lib/when_exe/icalendar.rb +26 -14
- data/lib/when_exe/inspect.rb +82 -68
- data/lib/when_exe/locales/af.rb +1 -1
- data/lib/when_exe/locales/ar.rb +1 -1
- data/lib/when_exe/locales/az.rb +1 -1
- data/lib/when_exe/locales/bg.rb +1 -1
- data/lib/when_exe/locales/bn.rb +1 -1
- data/lib/when_exe/locales/bs.rb +1 -1
- data/lib/when_exe/locales/ca.rb +1 -1
- data/lib/when_exe/locales/cs.rb +1 -1
- data/lib/when_exe/locales/cy.rb +1 -1
- data/lib/when_exe/locales/da.rb +1 -1
- data/lib/when_exe/locales/de.rb +1 -1
- data/lib/when_exe/locales/de_AT.rb +1 -1
- data/lib/when_exe/locales/de_CH.rb +1 -1
- data/lib/when_exe/locales/el.rb +1 -1
- data/lib/when_exe/locales/en.rb +1 -1
- data/lib/when_exe/locales/en_AU.rb +1 -1
- data/lib/when_exe/locales/en_CA.rb +1 -1
- data/lib/when_exe/locales/en_GB.rb +1 -1
- data/lib/when_exe/locales/en_IE.rb +1 -1
- data/lib/when_exe/locales/en_IN.rb +1 -1
- data/lib/when_exe/locales/en_NZ.rb +1 -1
- data/lib/when_exe/locales/en_US.rb +1 -1
- data/lib/when_exe/locales/eo.rb +1 -1
- data/lib/when_exe/locales/es.rb +1 -1
- data/lib/when_exe/locales/es_419.rb +1 -1
- data/lib/when_exe/locales/es_AR.rb +1 -1
- data/lib/when_exe/locales/es_CL.rb +1 -1
- data/lib/when_exe/locales/es_CO.rb +1 -1
- data/lib/when_exe/locales/es_CR.rb +1 -1
- data/lib/when_exe/locales/es_EC.rb +1 -1
- data/lib/when_exe/locales/es_MX.rb +1 -1
- data/lib/when_exe/locales/es_PA.rb +1 -1
- data/lib/when_exe/locales/es_PE.rb +1 -1
- data/lib/when_exe/locales/es_VE.rb +1 -1
- data/lib/when_exe/locales/et.rb +1 -1
- data/lib/when_exe/locales/eu.rb +1 -1
- data/lib/when_exe/locales/fa.rb +1 -1
- data/lib/when_exe/locales/fi.rb +1 -1
- data/lib/when_exe/locales/fr.rb +1 -1
- data/lib/when_exe/locales/fr_CA.rb +1 -1
- data/lib/when_exe/locales/fr_CH.rb +1 -1
- data/lib/when_exe/locales/gl.rb +1 -1
- data/lib/when_exe/locales/he.rb +1 -1
- data/lib/when_exe/locales/hi.rb +1 -1
- data/lib/when_exe/locales/hi_IN.rb +1 -1
- data/lib/when_exe/locales/hr.rb +1 -1
- data/lib/when_exe/locales/hu.rb +1 -1
- data/lib/when_exe/locales/id.rb +1 -1
- data/lib/when_exe/locales/is.rb +1 -1
- data/lib/when_exe/locales/it.rb +1 -1
- data/lib/when_exe/locales/it_CH.rb +1 -1
- data/lib/when_exe/locales/ja.rb +1 -1
- data/lib/when_exe/locales/kn.rb +1 -1
- data/lib/when_exe/locales/ko.rb +1 -1
- data/lib/when_exe/locales/lo.rb +1 -1
- data/lib/when_exe/locales/locales.rb +1 -1
- data/lib/when_exe/locales/lt.rb +1 -1
- data/lib/when_exe/locales/lv.rb +1 -1
- data/lib/when_exe/locales/mk.rb +1 -1
- data/lib/when_exe/locales/mn.rb +1 -1
- data/lib/when_exe/locales/ms.rb +1 -1
- data/lib/when_exe/locales/nb.rb +1 -1
- data/lib/when_exe/locales/ne.rb +1 -1
- data/lib/when_exe/locales/nl.rb +1 -1
- data/lib/when_exe/locales/nn.rb +1 -1
- data/lib/when_exe/locales/or.rb +1 -1
- data/lib/when_exe/locales/pl.rb +1 -1
- data/lib/when_exe/locales/pt.rb +1 -1
- data/lib/when_exe/locales/pt_BR.rb +1 -1
- data/lib/when_exe/locales/rm.rb +1 -1
- data/lib/when_exe/locales/ro.rb +1 -1
- data/lib/when_exe/locales/ru.rb +1 -1
- data/lib/when_exe/locales/sk.rb +1 -1
- data/lib/when_exe/locales/sl.rb +1 -1
- data/lib/when_exe/locales/sr.rb +1 -1
- data/lib/when_exe/locales/sv.rb +1 -1
- data/lib/when_exe/locales/sw.rb +1 -1
- data/lib/when_exe/locales/th.rb +1 -1
- data/lib/when_exe/locales/tl.rb +1 -1
- data/lib/when_exe/locales/tr.rb +1 -1
- data/lib/when_exe/locales/uk.rb +1 -1
- data/lib/when_exe/locales/ur.rb +1 -1
- data/lib/when_exe/locales/uz.rb +1 -1
- data/lib/when_exe/locales/vi.rb +1 -1
- data/lib/when_exe/locales/wo.rb +1 -1
- data/lib/when_exe/locales/zh_CN.rb +1 -1
- data/lib/when_exe/locales/zh_HK.rb +1 -1
- data/lib/when_exe/locales/zh_TW.rb +1 -1
- data/lib/when_exe/mini_application.rb +6 -2
- data/lib/when_exe/parts/enumerator.rb +13 -8
- data/lib/when_exe/parts/geometric_complex.rb +3 -5
- data/lib/when_exe/parts/locale.rb +185 -28
- data/lib/when_exe/parts/method_cash.rb +20 -10
- data/lib/when_exe/parts/resource.rb +154 -76
- data/lib/when_exe/parts/timezone.rb +11 -6
- data/lib/when_exe/region/bahai.rb +2 -2
- data/lib/when_exe/region/balinese.rb +296 -296
- data/lib/when_exe/region/chinese.rb +564 -564
- data/lib/when_exe/region/chinese_calendar.rb +5 -1
- data/lib/when_exe/region/chinese_epoch.rb +47 -102
- data/lib/when_exe/region/chinese_twin.rb +798 -0
- data/lib/when_exe/region/christian.rb +314 -338
- data/lib/when_exe/region/coptic.rb +88 -0
- data/lib/when_exe/region/ephemeric_notes.rb +322 -307
- data/lib/when_exe/region/french.rb +2 -2
- data/lib/when_exe/region/indian.rb +361 -272
- data/lib/when_exe/region/iranian.rb +2 -2
- data/lib/when_exe/region/islamic.rb +3 -3
- data/lib/when_exe/region/japanese.rb +1 -1
- data/lib/when_exe/region/japanese_notes.rb +165 -103
- data/lib/when_exe/region/japanese_residues.rb +56 -55
- data/lib/when_exe/region/japanese_twin.rb +228 -0
- data/lib/when_exe/region/javanese.rb +2 -2
- data/lib/when_exe/region/jewish.rb +2 -2
- data/lib/when_exe/region/korean.rb +4 -4
- data/lib/when_exe/region/m17n.rb +19 -19
- data/lib/when_exe/region/martian.rb +21 -9
- data/lib/when_exe/region/mayan.rb +19 -11
- data/lib/when_exe/region/moon.rb +7 -7
- data/lib/when_exe/region/nihon_shoki.rb +7 -7
- data/lib/when_exe/region/roman.rb +100 -100
- data/lib/when_exe/region/shire.rb +130 -147
- data/lib/when_exe/region/thai.rb +2 -2
- data/lib/when_exe/region/tibetan.rb +2 -2
- data/lib/when_exe/region/vietnamese.rb +383 -114
- data/lib/when_exe/region/world.rb +112 -129
- data/lib/when_exe/timestandard.rb +12 -1
- data/lib/when_exe/tmposition.rb +28 -14
- data/lib/when_exe/tmreference.rb +96 -93
- data/lib/when_exe/version.rb +1 -1
- data/test/examples/Terms.m17n +2 -2
- data/test/examples/sample.json +16 -0
- data/test/examples/sample.xml +1 -1
- data/test/test.rb +4 -0
- data/test/test/basictypes.rb +2 -2
- data/test/test/calendarnote.rb +69 -0
- data/test/test/calendartypes.rb +41 -1
- data/test/test/coordinates.rb +12 -1
- data/test/test/ephemeris.rb +13 -66
- data/test/test/icalendar.rb +3 -3
- data/test/test/inspect.rb +1 -1
- data/test/test/parts.rb +7 -4
- data/test/test/region/chinese.rb +45 -0
- data/test/test/region/coptic.rb +27 -0
- data/test/test/region/indian.rb +1 -1
- data/test/test/region/japanese.rb +4 -4
- data/test/test/region/jewish.rb +1 -1
- data/test/test/region/m17n.rb +7 -5
- data/test/test/region/residue.rb +2 -2
- data/test/test/region/vietnamese.rb +102 -0
- data/test/test/timestandard.rb +81 -0
- data/test/test/tmposition.rb +1 -1
- data/test/test/tmreference.rb +1 -1
- data/when_exe.gemspec +2 -2
- metadata +16 -7
@@ -12,7 +12,7 @@ module When
|
|
12
12
|
ChineseTerms = [self, [
|
13
13
|
"namespace:[en=http://en.wikipedia.org/wiki/, ja=http://ja.wikipedia.org/wiki/]",
|
14
14
|
"locale:[=ja:, en=en:, alias]",
|
15
|
-
"names:[ChineseTerms]",
|
15
|
+
"names:[ChineseTerms=]",
|
16
16
|
"[中国太陽暦(節月)=ja:%%<二十四節気>#%.<暦月と節月>, *ChineseSolar=en:Solar_term]",
|
17
17
|
"[中国太陰太陽暦=ja:%%<中国暦>, *ChineseLuniSolar=en:Chinese_calendar]",
|
18
18
|
"[彝暦=ja:%%<イ族>, *Yi=en:Yi_people]",
|
@@ -69,7 +69,7 @@ module When
|
|
69
69
|
YiTerms = [self, [
|
70
70
|
"namespace:[en=http://en.wikipedia.org/wiki/, ja=http://ja.wikipedia.org/wiki/]",
|
71
71
|
"locale:[=ja:, en=en:, alias]",
|
72
|
-
"names:[YiTerms]",
|
72
|
+
"names:[YiTerms=]",
|
73
73
|
|
74
74
|
[self,
|
75
75
|
"names:[月=ja:%%<月_(暦)>, *Month]",
|
@@ -117,129 +117,559 @@ module When
|
|
117
117
|
#
|
118
118
|
class ChineseTrueLunation < MeanLunation
|
119
119
|
|
120
|
-
#
|
121
|
-
#
|
122
|
-
|
120
|
+
#
|
121
|
+
# 唐代のアルゴリズム
|
122
|
+
#
|
123
|
+
# @private
|
124
|
+
module TangMethods
|
123
125
|
|
124
|
-
|
125
|
-
|
126
|
-
|
126
|
+
# 太陽の位置補正表
|
127
|
+
# @return [Array<Array< 入気定日加減数, 朓朒数, 損益率, 損益率増分 >>]
|
128
|
+
#attr_reader :s
|
127
129
|
|
128
|
-
|
129
|
-
|
130
|
-
|
130
|
+
# 月の位置補正表
|
131
|
+
# @return [Array<Array< 区間の時間/分, 損益率 >>]
|
132
|
+
#attr_reader :m
|
131
133
|
|
132
|
-
|
133
|
-
|
134
|
-
|
134
|
+
#
|
135
|
+
# 立成の初期化
|
136
|
+
#
|
137
|
+
def _initialize_rissei
|
135
138
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
139
|
+
# 近点月
|
140
|
+
@anomalistic_month_length = @anomalistic_month_length.to_r
|
141
|
+
|
142
|
+
# 通法
|
143
|
+
@denominator = @year_length.denominator if @year_length.kind_of?(Rational)
|
144
|
+
@denominator = [@denominator||0, @lunation_length.denominator].max if @lunation_length.kind_of?(Rational)
|
145
|
+
|
146
|
+
# 計算式 C) のための繰り返し回数
|
147
|
+
@repeat_count ||= @method.upcase == 'C' ? 2 : 1
|
148
|
+
@repeat_count = @repeat_count.to_i
|
149
|
+
|
150
|
+
# 太陽の盈縮表の生成
|
151
|
+
# [先後數, 朓朒数, (立成b, 立成c)]
|
152
|
+
# ↓
|
153
|
+
# [区間の始めの冬至からの経過日数, 朓朒数, 立成b, 立成c]
|
154
|
+
@s = @s.map {|item| item.dup}
|
155
|
+
if @rissei # 立成の計算・比較
|
156
|
+
puts "\n ["+ @denominator.to_s + "]" if @rissei == @rissei.upcase
|
157
|
+
(0...@s.size).each do |i|
|
158
|
+
bc = send('_rissei_' + @rissei.downcase, i)
|
159
|
+
@s[i] += bc if @s[i].size <= 2
|
160
|
+
if @rissei == @rissei.upcase
|
161
|
+
sq = (bc[0]-@s[i][2])**2 + (bc[1]-@s[i][3])**2
|
162
|
+
puts '%9.1f,%5d,%9.4f,%8.4f,%6.2f' %
|
163
|
+
(@s[i] + [sq == 0 ? -Float::INFINITY : Math.log(sq)/Math.log(100)])
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
(0...@s.size).each do |i|
|
168
|
+
@s[i-1][1,0] = @year_length / @s.size + (@s[i][0]-@s[i-1][0]) / @denominator
|
169
|
+
end
|
170
|
+
(0...@s.size).each do |i|
|
171
|
+
@s[i].shift
|
172
|
+
end
|
173
|
+
|
174
|
+
# 月の遅速表の生成
|
175
|
+
# [変日差, 損益率]
|
176
|
+
# ↓
|
177
|
+
# [変日(区間の終わりの遠/近地点からの経過日数), 区間の終わりの朓朒積, 区間の変日差/日, 区間の損益率]
|
178
|
+
@m = @m.map {|item| item.dup}
|
179
|
+
sum_t = sum_v = 0
|
180
|
+
(0...@m.size).each do |i|
|
181
|
+
sum_t += @m[i][0]
|
182
|
+
sum_v += @m[i][1]
|
183
|
+
@m[i] = [sum_t / @denominator, sum_v, @m[i][0] / @denominator, @m[i][1]]
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
# 戊寅暦 立成 1次補間
|
188
|
+
def _rissei_a(k)
|
189
|
+
tv = [0,1].map {|i| _tv_s(k+i)}
|
190
|
+
[(tv[1][1]-tv[0][1]) / (tv[1][0]-tv[0][0]), 0.0]
|
191
|
+
end
|
192
|
+
|
193
|
+
# 儀鳳暦 立成
|
194
|
+
def _rissei_b(k)
|
195
|
+
v =
|
196
|
+
if k % 3 < 2
|
197
|
+
t = [0,1,2].map {|n| @s[(k+n) % @s.size][1]}
|
198
|
+
t01 = t[1] - t[0]
|
199
|
+
t12 = t[2] - t[1]
|
200
|
+
(t01 + t12) / 2.0 + t01 - t12
|
155
201
|
else
|
156
|
-
|
202
|
+
t = [-1,0,1].map {|n| @s[(k+n) % @s.size][1]}
|
203
|
+
t01 = t[1] - t[0]
|
204
|
+
t12 = t[2] - t[1]
|
205
|
+
t02 = t[2] - t[0]
|
206
|
+
t02 / 2.0
|
157
207
|
end
|
208
|
+
r = v < 0 ? 12.0/(17*11) : 12.0/(16*11)
|
209
|
+
[v * r, (t12-t01) * r * r]
|
210
|
+
end
|
211
|
+
|
212
|
+
# 宣明暦 立成 2次補間
|
213
|
+
def _rissei_c(k)
|
214
|
+
i = [k, k+1, k+2, k % 6 == 5 ? -1 : 0]
|
215
|
+
t0, v0 = _tv_s(i[0]+i[3])
|
216
|
+
t1, v1 = _tv_s(i[1]+i[3])
|
217
|
+
t2, v2 = _tv_s(i[2]+i[3])
|
218
|
+
t01 = t1 - t0
|
219
|
+
t02 = t2 - t0
|
220
|
+
t12 = t2 - t1
|
221
|
+
v01 = v1 - v0
|
222
|
+
v02 = v2 - v0
|
223
|
+
c = (v02*t01 - v01*t02) / (t01*t02*t12) * 2
|
224
|
+
b = (v01 - t01*(t01-1)/2*c) / t01
|
225
|
+
[b-t01*c*i[3], c]
|
226
|
+
end
|
227
|
+
|
228
|
+
# 日行盈縮
|
229
|
+
#
|
230
|
+
# @param [Integer] i 区間の番号
|
231
|
+
#
|
232
|
+
# @return [区間の始めの冬至からの経過日数, 朓朒数]
|
233
|
+
#
|
234
|
+
def _tv_s(i)
|
235
|
+
[@year_length * i / @s.size + @s[i % @s.size][0] / @denominator, @s[i % @s.size][1]]
|
236
|
+
end
|
237
|
+
|
238
|
+
# 月行遅速
|
239
|
+
#
|
240
|
+
# @param [Numeric] t 直前の遠/近地点からの経過日数
|
241
|
+
#
|
242
|
+
# @return [区間の始めからの経過日数, 区間の始めの朓朒積, 区間の変日差/日, 区間の損益率, 次の区間の損益率]
|
243
|
+
#
|
244
|
+
def _tv_m(t)
|
245
|
+
(0...@m.size).each do |i|
|
246
|
+
next if t > @m[i][0]
|
247
|
+
return [t - (@m[i][0] - @m[i][2]), @m[i][1] - @m[i][3], @m[i][2], @m[i][3], @m[(i+1) % @m.size][3]]
|
158
248
|
end
|
159
|
-
|
160
|
-
}
|
161
|
-
p0 >= p1 ? nil : p0...p1
|
249
|
+
end
|
162
250
|
end
|
163
251
|
|
164
|
-
private
|
165
|
-
|
166
|
-
# 周期番号 -> 日時
|
167
252
|
#
|
168
|
-
#
|
253
|
+
# 日本暦日原典 計算 A)
|
169
254
|
#
|
170
|
-
# @
|
255
|
+
# @private
|
256
|
+
module MethodA
|
257
|
+
|
258
|
+
include TangMethods
|
259
|
+
|
260
|
+
private
|
261
|
+
|
262
|
+
# 周期番号 -> 日時
|
263
|
+
#
|
264
|
+
# @param [Numeric] cn 周期番号
|
265
|
+
#
|
266
|
+
# @return [Numeric] ユリウス日
|
267
|
+
#
|
268
|
+
def cn_to_time_(cn, time0=nil)
|
269
|
+
time = super
|
270
|
+
t = time - @day_epoch
|
271
|
+
time + (delta_s(t.divmod(@year_length)[1]) + delta_m(t.divmod(@anomalistic_month_length)[1])).to_r / @denominator
|
272
|
+
end
|
273
|
+
|
274
|
+
#
|
275
|
+
# 朔の日時の太陽運動の不斉による補正
|
276
|
+
#
|
277
|
+
# @param [Numeric] t 直前の冬至からの日数
|
278
|
+
#
|
279
|
+
# @return [Numeric] 補正量 / @denominator
|
280
|
+
#
|
281
|
+
def delta_s(t)
|
282
|
+
|
283
|
+
t0, a, b, c = nil
|
284
|
+
@s.each do |v|
|
285
|
+
t0, a, b, c = v
|
286
|
+
break if t <= t0
|
287
|
+
t -= t0
|
288
|
+
end
|
289
|
+
|
290
|
+
# 24気からの日数 (大余, 小余)
|
291
|
+
t, dt = t.divmod(1)
|
292
|
+
dt = (dt * @denominator).to_i
|
293
|
+
|
294
|
+
# 損益率
|
295
|
+
b0 = (b + c * t).to_i
|
296
|
+
|
297
|
+
# 朓朒数
|
298
|
+
a0 = (a + b * t + c * t * (t-1.0)/2).to_i
|
299
|
+
|
300
|
+
# 補正値
|
301
|
+
a0 + (b0.to_f * dt / @denominator + 0.5).floor
|
302
|
+
end
|
303
|
+
|
304
|
+
#
|
305
|
+
# 朔の日時の月運動の不斉による補正
|
306
|
+
#
|
307
|
+
# @param [Numeric] t 直前の遠/近地点からの日数
|
308
|
+
#
|
309
|
+
# @return [Numeric] 補正量 / @denominator
|
310
|
+
#
|
311
|
+
def delta_m(t)
|
312
|
+
|
313
|
+
dt, a0, t0, b0, b1 = _tv_m(t)
|
314
|
+
|
315
|
+
# 補正値 (A式)
|
316
|
+
a0 + (b0.to_f * dt / t0 + 0.5).floor
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
171
320
|
#
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
321
|
+
# 日本暦日原典 計算 C)
|
322
|
+
#
|
323
|
+
# @private
|
324
|
+
module MethodC
|
325
|
+
|
326
|
+
include TangMethods
|
327
|
+
|
328
|
+
private
|
329
|
+
|
330
|
+
# 周期番号 -> 日時
|
331
|
+
#
|
332
|
+
# @param [Numeric] cn 周期番号
|
333
|
+
#
|
334
|
+
# @return [Numeric] ユリウス日
|
335
|
+
#
|
336
|
+
def cn_to_time_(cn, time0=nil)
|
337
|
+
time = super
|
338
|
+
t = time - @day_epoch
|
339
|
+
t += delta_s(t.divmod(@year_length)[1]) / @denominator
|
340
|
+
d = 0
|
341
|
+
@repeat_count.times do
|
342
|
+
d = delta_m((t+d/@denominator).divmod(@anomalistic_month_length)[1])
|
343
|
+
end
|
344
|
+
t + @day_epoch + d / @denominator
|
345
|
+
end
|
346
|
+
|
347
|
+
#
|
348
|
+
# 朔の日時の太陽運動の不斉による補正
|
349
|
+
#
|
350
|
+
# @param [Numeric] t 直前の冬至からの日数
|
351
|
+
#
|
352
|
+
# @return [Numeric] 補正量 / @denominator
|
353
|
+
#
|
354
|
+
def delta_s(t)
|
355
|
+
|
356
|
+
t0, a, b, c = nil
|
357
|
+
@s.each do |v|
|
358
|
+
t0, a, b, c = v
|
359
|
+
break if t <= t0
|
360
|
+
t -= t0
|
361
|
+
end
|
362
|
+
|
363
|
+
# 24気からの日数 (大余, 小余)
|
364
|
+
t, dt = t.divmod(1)
|
365
|
+
|
366
|
+
# 損益率
|
367
|
+
b0 = b + c * t
|
368
|
+
|
369
|
+
# 朓朒数
|
370
|
+
a0 = a + b * t + c * t * (t-1)/2
|
371
|
+
|
372
|
+
# 補正値
|
373
|
+
a0 + b0 * dt
|
374
|
+
end
|
375
|
+
|
376
|
+
#
|
377
|
+
# 朔の日時の月運動の不斉による補正
|
378
|
+
#
|
379
|
+
# @param [Numeric] t 直前の遠/近地点からの日数
|
380
|
+
#
|
381
|
+
# @return [Numeric] 補正量 / @denominator
|
382
|
+
#
|
383
|
+
def delta_m(t)
|
384
|
+
|
385
|
+
#Sm, 遅速積, 区間長, Δ1, Δ2
|
386
|
+
dt, a0, t0, b0, b1 = _tv_m(t)
|
387
|
+
|
388
|
+
# 補正値 (B,C式)
|
389
|
+
a0 + dt / t0 * ((b0+b1)/2.0 + 0.5*(1+t0-dt)*(b0-b1))
|
390
|
+
end
|
177
391
|
end
|
178
392
|
|
179
393
|
#
|
180
|
-
#
|
394
|
+
# 日本暦日原典 計算 B)
|
181
395
|
#
|
182
|
-
# @
|
396
|
+
# @private
|
397
|
+
MethodB = MethodC
|
398
|
+
|
183
399
|
#
|
184
|
-
#
|
400
|
+
# 元明代のアルゴリズム
|
185
401
|
#
|
186
|
-
|
402
|
+
# @private
|
403
|
+
module JujiMethods
|
187
404
|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
t -= t0
|
405
|
+
# 授時暦・大統暦
|
406
|
+
module C
|
407
|
+
def _shift_l(year); @year_span * (year / @year_span) end
|
408
|
+
alias :_shift_s :_shift_l
|
193
409
|
end
|
194
410
|
|
195
|
-
#
|
196
|
-
|
197
|
-
|
411
|
+
# 貞享暦・宝暦暦
|
412
|
+
module Y
|
413
|
+
def _shift_l(year); year end
|
414
|
+
def _shift_s(year); year-1 end
|
415
|
+
end
|
198
416
|
|
199
|
-
#
|
200
|
-
|
417
|
+
# 寛政暦?
|
418
|
+
module D
|
419
|
+
def _shift_l(year); 5 + year.div(10) * 10 end
|
420
|
+
alias :_shift_s :_shift_l
|
421
|
+
end
|
201
422
|
|
202
|
-
#
|
203
|
-
|
423
|
+
# 暦元天正冬至から当該年の天正冬至までの日数
|
424
|
+
def _winter_solstice_(year)
|
425
|
+
year * (@year_length - @year_delta * _shift_s(year))
|
426
|
+
end
|
204
427
|
|
205
|
-
#
|
206
|
-
|
428
|
+
# 暦元天正冬至から当該年の近日点通過までの日数
|
429
|
+
def _perihelion_(year)
|
430
|
+
_winter_solstice(year) + @anomalistic_year_shift
|
431
|
+
end
|
432
|
+
|
433
|
+
# 歳周(当該年の日数)
|
434
|
+
def _year_length_(year)
|
435
|
+
@year_length - 2 * @year_delta * _shift_l(year)
|
436
|
+
end
|
207
437
|
end
|
208
438
|
|
209
439
|
#
|
210
|
-
#
|
440
|
+
# 授時暦の平均太陽の計算
|
211
441
|
#
|
212
|
-
# @
|
442
|
+
# @private
|
443
|
+
module MethodS
|
444
|
+
|
445
|
+
include JujiMethods
|
446
|
+
|
447
|
+
# 日時 -> 周期番号
|
448
|
+
#
|
449
|
+
# @param [Numeric] t ユリウス日(Terrestrial Time)
|
450
|
+
# @param [When::TM::TemporalPosition] t
|
451
|
+
#
|
452
|
+
# @return [Numeric] 周期番号
|
453
|
+
#
|
454
|
+
def time_to_cn(t, cn0=nil)
|
455
|
+
cn0 ||= (t.to_f - @day_epoch) / @year_length + @year_epoch + @longitude_shift
|
456
|
+
root(cn0 * 12, t.to_f) {|cn| cn_to_time(cn) }
|
457
|
+
end
|
458
|
+
|
459
|
+
# 周期番号 -> 日時(平気)
|
460
|
+
#
|
461
|
+
# @param [Numeric] cn 周期番号
|
462
|
+
# @param [Numeric] time0 日時の初期近似値(ダミー)
|
463
|
+
#
|
464
|
+
# @return [Numeric] ユリウス日
|
465
|
+
#
|
466
|
+
def cn_to_time_(cn, time0=nil)
|
467
|
+
year, mean_term = (cn / 12.0 - @longitude_shift - @year_epoch).divmod(1)
|
468
|
+
@day_epoch + _winter_solstice(year) + _year_length_(year) * mean_term
|
469
|
+
end
|
470
|
+
end
|
471
|
+
|
213
472
|
#
|
214
|
-
#
|
473
|
+
# 授時暦の定朔の計算
|
215
474
|
#
|
216
|
-
|
475
|
+
# @private
|
476
|
+
module MethodJ
|
477
|
+
|
478
|
+
include JujiMethods
|
479
|
+
|
480
|
+
# 周期番号 -> 日時(定朔)
|
481
|
+
#
|
482
|
+
# @param [Numeric] cn 周期番号
|
483
|
+
# @param [Numeric] time0 日時の初期近似値(ダミー)
|
484
|
+
#
|
485
|
+
# @return [Numeric] ユリウス日
|
486
|
+
#
|
487
|
+
def cn_to_time_(cn, time0=nil)
|
488
|
+
# 暦元天正冬至から当該経朔までの日数
|
489
|
+
mean_lunation = cn * @lunation_length - @lunation_shift
|
490
|
+
|
491
|
+
# 当該経朔を含む近点年の暦元からの年数
|
492
|
+
year = (mean_lunation / @year_length).floor
|
493
|
+
until (_perihelion(year)..._perihelion(year+1)).include?(mean_lunation)
|
494
|
+
year += _perihelion(year) > mean_lunation ? -1 : +1
|
495
|
+
end
|
496
|
+
|
497
|
+
# 定朔
|
498
|
+
solar_unit = _year_length(year) / @year_length
|
499
|
+
mean_motion = (@lunar_mean_motion - @solar_weight / solar_unit) * 10000_0000
|
500
|
+
@day_epoch + mean_lunation - send('_anomaly_' + @anomaly_method.downcase, mean_lunation, year, solar_unit, mean_motion)
|
501
|
+
end
|
502
|
+
|
503
|
+
# 経朔 - 定朔 ( A 方式 - 差分)
|
504
|
+
def _anomaly_a(mean_lunation, year, solar_unit, mean_motion)
|
505
|
+
|
506
|
+
# 盈縮差(太陽の中心差) / (日 / 10000_0000)
|
507
|
+
solar_anomalies = (0..@solar_weight).to_a.map {|day|
|
508
|
+
solar_unit * equation_of_centre(((mean_lunation + day - _perihelion(year)) / solar_unit) % @year_length, @s)
|
509
|
+
}
|
510
|
+
solar_anomalies[1] ||= solar_anomalies[0]
|
511
|
+
|
512
|
+
# 遅速差(月の中心差) / (日 / 10000_0000)
|
513
|
+
lunar_anomalies = [0,1].map {|day|
|
514
|
+
equation_of_centre(((mean_lunation + day + @anomalistic_month_shift) % @anomalistic_month_length) / @lunar_unit, @m)
|
515
|
+
}
|
516
|
+
|
517
|
+
# 経朔 - 定朔
|
518
|
+
(lunar_anomalies[0] - solar_anomalies[0]) / ((lunar_anomalies[1] - lunar_anomalies[0]) -
|
519
|
+
(solar_anomalies[1] - solar_anomalies[0]) + mean_motion)
|
520
|
+
end
|
521
|
+
|
522
|
+
# 経朔 - 定朔 ( B 方式 - 微分)
|
523
|
+
def _anomaly_b(mean_lunation, year, solar_unit, mean_motion)
|
524
|
+
|
525
|
+
# 盈縮差(太陽の中心差) / (日 / 10000_0000)
|
526
|
+
solar_anomalies = (0..@solar_weight).to_a.map {|diff|
|
527
|
+
solar_unit * equation_of_centre(((mean_lunation - _perihelion(year)) / solar_unit) % @year_length, @s, diff)
|
528
|
+
}
|
529
|
+
solar_anomalies[1] ||= 0
|
530
|
+
|
531
|
+
# 遅速差(月の中心差) / (日 / 10000_0000)
|
532
|
+
lunar_anomalies = [0,1].map {|diff|
|
533
|
+
equation_of_centre(((mean_lunation + @anomalistic_month_shift) % @anomalistic_month_length) / @lunar_unit, @m, diff)
|
534
|
+
}
|
535
|
+
|
536
|
+
# 経朔 - 定朔
|
537
|
+
(lunar_anomalies[0] - solar_anomalies[0]) / (lunar_anomalies[1] / @lunar_unit -
|
538
|
+
solar_anomalies[1] / solar_unit + mean_motion)
|
539
|
+
end
|
540
|
+
|
541
|
+
# 経朔 - 定朔 ( C 方式 - 幾何学的補正)
|
542
|
+
def _anomaly_c(mean_lunation, year, solar_unit, mean_motion)
|
543
|
+
diff = 0
|
544
|
+
loop do
|
545
|
+
|
546
|
+
# 盈縮差(太陽の中心差) / (日 / 10000_0000)
|
547
|
+
solar_anomaly = solar_unit * equation_of_centre(((mean_lunation - diff - _perihelion(year)) / solar_unit) % @year_length, @s)
|
217
548
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
549
|
+
# 遅速差(月の中心差) / (日 / 10000_0000)
|
550
|
+
lunar_anomaly = equation_of_centre(((mean_lunation - diff + @anomalistic_month_shift) % @anomalistic_month_length) / @lunar_unit, @m)
|
551
|
+
|
552
|
+
# 次の差分
|
553
|
+
next_diff = (lunar_anomaly - solar_anomaly) / mean_motion
|
554
|
+
return next_diff if (next_diff - diff).abs < @anomaly_precision
|
555
|
+
diff = next_diff
|
556
|
+
end
|
225
557
|
end
|
226
558
|
|
227
|
-
#
|
228
|
-
|
559
|
+
# 中心差およびその時間微分
|
560
|
+
def equation_of_centre(mean_anomaly, table, differential=0)
|
561
|
+
table.each do |range, base, *coefficients|
|
562
|
+
if range.include?(mean_anomaly)
|
563
|
+
diff = mean_anomaly - base
|
564
|
+
diff = diff.abs if coefficients[0].size[0] == 0
|
565
|
+
return coefficients[differential].inject(0) {|sum, coefficient| sum * diff + coefficient}
|
566
|
+
end
|
567
|
+
end
|
568
|
+
raise RangeError, 'Mean anomaly out of range: ' + mean_anomaly.to_s
|
569
|
+
end
|
570
|
+
|
571
|
+
# 立成の作成
|
572
|
+
def _initialize_rissei
|
573
|
+
@year_length = @year_length.to_f # 暦元の冬至年 / 日
|
574
|
+
@year_span = (@year_span || 1).to_i # 冬至年の改訂周期 / 年
|
575
|
+
@anomalistic_year_shift = (@anomalistic_year_shift || 0).to_f # 暦應(冬至から近日点通過までの日数)
|
576
|
+
@lunation_length = @lunation_length.to_f # 朔実(朔望月)
|
577
|
+
@lunation_shift = @lunation_shift.to_f # 閏應(暦元前経朔から暦元天正冬至までの日数)
|
578
|
+
@lunar_mean_motion = @lunar_mean_motion.to_f # 月平行(恒星天に対する月の平均運動 / 日)
|
579
|
+
@anomalistic_month_length = @anomalistic_month_length.to_f # 転終(近点月)
|
580
|
+
@anomalistic_month_shift = @anomalistic_month_shift.to_f # 転應(暦元前近/遠地点通過から暦元天正冬至までの日数)
|
581
|
+
@anomaly_method = @anomaly_method || 'a' # (経朔-定朔)の計算方法
|
582
|
+
@anomaly_precision = (@anomaly_precision || 1.0E-5).to_f # c 方式 での収束判定誤差 / 日
|
583
|
+
@solar_weight = @solar_weight || 0 # (経朔-定朔)の計算で用いる実行差での太陽盈縮の重み(0:非考慮,1:考慮)
|
584
|
+
@lunar_unit = @lunar_unit.to_f # 太陰遅速計算用招差法定数の時間の単位(限)
|
585
|
+
@m = _rissei_j(@m) # 太陰遅速計算用招差法定数
|
586
|
+
@s = _rissei_j(@s) # 太陽盈縮計算用招差法定数
|
587
|
+
end
|
588
|
+
|
589
|
+
# 招差法用の表の生成
|
590
|
+
def _rissei_j(table)
|
591
|
+
table.map {|range, base, coefficients|
|
592
|
+
sign = range.last == base ? -1 : +1
|
593
|
+
[range, base, coefficients.reverse,
|
594
|
+
(1...coefficients.size).to_a.reverse.map {|i| sign * i * coefficients[i]}]
|
595
|
+
}
|
596
|
+
end
|
597
|
+
end
|
598
|
+
|
599
|
+
# 近点月
|
600
|
+
# @return [Numeric]
|
601
|
+
#attr_reader :anomalistic_month_length
|
602
|
+
|
603
|
+
# 元期の近点角
|
604
|
+
# @return [Numeric]
|
605
|
+
#attr_reader :anomalistic_month_shift
|
606
|
+
|
607
|
+
# 日時 -> 周期番号(唐代の定朔の暦法用 cn_to_time(1L) を使用する)
|
608
|
+
#
|
609
|
+
# @param [Numeric] t ユリウス日(Terrestrial Time)
|
610
|
+
# @param [When::TM::TemporalPosition] t
|
611
|
+
#
|
612
|
+
# @return [Numeric] 周期番号
|
613
|
+
#
|
614
|
+
def time_to_cn(t)
|
615
|
+
return super unless @cycle_number_1m
|
616
|
+
time = @is_dynamical ? +t : t.to_f
|
617
|
+
cn0 = time * @cycle_number_1m + @cycle_number_0m
|
618
|
+
root(cn0, time) {|cn| cn_to_time(cn)}
|
229
619
|
end
|
230
620
|
|
621
|
+
# 当該日付の月の位相の変化範囲(唐代の定朔の暦法用 cn_to_time(1L) を使用する)
|
622
|
+
#
|
623
|
+
# @param [When::TM::TemporalPosition] date 日付
|
624
|
+
#
|
625
|
+
# @return [Array<Numeric>] 当該日付の月の位相の変化範囲
|
626
|
+
#
|
627
|
+
def phase_range(date)
|
628
|
+
date = date.floor
|
629
|
+
[date, date.succ].map {|d|
|
630
|
+
t = d.to_f
|
631
|
+
c = (60.0 * ((t - CYCLE_0M) * @cycle_number_1m + @cycle_number_0m)).floor
|
632
|
+
t0 = t1 = nil
|
633
|
+
loop do
|
634
|
+
t0 = cn_to_time( c / 60.0)
|
635
|
+
t1 = cn_to_time((c+1)/ 60.0)
|
636
|
+
if t0 > t
|
637
|
+
c -= 1
|
638
|
+
elsif t1 <= t
|
639
|
+
c += 1
|
640
|
+
else
|
641
|
+
break
|
642
|
+
end
|
643
|
+
end
|
644
|
+
(c + (t-t0) / (t1-t0)) / 60.0
|
645
|
+
}
|
646
|
+
end
|
647
|
+
|
648
|
+
private
|
649
|
+
|
231
650
|
# オブジェクトの正規化
|
232
651
|
def _normalize(args=[], options={})
|
233
652
|
super
|
234
653
|
if @formula == '1L'
|
235
|
-
|
236
|
-
|
237
|
-
@
|
238
|
-
(
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
654
|
+
|
655
|
+
# 月の位相の計算
|
656
|
+
@method ||= @year_span ? 'J' : 'A'
|
657
|
+
instance_eval("class << self; include const_get('Method#{@method.upcase}'); end")
|
658
|
+
|
659
|
+
# 立成の初期化
|
660
|
+
_initialize_rissei
|
661
|
+
|
662
|
+
elsif @year_span
|
663
|
+
# 太陽黄経の計算(消長あり)
|
664
|
+
class << self; include MethodS; end
|
665
|
+
@year_span = @year_span.to_i
|
666
|
+
end
|
667
|
+
|
668
|
+
if self.kind_of?(JujiMethods)
|
669
|
+
case @year_span
|
670
|
+
when 0,1; class << self; include JujiMethods::Y; end
|
671
|
+
# when 10 ; class << self; include JujiMethods::D; end
|
672
|
+
else ; class << self; include JujiMethods::C; end
|
243
673
|
end
|
244
674
|
end
|
245
675
|
end
|
@@ -253,6 +683,42 @@ module When
|
|
253
683
|
#
|
254
684
|
class ChineseSolar < EphemerisBasedSolar
|
255
685
|
|
686
|
+
class << self
|
687
|
+
#
|
688
|
+
# 太陰太陽暦の定義から太陰太陽暦と太陽暦(節月)の組を作る
|
689
|
+
#
|
690
|
+
# @private
|
691
|
+
def twin(area, definition)
|
692
|
+
definition.inject([]) {|list, cal|
|
693
|
+
if cal.kind_of?(Array) && cal[0] == ChineseLuniSolar
|
694
|
+
solar_name = cal[1].sub(/=?\]/, '(節月)=]')
|
695
|
+
lunisolar = cal.dup << "twin:#{area}::" + solar_name.gsub(/(name:\[|=?\])/,'')
|
696
|
+
solar = cal.dup << "twin:#{area}::" + cal[1].gsub(/(name:\[|=?\])/,'')
|
697
|
+
solar[0..1] = [ChineseSolar, solar_name]
|
698
|
+
list << lunisolar << solar
|
699
|
+
else
|
700
|
+
list << cal
|
701
|
+
end
|
702
|
+
}
|
703
|
+
end
|
704
|
+
|
705
|
+
#
|
706
|
+
# 盈縮差の表の時間の単位を調整する
|
707
|
+
#
|
708
|
+
# @private
|
709
|
+
def change_unit(unit, definition)
|
710
|
+
definition.map {|line|
|
711
|
+
line.map {|item|
|
712
|
+
case item
|
713
|
+
when Range ; Range.new(item.first*unit, item.last*unit, item.exclude_end?)
|
714
|
+
when Numeric ; item*unit
|
715
|
+
else ; item
|
716
|
+
end
|
717
|
+
}
|
718
|
+
}
|
719
|
+
end
|
720
|
+
end
|
721
|
+
|
256
722
|
#
|
257
723
|
# @return [When::CalendarTypes::ChineseLuniSolar] 対で用いる太陰太陽暦の名前
|
258
724
|
#
|
@@ -297,12 +763,20 @@ module When
|
|
297
763
|
#
|
298
764
|
# @param [Numeric] y 年
|
299
765
|
#
|
300
|
-
# @return [Array<Numeric:月番号>,
|
766
|
+
# @return [Array<Numeric:月番号>, Hash<Numeric:含む中気の数=>Numeric:月番号>]
|
301
767
|
#
|
302
768
|
def intercalary_pattern(y)
|
303
|
-
m
|
304
|
-
l
|
305
|
-
[
|
769
|
+
m = _base_month(y)
|
770
|
+
l = _base_ids(y)
|
771
|
+
c = {0=>[], 1=>[], 2=>[]}
|
772
|
+
d0 = Residue.mod(_new_month(m)-1) {|n| _new_epoch(n)}[0]
|
773
|
+
l.size.times do |i|
|
774
|
+
d1 = Residue.mod(_new_month(m+i+1)-1) {|n| _new_epoch(n)}[0]
|
775
|
+
c[d1-d0] << l[i]
|
776
|
+
d0 = d1
|
777
|
+
end
|
778
|
+
c.delete(1)
|
779
|
+
[l, c]
|
306
780
|
end
|
307
781
|
|
308
782
|
private
|
@@ -427,480 +901,6 @@ module When
|
|
427
901
|
end
|
428
902
|
end
|
429
903
|
|
430
|
-
Chinese = [{}, When::BasicTypes::M17n, [
|
431
|
-
"namespace:[en=http://en.wikipedia.org/wiki/, ja=http://ja.wikipedia.org/wiki/]",
|
432
|
-
"locale:[=ja:, en=en:, alias]",
|
433
|
-
"area:[中国,China]",
|
434
|
-
|
435
|
-
[ChineseLuniSolar,
|
436
|
-
'name:[黄帝暦]',
|
437
|
-
'formula:MeanLunation?year_length=1461/4&lunation_length=27759/940&day_epoch=1228331',
|
438
|
-
'intercalary_month:12'
|
439
|
-
],
|
440
|
-
|
441
|
-
[ChineseLuniSolar,
|
442
|
-
'name:[顓頊暦]',
|
443
|
-
'formula:MeanLunation?year_length=1461/4&lunation_length=27759/940&day_epoch=1171396&longitude_shift=-1/8',
|
444
|
-
'time_basis:+00,+#{P:12}',
|
445
|
-
'intercalary_month:9'
|
446
|
-
],
|
447
|
-
|
448
|
-
[ChineseLuniSolar,
|
449
|
-
'name:[夏暦]',
|
450
|
-
'formula:MeanLunation?year_length=1461/4&lunation_length=27759/940&day_epoch=1328411',
|
451
|
-
'intercalary_month:12'
|
452
|
-
],
|
453
|
-
|
454
|
-
[ChineseLuniSolar,
|
455
|
-
'name:[殷暦]',
|
456
|
-
'formula:MeanLunation?year_length=1461/4&lunation_length=27759/940&day_epoch=1149071',
|
457
|
-
'intercalary_month:12'
|
458
|
-
],
|
459
|
-
|
460
|
-
[ChineseLuniSolar,
|
461
|
-
'name:[周暦]',
|
462
|
-
'formula:MeanLunation?year_length=1461/4&lunation_length=27759/940&day_epoch=1128251',
|
463
|
-
'intercalary_month:12'
|
464
|
-
],
|
465
|
-
|
466
|
-
[ChineseLuniSolar,
|
467
|
-
'name:[魯暦]',
|
468
|
-
'formula:MeanLunation?year_length=1461/4&lunation_length=27759/940&day_epoch=1048991',
|
469
|
-
'intercalary_month:12'
|
470
|
-
],
|
471
|
-
|
472
|
-
[ChineseLuniSolar,
|
473
|
-
'name:[太初暦]',
|
474
|
-
'formula:MeanLunation?year_length=562120/1539&lunation_length=2392/81&day_epoch=1683431'
|
475
|
-
],
|
476
|
-
|
477
|
-
[ChineseLuniSolar,
|
478
|
-
'name:[四分暦]',
|
479
|
-
'formula:MeanLunation?year_length=1461/4&lunation_length=27759/940&day_epoch=1662611'
|
480
|
-
],
|
481
|
-
|
482
|
-
[ChineseLuniSolar,
|
483
|
-
'name:[乾象暦]',
|
484
|
-
'formula:MeanLunation?year_length=215130/589&lunation_length=43026/1457&day_epoch=-898129'
|
485
|
-
],
|
486
|
-
|
487
|
-
[ChineseLuniSolar,
|
488
|
-
'name:[景初暦]',
|
489
|
-
'formula:MeanLunation?year_length=673150/1843&lunation_length=134630/4559&day_epoch=+330191'
|
490
|
-
],
|
491
|
-
|
492
|
-
[ChineseLuniSolar,
|
493
|
-
'name:[三紀暦]',
|
494
|
-
'formula:MeanLunation?year_length=895220/2451&lunation_length=179044/6063&day_epoch=-28760989'
|
495
|
-
],
|
496
|
-
|
497
|
-
[ChineseLuniSolar,
|
498
|
-
'name:[玄始暦]',
|
499
|
-
'formula:MeanLunation?year_length=2629759/7200&lunation_length=2629759/89052&day_epoch=-20568349'
|
500
|
-
],
|
501
|
-
|
502
|
-
[ChineseLuniSolar,
|
503
|
-
'name:[元嘉暦]',
|
504
|
-
'formula:MeanLunation?year_length=111035/304&lunation_length=22207/752&day_epoch=-200089&longitude_shift=-1/12' # 春分の1ヶ月前
|
505
|
-
],
|
506
|
-
|
507
|
-
[ChineseLuniSolar,
|
508
|
-
'name:[大明暦]',
|
509
|
-
'formula:MeanLunation?year_length=14423804/39491&lunation_length=116321/3939&day_epoch=-17080189'
|
510
|
-
],
|
511
|
-
|
512
|
-
[ChineseLuniSolar,
|
513
|
-
'name:[正光暦]',
|
514
|
-
'formula:MeanLunation?year_length=2213377/6060&lunation_length=2213377/74952&day_epoch=-59357929'
|
515
|
-
],
|
516
|
-
|
517
|
-
[ChineseLuniSolar,
|
518
|
-
'name:[興和暦]',
|
519
|
-
'formula:MeanLunation?year_length=6158017/16860&lunation_length=6158017/208530&day_epoch=-105462049'
|
520
|
-
],
|
521
|
-
|
522
|
-
[ChineseLuniSolar,
|
523
|
-
'name:[天保暦]',
|
524
|
-
'formula:MeanLunation?year_length=8641687/23660&lunation_length=8641687/292635&day_epoch=-38447089'
|
525
|
-
],
|
526
|
-
|
527
|
-
[ChineseLuniSolar,
|
528
|
-
'name:[天和暦]',
|
529
|
-
'formula:MeanLunation?year_length=8568631/23460&lunation_length=8568631/290160&day_epoch=-317950249'
|
530
|
-
],
|
531
|
-
|
532
|
-
[ChineseLuniSolar,
|
533
|
-
'name:[大象暦]',
|
534
|
-
'formula:MeanLunation?year_length=4745247/12992&lunation_length=1581749/53563&day_epoch=-13244449'
|
535
|
-
],
|
536
|
-
|
537
|
-
[ChineseLuniSolar,
|
538
|
-
'name:[開皇暦]',
|
539
|
-
'formula:MeanLunation?year_length=37605463/102960&lunation_length=5372209/181920&day_epoch=-1506155749'
|
540
|
-
],
|
541
|
-
|
542
|
-
[ChineseLuniSolar,
|
543
|
-
'name:[大業暦]',
|
544
|
-
'formula:MeanLunation?year_length=15573963/42640&lunation_length=33783/1144&day_epoch=-519493909'
|
545
|
-
],
|
546
|
-
|
547
|
-
[ChineseLuniSolar,
|
548
|
-
'name:[平朔儀鳳暦]',
|
549
|
-
'formula:MeanLunation?year_length=122357/335&lunation_length=39571/1340&day_epoch=-96608689'
|
550
|
-
],
|
551
|
-
|
552
|
-
[ChineseLuniSolar,
|
553
|
-
'name:[麟徳暦]',
|
554
|
-
'time_basis:+00,+#{P:00}',
|
555
|
-
{'formula'=>['12S', '1L'].map {|f|
|
556
|
-
Ephemeris::ChineseTrueLunation.new({
|
557
|
-
'formula' => f,
|
558
|
-
'day_epoch' => -96608689,
|
559
|
-
'year_length' => '122357/335',
|
560
|
-
'lunation_length' => '39571/1340',
|
561
|
-
'anomalistic_month_length' => '443077/16080', # 27.0 + (743.0+1.0/12)/1340,
|
562
|
-
's' => [
|
563
|
-
[ 0.0, 0, +3.9546, -0.0372], # 冬至
|
564
|
-
[ -722.0, +54, +3.4091, -0.0372], # 大寒
|
565
|
-
[-1340.0, +100, +2.8636, -0.0372], # 小寒
|
566
|
-
[-1854.0, +138, +2.3181, +0.0372], # 立春
|
567
|
-
[-2368.0, +176, +2.8636, +0.0372], # 雨水
|
568
|
-
[-2986.0, +222, +3.4091, +0.0372], # 啓蟄
|
569
|
-
[-3708.0, +276, -3.7220, +0.0329], # 春分
|
570
|
-
[-2986.0, +222, -3.2086, +0.0329], # 清明
|
571
|
-
[-2368.0, +176, -2.6952, +0.0329], # 穀雨
|
572
|
-
[-1854.0, +138, -2.1818, -0.0329], # 立夏
|
573
|
-
[-1340.0, +100, -2.6952, -0.0329], # 小満
|
574
|
-
[ -722.0, +54, -3.2086, -0.0329], # 芒種
|
575
|
-
[ 0.0, 0, -3.7220, +0.0329], # 夏至
|
576
|
-
[ +722.0, -54, -3.2086, +0.0329], # 小暑
|
577
|
-
[+1340.0, -100, -2.6952, +0.0329], # 大暑
|
578
|
-
[+1854.0, -138, -2.1818, -0.0329], # 立秋
|
579
|
-
[+2368.0, -176, -2.6952, -0.0329], # 処暑
|
580
|
-
[+2986.0, -222, -3.2086, -0.0329], # 白露
|
581
|
-
[+3708.0, -276, +3.9546, -0.0372], # 秋分
|
582
|
-
[+2986.0, -222, +3.4091, -0.0372], # 寒露
|
583
|
-
[+2368.0, -176, +2.8636, -0.0372], # 霜降
|
584
|
-
[+1854.0, -138, +2.3181, +0.0372], # 立冬
|
585
|
-
[+1340.0, -100, +2.8636, +0.0372], # 小雪
|
586
|
-
[ +722.0, -54, +3.4091, +0.0372], # 大雪
|
587
|
-
],
|
588
|
-
'm' => [
|
589
|
-
[1340.0, -134], # 1日
|
590
|
-
[1340.0, -117], # 2日
|
591
|
-
[1340.0, -99], # 3日
|
592
|
-
[1340.0, -78], # 4日
|
593
|
-
[1340.0, -56], # 5日
|
594
|
-
[1340.0, -33], # 6日
|
595
|
-
[1191.0, -9], # 7日
|
596
|
-
[ 149.0, 0], # 7日
|
597
|
-
[1340.0, +14], # 8日
|
598
|
-
[1340.0, +38], # 9日
|
599
|
-
[1340.0, +62], # 10日
|
600
|
-
[1340.0, +85], # 11日
|
601
|
-
[1340.0, +104], # 12日
|
602
|
-
[1340.0, +121], # 13日
|
603
|
-
[1042.0, +102], # 14日
|
604
|
-
[ 298.0, +29], # 14日
|
605
|
-
[1340.0, +128], # 15日
|
606
|
-
[1340.0, +115], # 16日
|
607
|
-
[1340.0, +95], # 17日
|
608
|
-
[1340.0, +74], # 18日
|
609
|
-
[1340.0, +52], # 19日
|
610
|
-
[1340.0, +28], # 20日
|
611
|
-
[ 892.0, +4], # 21日
|
612
|
-
[ 448.0, 0], # 21日
|
613
|
-
[1340.0, -20], # 22日
|
614
|
-
[1340.0, -44], # 23日
|
615
|
-
[1340.0, -68], # 24日
|
616
|
-
[1340.0, -89], # 25日
|
617
|
-
[1340.0, -108], # 26日
|
618
|
-
[1340.0, -125], # 27日
|
619
|
-
[ 743.0+1.0/12, -71] # 28日
|
620
|
-
]
|
621
|
-
})
|
622
|
-
},
|
623
|
-
'doyo' => (Rational( 4,15) + 244) / 1340
|
624
|
-
}
|
625
|
-
],
|
626
|
-
|
627
|
-
[ChineseLuniSolar,
|
628
|
-
'name:[大衍暦]',
|
629
|
-
'time_basis:+00,+#{P:03}',
|
630
|
-
{'formula'=>['12S', '1L'].map {|f|
|
631
|
-
Ephemeris::ChineseTrueLunation.new({
|
632
|
-
'formula' => f,
|
633
|
-
'day_epoch' => -35412747829,
|
634
|
-
'year_length' => '1110343/3040',
|
635
|
-
'lunation_length' => '89773/3040',
|
636
|
-
'anomalistic_month_length' => '6701279/243200', # 27.0 +(1685.0+79.0/80)/3040,
|
637
|
-
'anomalistic_month_shift' => '1/2',
|
638
|
-
's' => [
|
639
|
-
[ 0.0, 0, +13.4524, -0.1886], # 冬至
|
640
|
-
[-2353.0, +176, +10.5564, -0.1634], # 大寒
|
641
|
-
[-4198.0, +314, +8.0408, -0.1446], # 小寒
|
642
|
-
[-5588.0, +418, +5.8160, -0.1318], # 立春
|
643
|
-
[-6564.0, +491, +3.7987, -0.1240], # 雨水
|
644
|
-
[-7152.0, +535, +1.9265, -0.1240], # 啓蟄
|
645
|
-
[-7366.0, +551, -0.2048, -0.1178], # 春分
|
646
|
-
[-7152.0, +535, -1.9968, -0.1190], # 清明
|
647
|
-
[-6564.0, +491, -3.7956, -0.1240], # 穀雨
|
648
|
-
[-5588.0, +418, -5.6626, -0.1324], # 立夏
|
649
|
-
[-4198.0, +314, -7.6555, -0.1436], # 小満
|
650
|
-
[-2353.0, +176, -9.9405, -0.1436], # 芒種
|
651
|
-
[ 0.0, 0, -12.0819, +0.1436], # 夏至
|
652
|
-
[+2353.0, -176, -9.7018, +0.1324], # 小暑
|
653
|
-
[+4198.0, -314, -7.5450, +0.1240], # 大暑
|
654
|
-
[+5588.0, -418, -5.5634, +0.1190], # 立秋
|
655
|
-
[+6564.0, -491, -3.7038, +0.1178], # 処暑
|
656
|
-
[+7152.0, -535, -1.8954, +0.1178], # 白露
|
657
|
-
[+7366.0, -551, +0.1783, +0.1240], # 秋分
|
658
|
-
[+7152.0, -535, +2.0042, +0.1318], # 寒露
|
659
|
-
[+6564.0, -491, +3.8950, +0.1446], # 霜降
|
660
|
-
[+5588.0, -418, +5.9214, +0.1634], # 立冬
|
661
|
-
[+4198.0, -314, +8.1610, +0.1886], # 小雪
|
662
|
-
[+2353.0, -176, +10.9010, +0.1886], # 大雪
|
663
|
-
],
|
664
|
-
'm' => [
|
665
|
-
[3040.0, +297], # 1日
|
666
|
-
[3040.0, +259], # 2日
|
667
|
-
[3040.0, +220], # 3日
|
668
|
-
[3040.0, +180], # 4日
|
669
|
-
[3040.0, +139], # 5日
|
670
|
-
[3040.0, +97], # 6日
|
671
|
-
[2701.0, +48], # 7日
|
672
|
-
[ 339.0, -6], # 7日
|
673
|
-
[3040.0, -64], # 8日
|
674
|
-
[3040.0, -106], # 9日
|
675
|
-
[3040.0, -148], # 10日
|
676
|
-
[3040.0, -189], # 11日
|
677
|
-
[3040.0, -229], # 12日
|
678
|
-
[3040.0, -267], # 13日
|
679
|
-
[2363.0, -231], # 14日
|
680
|
-
[ 677.0, -66], # 14日
|
681
|
-
[3040.0, -289], # 15日
|
682
|
-
[3040.0, -250], # 16日
|
683
|
-
[3040.0, -211], # 17日
|
684
|
-
[3040.0, -171], # 18日
|
685
|
-
[3040.0, -130], # 19日
|
686
|
-
[3040.0, -87], # 20日
|
687
|
-
[2024.0, -36], # 21日
|
688
|
-
[1016.0, +18], # 21日
|
689
|
-
[3040.0, +73], # 22日
|
690
|
-
[3040.0, +116], # 23日
|
691
|
-
[3040.0, +157], # 24日
|
692
|
-
[3040.0, +198], # 25日
|
693
|
-
[3040.0, +237], # 26日
|
694
|
-
[3040.0, +276], # 27日
|
695
|
-
[1686.0, +165] # 28日
|
696
|
-
]
|
697
|
-
})
|
698
|
-
},
|
699
|
-
'doyo' => (Rational(13,30) + 531) / 3040
|
700
|
-
}
|
701
|
-
],
|
702
|
-
|
703
|
-
[ChineseLuniSolar,
|
704
|
-
'name:[五紀暦]',
|
705
|
-
'time_basis:+00,+#{P:06}',
|
706
|
-
{'formula'=>['12S', '1L'].map {|f|
|
707
|
-
Ephemeris::ChineseTrueLunation.new({
|
708
|
-
'formula' => f,
|
709
|
-
'day_epoch' => -96608689,
|
710
|
-
'year_length' => '122357/335',
|
711
|
-
'lunation_length' => '39571/1340',
|
712
|
-
'anomalistic_month_length' => '1366156/49580', # 27.0 + (743.0+5.0/37)/1340,
|
713
|
-
's' => [
|
714
|
-
[ 0.0, 0, +5.9668, -0.0843], # 冬至
|
715
|
-
[-1037.0, +78, +4.6652, -0.0721], # 大寒
|
716
|
-
[-1850.0, +139, +3.5656, -0.0653], # 小寒
|
717
|
-
[-2463.0, +185, +2.5583, -0.0590], # 立春
|
718
|
-
[-2893.0, +217, +1.6375, -0.0532], # 雨水
|
719
|
-
[-3152.0, +236, +0.8384, -0.0532], # 啓蟄
|
720
|
-
[-3246.0, +243, -0.0972, -0.0505], # 春分
|
721
|
-
[-3152.0, +236, -0.8480, -0.0534], # 清明
|
722
|
-
[-2893.0, +217, -1.6517, -0.0561], # 穀雨
|
723
|
-
[-2463.0, +185, -2.5057, -0.0584], # 立夏
|
724
|
-
[-1850.0, +139, -3.3781, -0.0643], # 小満
|
725
|
-
[-1037.0, +78, -4.3954, -0.0643], # 芒種
|
726
|
-
[ 0.0, 0, -5.3592, +0.0643], # 夏至
|
727
|
-
[+1037.0, -78, -4.2877, +0.0584], # 小暑
|
728
|
-
[+1850.0, -139, -3.3459, +0.0561], # 大暑
|
729
|
-
[+2463.0, -185, -2.4475, +0.0534], # 立秋
|
730
|
-
[+2893.0, -217, -1.5966, +0.0505], # 処暑
|
731
|
-
[+3152.0, -236, -0.8185, +0.0505], # 白露
|
732
|
-
[+3246.0, -243, +0.0858, +0.0532], # 秋分
|
733
|
-
[+3152.0, -236, +0.8505, +0.0590], # 寒露
|
734
|
-
[+2893.0, -217, +1.6943, +0.0653], # 霜降
|
735
|
-
[+2463.0, -185, +2.6205, +0.0721], # 立冬
|
736
|
-
[+1850.0, -139, +3.6007, +0.0843], # 小雪
|
737
|
-
[+1037.0, -78, +4.8330, +0.0843], # 大雪
|
738
|
-
],
|
739
|
-
'm' => [
|
740
|
-
[1340.0, -135], # 1日
|
741
|
-
[1340.0, -117], # 2日
|
742
|
-
[1340.0, -99], # 3日
|
743
|
-
[1340.0, -78], # 4日
|
744
|
-
[1340.0, -56], # 5日
|
745
|
-
[1340.0, -33], # 6日
|
746
|
-
[1191.0, -8], # 7日
|
747
|
-
[ 149.0, +1], # 7日
|
748
|
-
[1340.0, +14], # 8日
|
749
|
-
[1340.0, +38], # 9日
|
750
|
-
[1340.0, +62], # 10日
|
751
|
-
[1340.0, +85], # 11日
|
752
|
-
[1340.0, +103], # 12日
|
753
|
-
[1340.0, +118], # 13日
|
754
|
-
[1042.0, +105], # 14日
|
755
|
-
[ 298.0, +30], # 14日
|
756
|
-
[1340.0, +128], # 15日
|
757
|
-
[1340.0, +115], # 16日
|
758
|
-
[1340.0, +95], # 17日
|
759
|
-
[1340.0, +74], # 18日
|
760
|
-
[1340.0, +52], # 19日
|
761
|
-
[1340.0, +28], # 20日
|
762
|
-
[ 892.0, +6], # 21日
|
763
|
-
[ 448.0, -3], # 21日
|
764
|
-
[1340.0, -20], # 22日
|
765
|
-
[1340.0, -42], # 23日
|
766
|
-
[1340.0, -65], # 24日
|
767
|
-
[1340.0, -89], # 25日
|
768
|
-
[1340.0, -109], # 26日
|
769
|
-
[1340.0, -125], # 27日
|
770
|
-
[ 743.0+5.0/37, -75] # 28日
|
771
|
-
]
|
772
|
-
})
|
773
|
-
},
|
774
|
-
'doyo' => (Rational( 4,15) + 244) / 1340
|
775
|
-
}
|
776
|
-
],
|
777
|
-
|
778
|
-
[ChineseSolar,
|
779
|
-
'name:[正元暦(節月)]',
|
780
|
-
'formula:MeanLunation?year_length=399943/1095&lunation_length=32336/1095&day_epoch=-145149709'
|
781
|
-
],
|
782
|
-
|
783
|
-
[ChineseLuniSolar,
|
784
|
-
'name:[宣明暦]',
|
785
|
-
'time_basis:+00,+#{P:06}',
|
786
|
-
{'formula'=>['12S', '1L'].map {|f|
|
787
|
-
Ephemeris::ChineseTrueLunation.new({
|
788
|
-
'formula' => f,
|
789
|
-
'day_epoch' => -2580308749,
|
790
|
-
'year_length' => '3068055/8400',
|
791
|
-
'lunation_length' => '248057/8400',
|
792
|
-
'anomalistic_month_length' => '23145819/840000', # 27.0 + 4658.19 / 8400,
|
793
|
-
'anomalistic_month_shift' => '1/2',
|
794
|
-
's' => [
|
795
|
-
[ 0.0, 0, +33.4511, -0.3695], # 冬至
|
796
|
-
[ -6000.0, +449, +28.0389, -0.3606], # 大寒
|
797
|
-
[-11000.0, +823, +22.6998, -0.3519], # 小寒
|
798
|
-
[-15000.0, +1122, +17.8923, -0.4068], # 立春
|
799
|
-
[-18000.0, +1346, +11.7966, -0.3998], # 雨水
|
800
|
-
[-19800.0, +1481, +5.7986, -0.3998], # 啓蟄
|
801
|
-
[-20400.0, +1526, -0.2433, -0.3779], # 春分
|
802
|
-
[-19800.0, +1481, -6.1254, -0.3634], # 清明
|
803
|
-
[-18000.0, +1346, -12.2048, -0.2987], # 穀雨
|
804
|
-
[-15000.0, +1122, -16.9060, -0.2919], # 立夏
|
805
|
-
[-11000.0, +823, -21.5362, -0.2854], # 小満
|
806
|
-
[ -6000.0, +449, -26.0498, -0.2854], # 芒種
|
807
|
-
[ 0.0, 0, -30.3119, +0.2854], # 夏至
|
808
|
-
[ +6000.0, -449, -25.8126, +0.2919], # 小暑
|
809
|
-
[+11000.0, -823, -21.2454, +0.2987], # 大暑
|
810
|
-
[+15000.0, -1122, -17.0296, +0.3634], # 立秋
|
811
|
-
[+18000.0, -1346, -11.4744, +0.3779], # 処暑
|
812
|
-
[+19800.0, -1481, -5.6429, +0.3779], # 白露
|
813
|
-
[+20400.0, -1526, +0.1432, +0.3998], # 秋分
|
814
|
-
[+19800.0, -1481, +6.1488, +0.4068], # 寒露
|
815
|
-
[+18000.0, -1346, +12.6336, +0.3519], # 霜降
|
816
|
-
[+15000.0, -1122, +17.8043, +0.3606], # 立冬
|
817
|
-
[+11000.0, -823, +23.0590, +0.3695], # 小雪
|
818
|
-
[ +6000.0, -449, +28.4618, +0.3695], # 大雪
|
819
|
-
],
|
820
|
-
'm' => [
|
821
|
-
[ 8400.0, +830], # 進1日
|
822
|
-
[ 8400.0, +726], # 2日
|
823
|
-
[ 8400.0, +606], # 3日
|
824
|
-
[ 8400.0, +471], # 4日
|
825
|
-
[ 8400.0, +337], # 5日
|
826
|
-
[ 8400.0, +202], # 6日
|
827
|
-
[ 7465.0, +53], # 7日
|
828
|
-
[ 935.0, -7], # 7日
|
829
|
-
[ 8400.0, -82], # 8日
|
830
|
-
[ 8400.0, -224], # 9日
|
831
|
-
[ 8400.0, -366], # 10日
|
832
|
-
[ 8400.0, -509], # 11日
|
833
|
-
[ 8400.0, -643], # 12日
|
834
|
-
[ 8400.0, -748], # 13日
|
835
|
-
[ 6529.095, -646], # 14日
|
836
|
-
[ 8400.0, -830], # 退1日
|
837
|
-
[ 8400.0, -726], # 2日
|
838
|
-
[ 8400.0, -598], # 3日
|
839
|
-
[ 8400.0, -464], # 4日
|
840
|
-
[ 8400.0, -329], # 5日
|
841
|
-
[ 8400.0, -195], # 6日
|
842
|
-
[ 7465.0, -53], # 7日
|
843
|
-
[ 935.0, +7], # 7日
|
844
|
-
[ 8400.0, +82], # 8日
|
845
|
-
[ 8400.0, +225], # 9日
|
846
|
-
[ 8400.0, +366], # 10日
|
847
|
-
[ 8400.0, +501], # 11日
|
848
|
-
[ 8400.0, +628], # 12日
|
849
|
-
[ 8400.0, +740], # 13日
|
850
|
-
[ 6529.095, +646] # 14日
|
851
|
-
]
|
852
|
-
})
|
853
|
-
},
|
854
|
-
'doyo' => (Rational( 1, 2) + 1468) / 8400
|
855
|
-
}
|
856
|
-
],
|
857
|
-
|
858
|
-
[ChineseSolar,
|
859
|
-
'name:[前貞享暦(節月)]',
|
860
|
-
'formula:VariableYearLengthMethod?day_epoch=2336118.675000&year_epoch=1684&year_length=365.241696&year_delta=1'
|
861
|
-
],
|
862
|
-
|
863
|
-
[ChineseSolar,
|
864
|
-
'name:[貞享暦(節月)]',
|
865
|
-
'formula:VariableYearLengthMethod?day_epoch=2336118.689990&year_epoch=1684&year_length=365.241696&year_delta=1'
|
866
|
-
],
|
867
|
-
|
868
|
-
[ChineseSolar,
|
869
|
-
'name:[貞享補暦A(節月)]',
|
870
|
-
'formula:VariableYearLengthMethod?day_epoch=2336118.903800&year_epoch=1684&year_length=365.241696&year_delta=1'
|
871
|
-
],
|
872
|
-
|
873
|
-
[ChineseSolar,
|
874
|
-
'name:[貞享補暦B(節月)]',
|
875
|
-
'formula:VariableYearLengthMethod?day_epoch=2336118.622300&year_epoch=1684&year_length=365.241696&year_delta=1'
|
876
|
-
],
|
877
|
-
|
878
|
-
[ChineseSolar,
|
879
|
-
'name:[宝暦暦(節月)]',
|
880
|
-
'formula:VariableYearLengthMethod?day_epoch=2336118.622100&year_epoch=1684&year_length=365.241696&year_delta=1'
|
881
|
-
],
|
882
|
-
|
883
|
-
[ChineseSolar,
|
884
|
-
'name:[修正宝暦暦(節月)]',
|
885
|
-
'formula:VariableYearLengthMethod?day_epoch=2336118.762200&year_epoch=1684&year_length=365.241766&year_delta=1'
|
886
|
-
],
|
887
|
-
|
888
|
-
[ChineseSolar,
|
889
|
-
'name:[寛政暦(節月)]',
|
890
|
-
'formula:VariableYearLengthMethod?day_epoch=2336118.720200&year_epoch=1684&year_length=365.242360&year_delta=0'
|
891
|
-
]
|
892
|
-
].inject([]) {|list, cal|
|
893
|
-
if cal.kind_of?(Array) && cal[0] == ChineseLuniSolar
|
894
|
-
solar_name = cal[1].sub(/\]/, '(節月)]')
|
895
|
-
lunisolar = cal.dup << 'twin:Chinese::' + solar_name.gsub(/(name:\[|\])/,'')
|
896
|
-
solar = cal.dup << 'twin:Chinese::' + cal[1].gsub(/(name:\[|\])/,'')
|
897
|
-
solar[0..1] = [ChineseSolar, solar_name]
|
898
|
-
list << lunisolar << solar
|
899
|
-
else
|
900
|
-
list << cal
|
901
|
-
end
|
902
|
-
}]
|
903
|
-
|
904
904
|
#
|
905
905
|
# 太平天国 2.1.1-3.2.30
|
906
906
|
#
|