when_exe 0.2.100 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.ja.txt +25 -25
- data/LICENSE.txt +31 -31
- data/bin/irb.rc +5 -0
- data/bin/locales.rb +2 -2
- data/bin/when.rb +16 -0
- data/bin/when.rb.config +7 -0
- data/lib/when_exe.rb +616 -14
- data/lib/when_exe/basictypes.rb +615 -0
- data/lib/when_exe/calendartypes.rb +1700 -0
- data/lib/when_exe/coordinates.rb +1936 -0
- data/lib/when_exe/core/compatibility.rb +54 -0
- data/lib/when_exe/core/duration.rb +72 -72
- data/lib/when_exe/core/extension.rb +382 -0
- data/lib/when_exe/ephemeris.rb +1845 -0
- data/lib/when_exe/googlecalendar.rb +140 -0
- data/lib/when_exe/icalendar.rb +1587 -0
- data/lib/when_exe/inspect.rb +1237 -0
- data/lib/when_exe/locales/af.rb +90 -0
- data/lib/when_exe/locales/ar.rb +145 -0
- data/lib/when_exe/locales/az.rb +90 -0
- data/lib/when_exe/locales/bg.rb +90 -0
- data/lib/when_exe/locales/bn.rb +94 -0
- data/lib/when_exe/locales/bs.rb +121 -0
- data/lib/when_exe/locales/ca.rb +92 -0
- data/lib/when_exe/locales/cs.rb +107 -0
- data/lib/when_exe/locales/cy.rb +150 -0
- data/lib/when_exe/locales/da.rb +84 -0
- data/lib/when_exe/locales/de.rb +92 -0
- data/lib/when_exe/locales/de_AT.rb +92 -0
- data/lib/when_exe/locales/de_CH.rb +92 -0
- data/lib/when_exe/locales/el.rb +93 -0
- data/lib/when_exe/locales/en.rb +88 -0
- data/lib/when_exe/locales/en_AU.rb +88 -0
- data/lib/when_exe/locales/en_CA.rb +88 -0
- data/lib/when_exe/locales/en_GB.rb +88 -0
- data/lib/when_exe/locales/en_IN.rb +88 -0
- data/lib/when_exe/locales/en_NZ.rb +88 -0
- data/lib/when_exe/locales/eo.rb +89 -0
- data/lib/when_exe/locales/es.rb +84 -0
- data/lib/when_exe/locales/es_419.rb +84 -0
- data/lib/when_exe/locales/es_AR.rb +84 -0
- data/lib/when_exe/locales/es_CL.rb +84 -0
- data/lib/when_exe/locales/es_CO.rb +84 -0
- data/lib/when_exe/locales/es_MX.rb +84 -0
- data/lib/when_exe/locales/es_PE.rb +85 -0
- data/lib/when_exe/locales/es_VE.rb +84 -0
- data/lib/when_exe/locales/et.rb +94 -0
- data/lib/when_exe/locales/eu.rb +95 -0
- data/lib/when_exe/locales/fa.rb +80 -0
- data/lib/when_exe/locales/fi.rb +89 -0
- data/lib/when_exe/locales/fr.rb +88 -0
- data/lib/when_exe/locales/fr_CA.rb +88 -0
- data/lib/when_exe/locales/fr_CH.rb +88 -0
- data/lib/when_exe/locales/gl.rb +81 -0
- data/lib/when_exe/locales/he.rb +84 -0
- data/lib/when_exe/locales/hi.rb +80 -0
- data/lib/when_exe/locales/hi_IN.rb +84 -0
- data/lib/when_exe/locales/hr.rb +128 -0
- data/lib/when_exe/locales/hu.rb +84 -0
- data/lib/when_exe/locales/id.rb +89 -0
- data/lib/when_exe/locales/is.rb +89 -0
- data/lib/when_exe/locales/it.rb +87 -0
- data/lib/when_exe/locales/it_CH.rb +87 -0
- data/lib/when_exe/locales/ja.rb +78 -0
- data/lib/when_exe/locales/kn.rb +86 -0
- data/lib/when_exe/locales/ko.rb +78 -0
- data/lib/when_exe/locales/links.rb +2342 -0
- data/lib/when_exe/locales/lo.rb +123 -0
- data/lib/when_exe/locales/locales.rb +91 -0
- data/lib/when_exe/locales/lt.rb +111 -0
- data/lib/when_exe/locales/lv.rb +118 -0
- data/lib/when_exe/locales/mk.rb +93 -0
- data/lib/when_exe/locales/mn.rb +80 -0
- data/lib/when_exe/locales/nb.rb +81 -0
- data/lib/when_exe/locales/ne.rb +81 -0
- data/lib/when_exe/locales/nl.rb +92 -0
- data/lib/when_exe/locales/nn.rb +73 -0
- data/lib/when_exe/locales/or.rb +84 -0
- data/lib/when_exe/locales/pl.rb +128 -0
- data/lib/when_exe/locales/pt.rb +88 -0
- data/lib/when_exe/locales/pt_BR.rb +88 -0
- data/lib/when_exe/locales/rm.rb +143 -0
- data/lib/when_exe/locales/ro.rb +105 -0
- data/lib/when_exe/locales/ru.rb +128 -0
- data/lib/when_exe/locales/sk.rb +109 -0
- data/lib/when_exe/locales/sl.rb +122 -0
- data/lib/when_exe/locales/sr.rb +122 -0
- data/lib/when_exe/locales/sv.rb +83 -0
- data/lib/when_exe/locales/sw.rb +89 -0
- data/lib/when_exe/locales/th.rb +78 -0
- data/lib/when_exe/locales/tl.rb +99 -0
- data/lib/when_exe/locales/tr.rb +96 -0
- data/lib/when_exe/locales/uk.rb +128 -0
- data/lib/when_exe/locales/uz.rb +128 -0
- data/lib/when_exe/locales/vi.rb +94 -0
- data/lib/when_exe/locales/wo.rb +82 -0
- data/lib/when_exe/locales/zh_CN.rb +77 -0
- data/lib/when_exe/locales/zh_HK.rb +77 -0
- data/lib/when_exe/locales/zh_TW.rb +77 -0
- data/lib/when_exe/mini_application.rb +252 -0
- data/lib/when_exe/parts/enumerator.rb +472 -0
- data/lib/when_exe/parts/geometric_complex.rb +379 -0
- data/lib/when_exe/parts/locale.rb +513 -0
- data/lib/when_exe/parts/method_cash.rb +207 -0
- data/lib/when_exe/parts/resource.rb +806 -0
- data/lib/when_exe/parts/timezone.rb +182 -0
- data/lib/when_exe/region/bahai.rb +145 -0
- data/lib/when_exe/region/balinese.rb +627 -0
- data/lib/when_exe/region/chinese.rb +896 -0
- data/lib/when_exe/region/chinese_calendar.rb +919 -0
- data/lib/when_exe/region/chinese_epoch.rb +1245 -0
- data/lib/when_exe/region/christian.rb +644 -0
- data/lib/when_exe/region/far_east.rb +192 -0
- data/lib/when_exe/region/french.rb +66 -0
- data/lib/when_exe/region/geologicalage.rb +639 -0
- data/lib/when_exe/region/indian.rb +1066 -0
- data/lib/when_exe/region/iranian.rb +66 -0
- data/lib/when_exe/region/islamic.rb +105 -0
- data/lib/when_exe/region/japanese.rb +851 -0
- data/lib/when_exe/region/japanese_notes.rb +964 -0
- data/lib/when_exe/region/japanese_residues.rb +1149 -0
- data/lib/when_exe/region/javanese.rb +228 -0
- data/lib/when_exe/region/jewish.rb +127 -0
- data/lib/when_exe/region/korean.rb +267 -0
- data/lib/when_exe/region/m17n.rb +115 -0
- data/lib/when_exe/region/martian.rb +215 -0
- data/lib/when_exe/region/mayan.rb +122 -0
- data/lib/when_exe/region/moon.rb +333 -0
- data/lib/when_exe/region/nihon_shoki.rb +73 -0
- data/lib/when_exe/region/planets.rb +585 -0
- data/lib/when_exe/region/pope.rb +298 -0
- data/lib/when_exe/region/residue.rb +229 -0
- data/lib/when_exe/region/roman.rb +325 -0
- data/lib/when_exe/region/ryukyu.rb +98 -0
- data/lib/when_exe/region/shire.rb +254 -0
- data/lib/when_exe/region/sun.rb +210 -0
- data/lib/when_exe/region/thai.rb +227 -0
- data/lib/when_exe/region/tibetan.rb +233 -0
- data/lib/when_exe/region/v50.rb +111 -0
- data/lib/when_exe/region/vietnamese.rb +173 -0
- data/lib/when_exe/region/world.rb +197 -0
- data/lib/when_exe/timestandard.rb +547 -0
- data/lib/when_exe/tmduration.rb +330 -330
- data/lib/when_exe/tmobjects.rb +1295 -0
- data/lib/when_exe/tmposition.rb +1955 -0
- data/lib/when_exe/tmreference.rb +1547 -0
- data/lib/when_exe/version.rb +10 -3
- data/link_to_online_documents +4 -0
- data/test/examples/JapanHolidays.ics +456 -0
- data/test/examples/Millennium.ics +17 -0
- data/test/examples/NewYork.ics +61 -0
- data/test/examples/Residue.m17n +135 -0
- data/test/examples/Spatial.m17n +179 -0
- data/test/examples/Terms.m17n +39 -0
- data/test/examples/Test.ics +53 -0
- data/test/examples/USA-DST.ics +61 -0
- data/test/examples/geometric_complex.rb +41 -0
- data/test/examples/sample.xml +14 -0
- data/test/examples/today.rb +61 -0
- data/test/test.rb +54 -19
- data/test/test.rb.config +1 -0
- data/test/test/basictypes.rb +368 -0
- data/test/test/calendartypes.rb +57 -0
- data/test/test/coordinates.rb +380 -0
- data/test/test/ephemeris.rb +127 -0
- data/test/test/googlecalendar.rb +167 -0
- data/test/test/icalendar.rb +848 -0
- data/test/test/inspect.rb +115 -0
- data/test/test/parts.rb +480 -0
- data/test/test/region/chinese.rb +161 -0
- data/test/test/region/french.rb +33 -0
- data/test/test/region/geologicalage.rb +14 -0
- data/test/test/region/indian.rb +55 -0
- data/test/test/region/iran.rb +54 -0
- data/test/test/region/islamic.rb +18 -0
- data/test/test/region/japanese.rb +62 -0
- data/test/test/region/jewish.rb +61 -0
- data/test/test/region/m17n.rb +181 -0
- data/test/test/region/mayan.rb +78 -0
- data/test/test/region/moon.rb +14 -0
- data/test/test/region/planets.rb +14 -0
- data/test/test/region/residue.rb +123 -0
- data/test/test/region/sun.rb +14 -0
- data/test/test/region/thai.rb +94 -0
- data/test/test/region/tibetan.rb +30 -0
- data/test/test/tmobjects.rb +356 -57
- data/test/test/tmposition.rb +237 -0
- data/test/test/tmreference.rb +95 -0
- data/when_exe.gemspec +2 -2
- metadata +187 -7
- data/doc/COPYING +0 -31
- data/doc/COPYING.ja +0 -25
- data/doc/document_url +0 -1
@@ -0,0 +1,896 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
=begin
|
3
|
+
Copyright (C) 2011-2013 Takashi SUGA
|
4
|
+
|
5
|
+
You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
|
6
|
+
=end
|
7
|
+
|
8
|
+
module When
|
9
|
+
|
10
|
+
class BasicTypes::M17n
|
11
|
+
|
12
|
+
ChineseTerms = [self, [
|
13
|
+
"namespace:[en=http://en.wikipedia.org/wiki/, ja=http://ja.wikipedia.org/wiki/]",
|
14
|
+
"locale:[=ja:, en=en:, alias]",
|
15
|
+
"names:[ChineseTerms]",
|
16
|
+
"[中国太陽暦(節月)=ja:%E4%BA%8C%E5%8D%81%E5%9B%9B%E7%AF%80%E6%B0%97#.E6.9A.A6.E6.9C.88.E3.81.A8.E7.AF.80.E6.9C.88, *ChineseSolar=en:Solar_term]",
|
17
|
+
"[中国太陰太陽暦=ja:%E4%B8%AD%E5%9B%BD%E6%9A%A6, *ChineseLuniSolar=en:Chinese_calendar]",
|
18
|
+
"[彝暦=ja:%E3%82%A4%E6%97%8F, *Yi=en:Yi_people]",
|
19
|
+
|
20
|
+
[self,
|
21
|
+
"names:[月=ja:%E6%9C%88_(%E6%9A%A6), *Month]",
|
22
|
+
"[正月, 1st Month= ]",
|
23
|
+
"[二月, 2nd Month= ]",
|
24
|
+
"[三月, 3rd Month= ]",
|
25
|
+
"[四月, 4th Month= ]",
|
26
|
+
"[五月, 5th Month= ]",
|
27
|
+
"[六月, 6th Month= ]",
|
28
|
+
"[七月, 7th Month= ]",
|
29
|
+
"[八月, 8th Month= ]",
|
30
|
+
"[九月, 9th Month= ]",
|
31
|
+
"[十月, 10th Month=]",
|
32
|
+
"[十一月, 11th Month=]",
|
33
|
+
"[十二月, 12th Month=]"
|
34
|
+
],
|
35
|
+
|
36
|
+
[self,
|
37
|
+
"names:[月=ja:%E6%9C%88_(%E6%9A%A6), *MonthA]",
|
38
|
+
"[一月, 1st Month= ]",
|
39
|
+
"[二月, 2nd Month= ]",
|
40
|
+
"[三月, 3rd Month= ]",
|
41
|
+
"[四月, 4th Month= ]",
|
42
|
+
"[五月, 5th Month= ]",
|
43
|
+
"[六月, 6th Month= ]",
|
44
|
+
"[七月, 7th Month= ]",
|
45
|
+
"[八月, 8th Month= ]",
|
46
|
+
"[九月, 9th Month= ]",
|
47
|
+
"[十月, 10th Month=]",
|
48
|
+
"[正月, New Year Month=]",
|
49
|
+
"[臘月, 12th Month=]"
|
50
|
+
],
|
51
|
+
|
52
|
+
[self,
|
53
|
+
"names:[月=ja:%E6%9C%88_(%E6%9A%A6), *MonthB]",
|
54
|
+
"[建寅月, 3rd Month= ]",
|
55
|
+
"[建卯月, 4th Month= ]",
|
56
|
+
"[建辰月, 5th Month= ]",
|
57
|
+
"[建巳月, 6th Month= ]",
|
58
|
+
"[建午月, 7th Month= ]",
|
59
|
+
"[建未月, 8th Month= ]",
|
60
|
+
"[建申月, 9th Month= ]",
|
61
|
+
"[建酉月, 10th Month ]",
|
62
|
+
"[建戌月, 11th Month ]",
|
63
|
+
"[建亥月, 12th Month=]",
|
64
|
+
"[建子月, 1st Month= ]",
|
65
|
+
"[建丑月, 2nd Month= ]"
|
66
|
+
]
|
67
|
+
]]
|
68
|
+
|
69
|
+
YiTerms = [self, [
|
70
|
+
"namespace:[en=http://en.wikipedia.org/wiki/, ja=http://ja.wikipedia.org/wiki/]",
|
71
|
+
"locale:[=ja:, en=en:, alias]",
|
72
|
+
"names:[YiTerms]",
|
73
|
+
|
74
|
+
[self,
|
75
|
+
"names:[月=ja:%E6%9C%88_(%E6%9A%A6), *Month]",
|
76
|
+
"[木公月, 1st Month= ]",
|
77
|
+
"[木母月, 2nd Month= ]",
|
78
|
+
"[火公月, 3rd Month= ]",
|
79
|
+
"[火母月, 4th Month= ]",
|
80
|
+
"[土公月, 5th Month= ]",
|
81
|
+
"[土母月, 6th Month= ]",
|
82
|
+
"[銅公月, 7th Month= ]",
|
83
|
+
"[銅母月, 8th Month= ]",
|
84
|
+
"[水公月, 9th Month= ]",
|
85
|
+
"[水母月, 10th Month=]",
|
86
|
+
"[過年日, end of year days=]"
|
87
|
+
]
|
88
|
+
]]
|
89
|
+
end
|
90
|
+
|
91
|
+
module Coordinates
|
92
|
+
|
93
|
+
# Yi years
|
94
|
+
Yi = [When::BasicTypes::M17n, [
|
95
|
+
"namespace:[en=http://en.wikipedia.org/wiki/, ja=http://ja.wikipedia.org/wiki/]",
|
96
|
+
"locale:[=ja:, en=en:, alias]",
|
97
|
+
"names:[Yi]",
|
98
|
+
|
99
|
+
[Residue,
|
100
|
+
"label:[YearName]", "divisor:8", "year:0",
|
101
|
+
[Residue, "label:[東北之年=, NorthEastYear=]", "remainder: 0"],
|
102
|
+
[Residue, "label:[東方之年=, EastYear= ]", "remainder: 1"],
|
103
|
+
[Residue, "label:[東南之年=, SouthEastYear=]", "remainder: 2"],
|
104
|
+
[Residue, "label:[南方之年=, SouthYear= ]", "remainder: 3"],
|
105
|
+
[Residue, "label:[西南之年=, SouthWestYear=]", "remainder: 4"],
|
106
|
+
[Residue, "label:[西方之年=, WestYear= ]", "remainder: 5"],
|
107
|
+
[Residue, "label:[西北之年=, NorthWestYear=]", "remainder: 6"],
|
108
|
+
[Residue, "label:[北方之年=, NorthYear= ]", "remainder: 7"]
|
109
|
+
]
|
110
|
+
]]
|
111
|
+
end
|
112
|
+
|
113
|
+
module Ephemeris
|
114
|
+
|
115
|
+
#
|
116
|
+
# Chinese Luni-Solar Calendar Formula for True Lunation Type
|
117
|
+
#
|
118
|
+
class ChineseTrueLunation < MeanLunation
|
119
|
+
|
120
|
+
# 太陽の位置補正表
|
121
|
+
# @return [Array<Array< 入気定日加減数, 朓朒数, 損益率, 損益率増分 >>]
|
122
|
+
attr_reader :s
|
123
|
+
|
124
|
+
# 月の位置補正表
|
125
|
+
# @return [Array<Array< 区間の時間/分, 損益率 >>]
|
126
|
+
attr_reader :m
|
127
|
+
|
128
|
+
# 近点月
|
129
|
+
# @return [Numeric]
|
130
|
+
attr_reader :anomalistic_month_length
|
131
|
+
|
132
|
+
# 元期の近点離隔
|
133
|
+
# @return [Numeric]
|
134
|
+
attr_reader :anomalistic_month_shift
|
135
|
+
|
136
|
+
private
|
137
|
+
|
138
|
+
# 周期番号 -> 日時
|
139
|
+
#
|
140
|
+
# @param [Numeric] cn 周期番号
|
141
|
+
#
|
142
|
+
# @return [Numeric] ユリウス日
|
143
|
+
#
|
144
|
+
def cn_to_time_(cn, time0=nil)
|
145
|
+
time = super
|
146
|
+
return time unless @formula == '1L'
|
147
|
+
t = time - @day_epoch
|
148
|
+
time + (delta_s(t.divmod(@year_length)[1]) + delta_m(t.divmod(@anomalistic_month_length)[1])).to_r / @denominator
|
149
|
+
end
|
150
|
+
|
151
|
+
#
|
152
|
+
# 朔の日時の太陽運動の不斉による補正
|
153
|
+
#
|
154
|
+
# @param [Numeric] t 直前の冬至からの日数
|
155
|
+
#
|
156
|
+
# @return [Numeric] 補正量 / @denominator
|
157
|
+
#
|
158
|
+
def delta_s(t)
|
159
|
+
|
160
|
+
tt = t
|
161
|
+
|
162
|
+
t0, a, b, c = nil
|
163
|
+
@s.each do |v|
|
164
|
+
t0, a, b, c = v
|
165
|
+
break if t <= t0
|
166
|
+
t -= t0
|
167
|
+
end
|
168
|
+
|
169
|
+
# 24気からの日数 (大余, 小余)
|
170
|
+
t, dt = t.divmod(1)
|
171
|
+
dt = (dt * @denominator).to_i
|
172
|
+
|
173
|
+
# 損益率
|
174
|
+
b0 = (b + c * t).to_i
|
175
|
+
|
176
|
+
# 朓朒数
|
177
|
+
a0 = (a + b * t + c * t * (t-1.0)/2).to_i
|
178
|
+
|
179
|
+
# 補正値
|
180
|
+
a0 + (b0.to_f * dt / @denominator + 0.5).floor
|
181
|
+
end
|
182
|
+
|
183
|
+
#
|
184
|
+
# 朔の日時の月運動の不斉による補正
|
185
|
+
#
|
186
|
+
# @param [Numeric] t 直前の遠/近地点からの日数
|
187
|
+
#
|
188
|
+
# @return [Numeric] 補正量 / @denominator
|
189
|
+
#
|
190
|
+
def delta_m(t)
|
191
|
+
|
192
|
+
tt = t
|
193
|
+
|
194
|
+
t *= @denominator
|
195
|
+
a0 = b0 = t0 = 0
|
196
|
+
@m.each do |v|
|
197
|
+
t0, b0 = v
|
198
|
+
break if t <= t0
|
199
|
+
t -= t0
|
200
|
+
a0 += b0
|
201
|
+
end
|
202
|
+
|
203
|
+
# 補正値
|
204
|
+
a0 + (b0.to_f * t.to_i / t0.to_i + 0.5).floor
|
205
|
+
end
|
206
|
+
|
207
|
+
# オブジェクトの正規化
|
208
|
+
def _normalize(args=[], options={})
|
209
|
+
super
|
210
|
+
if @formula == '1L'
|
211
|
+
@anomalistic_month_length = @anomalistic_month_length.to_r
|
212
|
+
@anomalistic_month_shift = (@anomalistic_month_shift||0).to_r
|
213
|
+
(0...@s.size).each do |i|
|
214
|
+
@s[i-1][1,0] = @year_length / @s.size + (@s[i][0]-@s[i-1][0]) / @denominator
|
215
|
+
end
|
216
|
+
(0...@s.size).each do |i|
|
217
|
+
@s[i].shift
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
module CalendarTypes
|
225
|
+
|
226
|
+
#
|
227
|
+
# Chinese Solar Calendar
|
228
|
+
#
|
229
|
+
class ChineseSolar < EphemerisBasedSolar
|
230
|
+
|
231
|
+
private
|
232
|
+
|
233
|
+
# オブジェクトの正規化
|
234
|
+
#
|
235
|
+
# @formula = 太陽黄経の計算に用いるEphemeris
|
236
|
+
#
|
237
|
+
def _normalize(args=[], options={})
|
238
|
+
@label ||= When.Resource('_m:ChineseTerms::ChineseSolar')
|
239
|
+
@formula ||= ['Formula']
|
240
|
+
@formula = Array(@formula)
|
241
|
+
@formula *= 2 if @formula.length == 1
|
242
|
+
@formula[0] += (@formula[0] =~ /\?/ ? '&' : '?') + 'formula=12S' if @formula[0].kind_of?(String)
|
243
|
+
@formula[1] += (@formula[1] =~ /\?/ ? '&' : '?') + 'formula=1L' if @formula[1].kind_of?(String)
|
244
|
+
@timezone ||= 0
|
245
|
+
@note ||= When.CalendarNote('ChineseNotes')
|
246
|
+
@indices ||= [
|
247
|
+
When::Coordinates::Index.new({:trunk=>When.Resource('_m:ChineseTerms::Month::*')}),
|
248
|
+
When::Coordinates::Index.new
|
249
|
+
]
|
250
|
+
super
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
#
|
255
|
+
# Chinese Luni-Solar Calendar
|
256
|
+
#
|
257
|
+
class ChineseLuniSolar < EphemerisBasedLuniSolar
|
258
|
+
|
259
|
+
private
|
260
|
+
|
261
|
+
# オブジェクトの正規化
|
262
|
+
#
|
263
|
+
# @cycle_offset = 雨水の場合 -1
|
264
|
+
# @formula = 太陽黄経および月の位相の計算に用いるEphemeris
|
265
|
+
# @timezone[1] = 進朔量
|
266
|
+
#
|
267
|
+
def _normalize(args=[], options={})
|
268
|
+
@label ||= When.Resource('_m:ChineseTerms::ChineseLuniSolar')
|
269
|
+
@formula ||= ['Formula']
|
270
|
+
@formula = Array(@formula)
|
271
|
+
@formula *= 2 if @formula.length == 1
|
272
|
+
@formula[0] += (@formula[0] =~ /\?/ ? '&' : '?') + 'formula=12S' if @formula[0].kind_of?(String)
|
273
|
+
@formula[1] += (@formula[1] =~ /\?/ ? '&' : '?') + 'formula=1L' if @formula[1].kind_of?(String)
|
274
|
+
@vernal_month ||= 2
|
275
|
+
@cycle_offset ||= @vernal_month - 3
|
276
|
+
@base_month ||= 11
|
277
|
+
@intercalary_span ||= 12
|
278
|
+
@intercalary_span = @intercalary_span.to_i
|
279
|
+
@intercalary_month = (@intercalary_month.to_i - @base_month) % 12 + 1 if @intercalary_month
|
280
|
+
@timezone ||= 0
|
281
|
+
@note ||= When.CalendarNote('ChineseNotes')
|
282
|
+
@indices ||= [
|
283
|
+
When::Coordinates::Index.new({:branch=>{1=>When.Resource('_m:CalendarTerms::閏')},
|
284
|
+
:trunk=>When.Resource('_m:ChineseTerms::Month::*')}),
|
285
|
+
When::Coordinates::Index.new
|
286
|
+
]
|
287
|
+
super
|
288
|
+
end
|
289
|
+
|
290
|
+
# 正月の通月
|
291
|
+
#
|
292
|
+
# @param [Integer] y 年
|
293
|
+
#
|
294
|
+
# @return [Numeric] 正月の通月
|
295
|
+
#
|
296
|
+
def _new_year_month_(y)
|
297
|
+
return _base_month(y) if @base_month == 1
|
298
|
+
intercalary = 0
|
299
|
+
_ids([y-1]).each do |v|
|
300
|
+
unless v.branch == 0
|
301
|
+
intercalary = v.trunk
|
302
|
+
break
|
303
|
+
end
|
304
|
+
end
|
305
|
+
_base_month(y) - @base_month + (intercalary>=@base_month ? 14 : 13)
|
306
|
+
end
|
307
|
+
|
308
|
+
# 天正冬至月の通月
|
309
|
+
#
|
310
|
+
# @param [Integer] y 年
|
311
|
+
#
|
312
|
+
# @return [Numeric] 天正冬至月の通月
|
313
|
+
#
|
314
|
+
def _base_month_(y)
|
315
|
+
(Residue.mod((@formula[0].cn_to_time(12*(y-1) + @base_month - @vernal_month) +
|
316
|
+
0.5 + @timezone[0]).floor) {|m|
|
317
|
+
_new_month(m)
|
318
|
+
})[0]
|
319
|
+
end
|
320
|
+
|
321
|
+
# 暦年の翻訳表の取得
|
322
|
+
#
|
323
|
+
# @param [Array<Numeric>] date ( 年 )
|
324
|
+
#
|
325
|
+
# @return [When::Coordinates::Pair] 暦年の翻訳表
|
326
|
+
#
|
327
|
+
def _ids_(date)
|
328
|
+
y = +date[0]
|
329
|
+
return _base_ids(y) if @base_month == 1
|
330
|
+
(_base_ids(y).dup.delete_if {|v| v.trunk >= @base_month}) + (_base_ids(y+1).dup.delete_if {|v| v.trunk < @base_month})
|
331
|
+
end
|
332
|
+
|
333
|
+
# 天正冬至月から1年分の翻訳表の取得
|
334
|
+
#
|
335
|
+
# @param [Numeric] y 年
|
336
|
+
#
|
337
|
+
# @return [When::Coordinates::Pair]
|
338
|
+
# 天正冬至月から1年分の翻訳表
|
339
|
+
#
|
340
|
+
def _base_ids_(y)
|
341
|
+
_intercalary_pattern(y,12)[1..-1].inject([Pair._force_pair(@base_month, 0)]) do |base_ids, flag|
|
342
|
+
base_ids << (flag ? Pair._force_pair(base_ids[-1].trunk, 1) : Pair._force_pair(base_ids[-1].trunk % 12 + 1, 0))
|
343
|
+
end
|
344
|
+
end
|
345
|
+
|
346
|
+
# 天正冬至月から1年分の閏月のパターンの取得
|
347
|
+
#
|
348
|
+
# @param [Numeric] y 年
|
349
|
+
#
|
350
|
+
# @return [Boolean]
|
351
|
+
# [ true - 閏月である ]
|
352
|
+
# [ false - 閏月でない ]
|
353
|
+
#
|
354
|
+
def _intercalary_pattern(y, n)
|
355
|
+
m0 = _base_month(y)
|
356
|
+
m1 = _base_month(y + n/12.0)
|
357
|
+
return Array.new(n, false) if m1-m0 == n
|
358
|
+
return Array.new(n+1) {|i| i==@intercalary_month} if @intercalary_month # for 四分暦
|
359
|
+
return _intercalary_pattern(y, n/2) + _intercalary_pattern(y + n/24.0, n/2) if n > @intercalary_span
|
360
|
+
flags = Array.new(n+1, false)
|
361
|
+
n.times do |i|
|
362
|
+
m0 += 1
|
363
|
+
if _intercalary?(m0)
|
364
|
+
flags[i+1] = true
|
365
|
+
return flags
|
366
|
+
end
|
367
|
+
end
|
368
|
+
raise ArgumentError, "Intercalary month not found"
|
369
|
+
end
|
370
|
+
|
371
|
+
# 指定の月の中気の有無
|
372
|
+
#
|
373
|
+
# @param [Numeric] m 通月
|
374
|
+
#
|
375
|
+
# @return [Boolean]
|
376
|
+
# [ true - 中気無し ]
|
377
|
+
# [ false - 中気有り ]
|
378
|
+
#
|
379
|
+
def _intercalary?(m)
|
380
|
+
e = _new_month(m+1) - 1
|
381
|
+
d = Residue.mod(e) {|n| _new_epoch(n)}
|
382
|
+
e - d[1] < _new_month(m)
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
386
|
+
Chinese = [When::BasicTypes::M17n, [
|
387
|
+
"namespace:[en=http://en.wikipedia.org/wiki/, ja=http://ja.wikipedia.org/wiki/]",
|
388
|
+
"locale:[=ja:, en=en:, alias]",
|
389
|
+
"area:[中国,China]",
|
390
|
+
|
391
|
+
[ChineseLuniSolar,
|
392
|
+
'name:[黄帝暦]',
|
393
|
+
'formula:MeanLunation?year_length=1461/4&lunation_length=27759/940&day_epoch=1228331',
|
394
|
+
'intercalary_month:12'
|
395
|
+
],
|
396
|
+
|
397
|
+
[ChineseLuniSolar,
|
398
|
+
'name:[顓頊暦]',
|
399
|
+
'formula:MeanLunation?year_length=1461/4&lunation_length=27759/940&day_epoch=1171396&longitude_shift=-1/8',
|
400
|
+
'timezone:0,+12',
|
401
|
+
'intercalary_month:9'
|
402
|
+
],
|
403
|
+
|
404
|
+
[ChineseLuniSolar,
|
405
|
+
'name:[夏暦]',
|
406
|
+
'formula:MeanLunation?year_length=1461/4&lunation_length=27759/940&day_epoch=1328411',
|
407
|
+
'intercalary_month:12'
|
408
|
+
],
|
409
|
+
|
410
|
+
[ChineseLuniSolar,
|
411
|
+
'name:[殷暦]',
|
412
|
+
'formula:MeanLunation?year_length=1461/4&lunation_length=27759/940&day_epoch=1149071',
|
413
|
+
'intercalary_month:12'
|
414
|
+
],
|
415
|
+
|
416
|
+
[ChineseLuniSolar,
|
417
|
+
'name:[周暦]',
|
418
|
+
'formula:MeanLunation?year_length=1461/4&lunation_length=27759/940&day_epoch=1128251',
|
419
|
+
'intercalary_month:12'
|
420
|
+
],
|
421
|
+
|
422
|
+
[ChineseLuniSolar,
|
423
|
+
'name:[魯暦]',
|
424
|
+
'formula:MeanLunation?year_length=1461/4&lunation_length=27759/940&day_epoch=1048991',
|
425
|
+
'intercalary_month:12'
|
426
|
+
],
|
427
|
+
|
428
|
+
[ChineseLuniSolar,
|
429
|
+
'name:[太初暦]',
|
430
|
+
'formula:MeanLunation?year_length=562120/1539&lunation_length=2392/81&day_epoch=1683431'
|
431
|
+
],
|
432
|
+
|
433
|
+
[ChineseLuniSolar,
|
434
|
+
'name:[四分暦]',
|
435
|
+
'formula:MeanLunation?year_length=1461/4&lunation_length=27759/940&day_epoch=1662611'
|
436
|
+
],
|
437
|
+
|
438
|
+
[ChineseLuniSolar,
|
439
|
+
'name:[乾象暦]',
|
440
|
+
'formula:MeanLunation?year_length=215130/589&lunation_length=43026/1457&day_epoch=-898129'
|
441
|
+
],
|
442
|
+
|
443
|
+
[ChineseLuniSolar,
|
444
|
+
'name:[景初暦]',
|
445
|
+
'formula:MeanLunation?year_length=673150/1843&lunation_length=134630/4559&day_epoch=+330191'
|
446
|
+
],
|
447
|
+
|
448
|
+
[ChineseLuniSolar,
|
449
|
+
'name:[三紀暦]',
|
450
|
+
'formula:MeanLunation?year_length=895220/2451&lunation_length=179044/6063&day_epoch=-28760989'
|
451
|
+
],
|
452
|
+
|
453
|
+
[ChineseLuniSolar,
|
454
|
+
'name:[玄始暦]',
|
455
|
+
'formula:MeanLunation?year_length=2629759/7200&lunation_length=2629759/89052&day_epoch=-20568349'
|
456
|
+
],
|
457
|
+
|
458
|
+
[ChineseLuniSolar,
|
459
|
+
'name:[元嘉暦]',
|
460
|
+
'formula:MeanLunation?year_length=111035/304&lunation_length=22207/752&day_epoch=-200089&longitude_shift=-1/12' # 春分の1ヶ月前
|
461
|
+
],
|
462
|
+
|
463
|
+
[ChineseLuniSolar,
|
464
|
+
'name:[大明暦]',
|
465
|
+
'formula:MeanLunation?year_length=14423804/39491&lunation_length=116321/3939&day_epoch=-17080189'
|
466
|
+
],
|
467
|
+
|
468
|
+
[ChineseLuniSolar,
|
469
|
+
'name:[正光暦]',
|
470
|
+
'formula:MeanLunation?year_length=2213377/6060&lunation_length=2213377/74952&day_epoch=-59357929'
|
471
|
+
],
|
472
|
+
|
473
|
+
[ChineseLuniSolar,
|
474
|
+
'name:[興和暦]',
|
475
|
+
'formula:MeanLunation?year_length=6158017/16860&lunation_length=6158017/208530&day_epoch=-105462049'
|
476
|
+
],
|
477
|
+
|
478
|
+
[ChineseLuniSolar,
|
479
|
+
'name:[天保暦]',
|
480
|
+
'formula:MeanLunation?year_length=8641687/23660&lunation_length=8641687/292635&day_epoch=-38447089'
|
481
|
+
],
|
482
|
+
|
483
|
+
[ChineseLuniSolar,
|
484
|
+
'name:[天和暦]',
|
485
|
+
'formula:MeanLunation?year_length=8568631/23460&lunation_length=8568631/290160&day_epoch=-317950249'
|
486
|
+
],
|
487
|
+
|
488
|
+
[ChineseLuniSolar,
|
489
|
+
'name:[大象暦]',
|
490
|
+
'formula:MeanLunation?year_length=4745247/12992&lunation_length=1581749/53563&day_epoch=-13244449'
|
491
|
+
],
|
492
|
+
|
493
|
+
[ChineseLuniSolar,
|
494
|
+
'name:[開皇暦]',
|
495
|
+
'formula:MeanLunation?year_length=37605463/102960&lunation_length=5372209/181920&day_epoch=-1506155749'
|
496
|
+
],
|
497
|
+
|
498
|
+
[ChineseLuniSolar,
|
499
|
+
'name:[大業暦]',
|
500
|
+
'formula:MeanLunation?year_length=15573963/42640&lunation_length=33783/1144&day_epoch=-519493909'
|
501
|
+
],
|
502
|
+
|
503
|
+
[ChineseLuniSolar,
|
504
|
+
'name:[儀鳳暦]',
|
505
|
+
'formula:MeanLunation?year_length=122357/335&lunation_length=39571/1340&day_epoch=-96608689'
|
506
|
+
],
|
507
|
+
|
508
|
+
[ChineseLuniSolar,
|
509
|
+
'name:[麟徳暦]',
|
510
|
+
{'formula'=>['12S', '1L'].map {|f|
|
511
|
+
Ephemeris::ChineseTrueLunation.new({
|
512
|
+
'formula' => f,
|
513
|
+
'day_epoch' => -96608689,
|
514
|
+
'year_length' => '122357/335',
|
515
|
+
'lunation_length' => '39571/1340',
|
516
|
+
'anomalistic_month_length' => '443077/16080', # 27.0 + (743.0+1.0/12)/1340,
|
517
|
+
's' => [
|
518
|
+
[ 0.0, 0, +3.9546, -0.0372], # 冬至
|
519
|
+
[ -722.0, +54, +3.4091, -0.0372], # 大寒
|
520
|
+
[-1340.0, +100, +2.8636, -0.0372], # 小寒
|
521
|
+
[-1854.0, +138, +2.3181, +0.0372], # 立春
|
522
|
+
[-2368.0, +176, +2.8636, +0.0372], # 雨水
|
523
|
+
[-2986.0, +222, +3.4091, +0.0372], # 啓蟄
|
524
|
+
[-3708.0, +276, -3.7220, +0.0329], # 春分
|
525
|
+
[-2986.0, +222, -3.2086, +0.0329], # 清明
|
526
|
+
[-2368.0, +176, -2.6952, +0.0329], # 穀雨
|
527
|
+
[-1854.0, +138, -2.1818, -0.0329], # 立夏
|
528
|
+
[-1340.0, +100, -2.6952, -0.0329], # 小満
|
529
|
+
[ -722.0, +54, -3.2086, -0.0329], # 芒種
|
530
|
+
[ 0.0, 0, -3.7220, +0.0329], # 夏至
|
531
|
+
[ +722.0, -54, -3.2086, +0.0329], # 小暑
|
532
|
+
[+1340.0, -100, -2.6952, +0.0329], # 大暑
|
533
|
+
[+1854.0, -138, -2.1818, -0.0329], # 立秋
|
534
|
+
[+2368.0, -176, -2.6952, -0.0329], # 処暑
|
535
|
+
[+2986.0, -222, -3.2086, -0.0329], # 白露
|
536
|
+
[+3708.0, -276, +3.9546, -0.0372], # 秋分
|
537
|
+
[+2986.0, -222, +3.4091, -0.0372], # 寒露
|
538
|
+
[+2368.0, -176, +2.8636, -0.0372], # 霜降
|
539
|
+
[+1854.0, -138, +2.3181, +0.0372], # 立冬
|
540
|
+
[+1340.0, -100, +2.8636, +0.0372], # 小雪
|
541
|
+
[ +722.0, -54, +3.4091, +0.0372], # 大雪
|
542
|
+
],
|
543
|
+
'm' => [
|
544
|
+
[1340.0, -134], # 1日
|
545
|
+
[1340.0, -117], # 2日
|
546
|
+
[1340.0, -99], # 3日
|
547
|
+
[1340.0, -78], # 4日
|
548
|
+
[1340.0, -56], # 5日
|
549
|
+
[1340.0, -33], # 6日
|
550
|
+
[1191.0, -9], # 7日
|
551
|
+
[ 149.0, 0], # 7日
|
552
|
+
[1340.0, +14], # 8日
|
553
|
+
[1340.0, +38], # 9日
|
554
|
+
[1340.0, +62], # 10日
|
555
|
+
[1340.0, +85], # 11日
|
556
|
+
[1340.0, +104], # 12日
|
557
|
+
[1340.0, +121], # 13日
|
558
|
+
[1042.0, +102], # 14日
|
559
|
+
[ 298.0, +29], # 14日
|
560
|
+
[1340.0, +128], # 15日
|
561
|
+
[1340.0, +115], # 16日
|
562
|
+
[1340.0, +95], # 17日
|
563
|
+
[1340.0, +74], # 18日
|
564
|
+
[1340.0, +52], # 19日
|
565
|
+
[1340.0, +28], # 20日
|
566
|
+
[ 892.0, +4], # 21日
|
567
|
+
[ 448.0, 0], # 21日
|
568
|
+
[1340.0, -20], # 22日
|
569
|
+
[1340.0, -44], # 23日
|
570
|
+
[1340.0, -68], # 24日
|
571
|
+
[1340.0, -89], # 25日
|
572
|
+
[1340.0, -108], # 26日
|
573
|
+
[1340.0, -125], # 27日
|
574
|
+
[ 743.0+1.0/12, -71] # 28日
|
575
|
+
]
|
576
|
+
})
|
577
|
+
}}
|
578
|
+
],
|
579
|
+
|
580
|
+
[ChineseLuniSolar,
|
581
|
+
'name:[大衍暦]',
|
582
|
+
'timezone:0,+6',
|
583
|
+
{'formula'=>['12S', '1L'].map {|f|
|
584
|
+
Ephemeris::ChineseTrueLunation.new({
|
585
|
+
'formula' => f,
|
586
|
+
'day_epoch' => -35412747829,
|
587
|
+
'year_length' => '1110343/3040',
|
588
|
+
'lunation_length' => '89773/3040',
|
589
|
+
'anomalistic_month_length' => '6701279/243200', # 27.0 +(1685.0+79.0/80)/3040,
|
590
|
+
'anomalistic_month_shift' => '1/2',
|
591
|
+
's' => [
|
592
|
+
[ 0.0, 0, +13.4524, -0.1886], # 冬至
|
593
|
+
[-2353.0, +176, +10.5564, -0.1634], # 大寒
|
594
|
+
[-4198.0, +314, +8.0408, -0.1446], # 小寒
|
595
|
+
[-5588.0, +418, +5.8160, -0.1318], # 立春
|
596
|
+
[-6564.0, +491, +3.7987, -0.1240], # 雨水
|
597
|
+
[-7152.0, +535, +1.9265, -0.1240], # 啓蟄
|
598
|
+
[-7366.0, +551, -0.2048, -0.1178], # 春分
|
599
|
+
[-7152.0, +535, -1.9968, -0.1190], # 清明
|
600
|
+
[-6564.0, +491, -3.7956, -0.1240], # 穀雨
|
601
|
+
[-5588.0, +418, -5.6626, -0.1324], # 立夏
|
602
|
+
[-4198.0, +314, -7.6555, -0.1436], # 小満
|
603
|
+
[-2353.0, +176, -9.9405, -0.1436], # 芒種
|
604
|
+
[ 0.0, 0, -12.0819, +0.1436], # 夏至
|
605
|
+
[+2353.0, -176, -9.7018, +0.1324], # 小暑
|
606
|
+
[+4198.0, -314, -7.5450, +0.1240], # 大暑
|
607
|
+
[+5588.0, -418, -5.5634, +0.1190], # 立秋
|
608
|
+
[+6564.0, -491, -3.7038, +0.1178], # 処暑
|
609
|
+
[+7152.0, -535, -1.8954, +0.1178], # 白露
|
610
|
+
[+7366.0, -551, +0.1783, +0.1240], # 秋分
|
611
|
+
[+7152.0, -535, +2.0042, +0.1318], # 寒露
|
612
|
+
[+6564.0, -491, +3.8950, +0.1446], # 霜降
|
613
|
+
[+5588.0, -418, +5.9214, +0.1634], # 立冬
|
614
|
+
[+4198.0, -314, +8.1610, +0.1886], # 小雪
|
615
|
+
[+2353.0, -176, +10.9010, +0.1886], # 大雪
|
616
|
+
],
|
617
|
+
'm' => [
|
618
|
+
[3040.0, +297], # 1日
|
619
|
+
[3040.0, +259], # 2日
|
620
|
+
[3040.0, +220], # 3日
|
621
|
+
[3040.0, +180], # 4日
|
622
|
+
[3040.0, +139], # 5日
|
623
|
+
[3040.0, +97], # 6日
|
624
|
+
[2701.0, +48], # 7日
|
625
|
+
[ 339.0, -6], # 7日
|
626
|
+
[3040.0, -64], # 8日
|
627
|
+
[3040.0, -106], # 9日
|
628
|
+
[3040.0, -148], # 10日
|
629
|
+
[3040.0, -189], # 11日
|
630
|
+
[3040.0, -229], # 12日
|
631
|
+
[3040.0, -267], # 13日
|
632
|
+
[2363.0, -231], # 14日
|
633
|
+
[ 677.0, -66], # 14日
|
634
|
+
[3040.0, -289], # 15日
|
635
|
+
[3040.0, -250], # 16日
|
636
|
+
[3040.0, -211], # 17日
|
637
|
+
[3040.0, -171], # 18日
|
638
|
+
[3040.0, -130], # 19日
|
639
|
+
[3040.0, -87], # 20日
|
640
|
+
[2024.0, -36], # 21日
|
641
|
+
[1016.0, +18], # 21日
|
642
|
+
[3040.0, +73], # 22日
|
643
|
+
[3040.0, +116], # 23日
|
644
|
+
[3040.0, +157], # 24日
|
645
|
+
[3040.0, +198], # 25日
|
646
|
+
[3040.0, +237], # 26日
|
647
|
+
[3040.0, +276], # 27日
|
648
|
+
[1686.0, +165] # 28日
|
649
|
+
]
|
650
|
+
})
|
651
|
+
}}
|
652
|
+
],
|
653
|
+
|
654
|
+
[ChineseLuniSolar,
|
655
|
+
'name:[五紀暦]',
|
656
|
+
'timezone:0,+6',
|
657
|
+
{'formula'=>['12S', '1L'].map {|f|
|
658
|
+
Ephemeris::ChineseTrueLunation.new({
|
659
|
+
'formula' => f,
|
660
|
+
'day_epoch' => -96608689,
|
661
|
+
'year_length' => '122357/335',
|
662
|
+
'lunation_length' => '39571/1340',
|
663
|
+
'anomalistic_month_length' => '1366156/49580', # 27.0 + (743.0+5.0/37)/1340,
|
664
|
+
's' => [
|
665
|
+
[ 0.0, 0, +5.9668, -0.0843], # 冬至
|
666
|
+
[-1037.0, +78, +4.6652, -0.0721], # 大寒
|
667
|
+
[-1850.0, +139, +3.5656, -0.0653], # 小寒
|
668
|
+
[-2463.0, +185, +2.5583, -0.0590], # 立春
|
669
|
+
[-2893.0, +217, +1.6375, -0.0532], # 雨水
|
670
|
+
[-3152.0, +236, +0.8384, -0.0532], # 啓蟄
|
671
|
+
[-3246.0, +243, -0.0972, -0.0505], # 春分
|
672
|
+
[-3152.0, +236, -0.8480, -0.0534], # 清明
|
673
|
+
[-2893.0, +217, -1.6517, -0.0561], # 穀雨
|
674
|
+
[-2463.0, +185, -2.5057, -0.0584], # 立夏
|
675
|
+
[-1850.0, +139, -3.3781, -0.0643], # 小満
|
676
|
+
[-1037.0, +78, -4.3954, -0.0643], # 芒種
|
677
|
+
[ 0.0, 0, -5.3592, +0.0643], # 夏至
|
678
|
+
[+1037.0, -78, -4.2877, +0.0584], # 小暑
|
679
|
+
[+1850.0, -139, -3.3459, +0.0561], # 大暑
|
680
|
+
[+2463.0, -185, -2.4475, +0.0534], # 立秋
|
681
|
+
[+2893.0, -217, -1.5966, +0.0505], # 処暑
|
682
|
+
[+3152.0, -236, -0.8185, +0.0505], # 白露
|
683
|
+
[+3246.0, -243, +0.0858, +0.0532], # 秋分
|
684
|
+
[+3152.0, -236, +0.8505, +0.0590], # 寒露
|
685
|
+
[+2893.0, -217, +1.6943, +0.0653], # 霜降
|
686
|
+
[+2463.0, -185, +2.6205, +0.0721], # 立冬
|
687
|
+
[+1850.0, -139, +3.6007, +0.0843], # 小雪
|
688
|
+
[+1037.0, -78, +4.8330, +0.0843], # 大雪
|
689
|
+
],
|
690
|
+
'm' => [
|
691
|
+
[1340.0, -135], # 1日
|
692
|
+
[1340.0, -117], # 2日
|
693
|
+
[1340.0, -99], # 3日
|
694
|
+
[1340.0, -78], # 4日
|
695
|
+
[1340.0, -56], # 5日
|
696
|
+
[1340.0, -33], # 6日
|
697
|
+
[1191.0, -8], # 7日
|
698
|
+
[ 149.0, +1], # 7日
|
699
|
+
[1340.0, +14], # 8日
|
700
|
+
[1340.0, +38], # 9日
|
701
|
+
[1340.0, +62], # 10日
|
702
|
+
[1340.0, +85], # 11日
|
703
|
+
[1340.0, +103], # 12日
|
704
|
+
[1340.0, +118], # 13日
|
705
|
+
[1042.0, +105], # 14日
|
706
|
+
[ 298.0, +30], # 14日
|
707
|
+
[1340.0, +128], # 15日
|
708
|
+
[1340.0, +115], # 16日
|
709
|
+
[1340.0, +95], # 17日
|
710
|
+
[1340.0, +74], # 18日
|
711
|
+
[1340.0, +52], # 19日
|
712
|
+
[1340.0, +28], # 20日
|
713
|
+
[ 892.0, +6], # 21日
|
714
|
+
[ 448.0, -3], # 21日
|
715
|
+
[1340.0, -20], # 22日
|
716
|
+
[1340.0, -42], # 23日
|
717
|
+
[1340.0, -65], # 24日
|
718
|
+
[1340.0, -89], # 25日
|
719
|
+
[1340.0, -109], # 26日
|
720
|
+
[1340.0, -125], # 27日
|
721
|
+
[ 743.0+5.0/37, -75] # 28日
|
722
|
+
]
|
723
|
+
})
|
724
|
+
}}
|
725
|
+
],
|
726
|
+
|
727
|
+
[ChineseLuniSolar,
|
728
|
+
'name:[宣明暦]',
|
729
|
+
'timezone:0,+6',
|
730
|
+
{'formula'=>['12S', '1L'].map {|f|
|
731
|
+
Ephemeris::ChineseTrueLunation.new({
|
732
|
+
'formula' => f,
|
733
|
+
'day_epoch' => -2580308749,
|
734
|
+
'year_length' => '3068055/8400',
|
735
|
+
'lunation_length' => '248057/8400',
|
736
|
+
'anomalistic_month_length' => '23145819/840000', # 27.0 + 4658.19 / 8400,
|
737
|
+
'anomalistic_month_shift' => '1/2',
|
738
|
+
's' => [
|
739
|
+
[ 0.0, 0, +33.4511, -0.3695], # 冬至
|
740
|
+
[ -6000.0, +449, +28.0389, -0.3606], # 大寒
|
741
|
+
[-11000.0, +823, +22.6998, -0.3519], # 小寒
|
742
|
+
[-15000.0, +1122, +17.8923, -0.4068], # 立春
|
743
|
+
[-18000.0, +1346, +11.7966, -0.3998], # 雨水
|
744
|
+
[-19800.0, +1481, +5.7986, -0.3998], # 啓蟄
|
745
|
+
[-20400.0, +1526, -0.2433, -0.3779], # 春分
|
746
|
+
[-19800.0, +1481, -6.1254, -0.3634], # 清明
|
747
|
+
[-18000.0, +1346, -12.2048, -0.2987], # 穀雨
|
748
|
+
[-15000.0, +1122, -16.9060, -0.2919], # 立夏
|
749
|
+
[-11000.0, +823, -21.5362, -0.2854], # 小満
|
750
|
+
[ -6000.0, +449, -26.0498, -0.2854], # 芒種
|
751
|
+
[ 0.0, 0, -30.3119, +0.2854], # 夏至
|
752
|
+
[ +6000.0, -449, -25.8126, +0.2919], # 小暑
|
753
|
+
[+11000.0, -823, -21.2454, +0.2987], # 大暑
|
754
|
+
[+15000.0, -1122, -17.0296, +0.3634], # 立秋
|
755
|
+
[+18000.0, -1346, -11.4744, +0.3779], # 処暑
|
756
|
+
[+19800.0, -1481, -5.6429, +0.3779], # 白露
|
757
|
+
[+20400.0, -1526, +0.1432, +0.3998], # 秋分
|
758
|
+
[+19800.0, -1481, +6.1488, +0.4068], # 寒露
|
759
|
+
[+18000.0, -1346, +12.6336, +0.3519], # 霜降
|
760
|
+
[+15000.0, -1122, +17.8043, +0.3606], # 立冬
|
761
|
+
[+11000.0, -823, +23.0590, +0.3695], # 小雪
|
762
|
+
[ +6000.0, -449, +28.4618, +0.3695], # 大雪
|
763
|
+
],
|
764
|
+
'm' => [
|
765
|
+
[ 8400.0, +830], # 進1日
|
766
|
+
[ 8400.0, +726], # 2日
|
767
|
+
[ 8400.0, +606], # 3日
|
768
|
+
[ 8400.0, +471], # 4日
|
769
|
+
[ 8400.0, +337], # 5日
|
770
|
+
[ 8400.0, +202], # 6日
|
771
|
+
[ 7465.0, +53], # 7日
|
772
|
+
[ 935.0, -7], # 7日
|
773
|
+
[ 8400.0, -82], # 8日
|
774
|
+
[ 8400.0, -224], # 9日
|
775
|
+
[ 8400.0, -366], # 10日
|
776
|
+
[ 8400.0, -509], # 11日
|
777
|
+
[ 8400.0, -643], # 12日
|
778
|
+
[ 8400.0, -748], # 13日
|
779
|
+
[ 6529.095, -646], # 14日
|
780
|
+
[ 8400.0, -830], # 退1日
|
781
|
+
[ 8400.0, -726], # 2日
|
782
|
+
[ 8400.0, -598], # 3日
|
783
|
+
[ 8400.0, -464], # 4日
|
784
|
+
[ 8400.0, -329], # 5日
|
785
|
+
[ 8400.0, -195], # 6日
|
786
|
+
[ 7465.0, -53], # 7日
|
787
|
+
[ 935.0, +7], # 7日
|
788
|
+
[ 8400.0, +82], # 8日
|
789
|
+
[ 8400.0, +225], # 9日
|
790
|
+
[ 8400.0, +366], # 10日
|
791
|
+
[ 8400.0, +501], # 11日
|
792
|
+
[ 8400.0, +628], # 12日
|
793
|
+
[ 8400.0, +740], # 13日
|
794
|
+
[ 6529.095, +646] # 14日
|
795
|
+
]
|
796
|
+
})
|
797
|
+
}}
|
798
|
+
],
|
799
|
+
|
800
|
+
[ChineseSolar,
|
801
|
+
'name:[前貞享暦(節月)]',
|
802
|
+
'formula:VariableYearLengthMethod?day_epoch=2336118.675000&year_epoch=1684&year_length=365.241696&year_delta=1'
|
803
|
+
],
|
804
|
+
|
805
|
+
[ChineseSolar,
|
806
|
+
'name:[貞享暦(節月)]',
|
807
|
+
'formula:VariableYearLengthMethod?day_epoch=2336118.689990&year_epoch=1684&year_length=365.241696&year_delta=1'
|
808
|
+
],
|
809
|
+
|
810
|
+
[ChineseSolar,
|
811
|
+
'name:[前々宝暦暦(節月)]',
|
812
|
+
'formula:VariableYearLengthMethod?day_epoch=2336118.903800&year_epoch=1684&year_length=365.241696&year_delta=1'
|
813
|
+
],
|
814
|
+
|
815
|
+
[ChineseSolar,
|
816
|
+
'name:[前宝暦暦(節月)]',
|
817
|
+
'formula:VariableYearLengthMethod?day_epoch=2336118.622300&year_epoch=1684&year_length=365.241696&year_delta=1'
|
818
|
+
],
|
819
|
+
|
820
|
+
[ChineseSolar,
|
821
|
+
'name:[宝暦暦(節月)]',
|
822
|
+
'formula:VariableYearLengthMethod?day_epoch=2336118.622100&year_epoch=1684&year_length=365.241696&year_delta=1'
|
823
|
+
],
|
824
|
+
|
825
|
+
[ChineseSolar,
|
826
|
+
'name:[修正宝暦暦(節月)]',
|
827
|
+
'formula:VariableYearLengthMethod?day_epoch=2336118.762200&year_epoch=1684&year_length=365.241766&year_delta=1'
|
828
|
+
],
|
829
|
+
|
830
|
+
[ChineseSolar,
|
831
|
+
'name:[寛政暦(節月)]',
|
832
|
+
'formula:VariableYearLengthMethod?day_epoch=2336118.720200&year_epoch=1684&year_length=365.242360&year_delta=0'
|
833
|
+
]
|
834
|
+
].inject([]) {|list, cal|
|
835
|
+
if cal.kind_of?(Array) && cal[0] == ChineseLuniSolar
|
836
|
+
twin = cal.dup
|
837
|
+
twin[0..1] = [ChineseSolar, cal[1].sub(/\]/, '(節月)]')]
|
838
|
+
list << cal << twin
|
839
|
+
else
|
840
|
+
list << cal
|
841
|
+
end
|
842
|
+
}]
|
843
|
+
|
844
|
+
#
|
845
|
+
# 太平天国 2.1.1-3.2.30
|
846
|
+
#
|
847
|
+
TenrekiA = [CyclicTableBased, {
|
848
|
+
'origin_of_LSC' => 2397523,
|
849
|
+
'origin_of_MSC' => 1852,
|
850
|
+
'indices' => [
|
851
|
+
When::Coordinates::Index.new({:unit =>12, :trunk=>When.Resource('_m:ChineseTerms::Month::*')}),
|
852
|
+
When::Coordinates::Index.new
|
853
|
+
],
|
854
|
+
'rule_table' => {
|
855
|
+
'T' => {'Rule' =>[365]},
|
856
|
+
365 => {'Length'=>[31,30]*5 + [30]*2}
|
857
|
+
}
|
858
|
+
}]
|
859
|
+
|
860
|
+
#
|
861
|
+
# 太平天国 3.3.1-
|
862
|
+
#
|
863
|
+
TenrekiB = [CyclicTableBased, {
|
864
|
+
'origin_of_LSC' => 2397522,
|
865
|
+
'origin_of_MSC' => 1852,
|
866
|
+
'indices' => [
|
867
|
+
When::Coordinates::Index.new({:unit =>12, :trunk=>When.Resource('_m:ChineseTerms::Month::*')}),
|
868
|
+
When::Coordinates::Index.new({:shift => 1})
|
869
|
+
],
|
870
|
+
'rule_table' => {
|
871
|
+
'T' => {'Rule' =>[366]},
|
872
|
+
366 => {'Length'=>[31,30]*6}
|
873
|
+
},
|
874
|
+
'note' => 'DefaultNotes'
|
875
|
+
}]
|
876
|
+
|
877
|
+
#
|
878
|
+
# 彝
|
879
|
+
#
|
880
|
+
Yi = [CyclicTableBased, {
|
881
|
+
'label' => When.Resource('_m:ChineseTerms::Yi'),
|
882
|
+
'origin_of_LSC' => 1721431,
|
883
|
+
'origin_of_MSC' => 1,
|
884
|
+
'indices' => [
|
885
|
+
When::Coordinates::Index.new({:unit =>11, :trunk=>When.Resource('_m:YiTerms::Month::*')}),
|
886
|
+
When::Coordinates::Index.new
|
887
|
+
],
|
888
|
+
'rule_table' => {
|
889
|
+
'T' => {'Rule' =>[365, 365, 365, 366]},
|
890
|
+
365 => {'Length'=>[36]*10 + [5]},
|
891
|
+
366 => {'Length'=>[36]*10 + [6]}
|
892
|
+
},
|
893
|
+
'note' => 'YiNotes'
|
894
|
+
}]
|
895
|
+
end
|
896
|
+
end
|