mk_calendar 0.2.8 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +18 -22
- data/exe/mk_calendar +5 -4
- data/lib/mk_calendar/calendar.rb +4 -4
- data/lib/mk_calendar/compute.rb +14 -14
- data/lib/mk_calendar/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68ad1bdf744dcdcfefa895c339f8b04dff417700
|
4
|
+
data.tar.gz: 4152d0bb721349c84df811fc65a51d674436a34d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31ac7d54213e102d1f859337a72567996f4a3c85dafc3bfac9c2b5b890fa4c6257773dbf015faa24a888bfe4527c69507664e2d60c4aaad549a1780dc56886a4
|
7
|
+
data.tar.gz: 581ce65f6a573648963457099c3ed05168edac0cb3c3acce634808e5ad9c1fdf11d1323d9f9254729c1e8155d78c74f761934c75ee5574793aa461162db5f244
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ This is the gem library which calculates calendar datas, including old-calendar.
|
|
7
7
|
### Computable items
|
8
8
|
|
9
9
|
julian day(utc), julian day(jst), holiday, sekki_24, zassetsu,
|
10
|
-
yobi, kanshi, sekku,
|
10
|
+
yobi, kanshi, sekku, lambda(sun), alpha(moon), moonage,
|
11
11
|
old-calendar(year, month, day, leap flag), rokuyo
|
12
12
|
|
13
13
|
### Original Text
|
@@ -40,30 +40,26 @@ Or install it yourself as:
|
|
40
40
|
|
41
41
|
### Instantiation
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
obj = MkCalendar.new("20160608")
|
50
|
-
```
|
43
|
+
require 'mk_calendar'
|
44
|
+
|
45
|
+
obj = MkCalendar.new
|
46
|
+
|
47
|
+
# Otherwise
|
48
|
+
obj = MkCalendar.new("20160608")
|
51
49
|
|
52
50
|
### Calculation
|
53
51
|
|
54
|
-
|
55
|
-
p o.
|
56
|
-
p o.
|
57
|
-
p o.
|
58
|
-
p o.
|
59
|
-
p o.
|
60
|
-
p o.
|
61
|
-
p o.
|
62
|
-
p o.
|
63
|
-
p o.
|
64
|
-
p o.
|
65
|
-
p o.oc # <= [year, leap_flag, month, day]
|
66
|
-
```
|
52
|
+
p o.year, o.month, o.day, o.jd, o.jd_jst
|
53
|
+
p o.holiday
|
54
|
+
p o.sekki_24
|
55
|
+
p o.zassetsu
|
56
|
+
p o.yobi
|
57
|
+
p o.kanshi
|
58
|
+
p o.sekku
|
59
|
+
p o.lambda
|
60
|
+
p o.alpha
|
61
|
+
p o.moonage
|
62
|
+
p o.oc # <= [year, leap_flag, month, day]
|
67
63
|
|
68
64
|
## Development
|
69
65
|
|
data/exe/mk_calendar
CHANGED
@@ -17,16 +17,17 @@ exit unless o
|
|
17
17
|
#p o.moonage
|
18
18
|
#p o.oc
|
19
19
|
|
20
|
+
oc = o.oc
|
20
21
|
str = sprintf("%04d-%02d-%02d", o.year, o.month, o.day)
|
21
22
|
str << " #{o.yobi}曜日"
|
22
23
|
str << " #{o.holiday}" unless o.holiday == ""
|
23
24
|
str << " #{o.jd}UTC(#{o.jd_jst}JST) #{o.kanshi} "
|
24
|
-
str << sprintf("%04d-%02d-%02d",
|
25
|
-
str << "(閏)" if
|
26
|
-
str << " #{
|
25
|
+
str << sprintf("%04d-%02d-%02d", oc[0], oc[2], oc[3])
|
26
|
+
str << "(閏)" if oc[1] == 1
|
27
|
+
str << " #{oc[4]}"
|
27
28
|
str << " #{o.sekki_24}" unless o.sekki_24 == ""
|
28
29
|
str << " #{o.zassetsu}" unless o.zassetsu == ""
|
29
30
|
str << " #{o.sekku}" unless o.sekku == ""
|
30
|
-
str << " #{o.
|
31
|
+
str << " #{o.lambda} #{o.alpha} #{o.moonage}"
|
31
32
|
puts str
|
32
33
|
|
data/lib/mk_calendar/calendar.rb
CHANGED
@@ -57,15 +57,15 @@ module MkCalendar
|
|
57
57
|
#=========================================================================
|
58
58
|
# 視黄経(太陽)
|
59
59
|
#=========================================================================
|
60
|
-
def
|
61
|
-
return
|
60
|
+
def lambda
|
61
|
+
return compute_lambda(@jd_jst)
|
62
62
|
end
|
63
63
|
|
64
64
|
#=========================================================================
|
65
65
|
# 視黄経(月)
|
66
66
|
#=========================================================================
|
67
|
-
def
|
68
|
-
return
|
67
|
+
def alpha
|
68
|
+
return compute_alpha(@jd_jst)
|
69
69
|
end
|
70
70
|
|
71
71
|
#=========================================================================
|
data/lib/mk_calendar/compute.rb
CHANGED
@@ -133,8 +133,8 @@ module MkCalendar
|
|
133
133
|
# @return: sekki_24 (二十四節気の文字列)
|
134
134
|
#=========================================================================
|
135
135
|
def compute_sekki_24(jd)
|
136
|
-
lsun_today =
|
137
|
-
lsun_tomorrow =
|
136
|
+
lsun_today = compute_lambda(jd)
|
137
|
+
lsun_tomorrow = compute_lambda(jd + 1)
|
138
138
|
lsun_today0 = 15 * (lsun_today / 15.0).truncate
|
139
139
|
lsun_tomorrow0 = 15 * (lsun_tomorrow / 15.0).truncate
|
140
140
|
return lsun_today0 == lsun_tomorrow0 ? "" : Const::SEKKI_24[lsun_tomorrow0 / 15]
|
@@ -150,17 +150,17 @@ module MkCalendar
|
|
150
150
|
zassetsu = Array.new
|
151
151
|
|
152
152
|
# 計算対象日の太陽の黄経
|
153
|
-
lsun_today =
|
153
|
+
lsun_today = compute_lambda(jd)
|
154
154
|
# 計算対象日の翌日の太陽の黄経
|
155
|
-
lsun_tomorrow =
|
155
|
+
lsun_tomorrow = compute_lambda(jd + 1)
|
156
156
|
# 計算対象日の5日前の太陽の黄経(社日計算用)
|
157
|
-
lsun_before_5 =
|
157
|
+
lsun_before_5 = compute_lambda(jd - 5)
|
158
158
|
# 計算対象日の4日前の太陽の黄経(社日計算用)
|
159
|
-
lsun_before_4 =
|
159
|
+
lsun_before_4 = compute_lambda(jd - 4)
|
160
160
|
# 計算対象日の5日後の太陽の黄経(社日計算用)
|
161
|
-
lsun_after_5 =
|
161
|
+
lsun_after_5 = compute_lambda(jd + 5)
|
162
162
|
# 計算対象日の6日後の太陽の黄経(社日計算用)
|
163
|
-
lsun_after_6 =
|
163
|
+
lsun_after_6 = compute_lambda(jd + 6)
|
164
164
|
# 太陽の黄経の整数部分( 土用, 入梅, 半夏生 計算用 )
|
165
165
|
lsun_today0 = lsun_today.truncate
|
166
166
|
lsun_tomorrow0 = lsun_tomorrow.truncate
|
@@ -332,7 +332,7 @@ module MkCalendar
|
|
332
332
|
# @param: jd (ユリウス日(JST))
|
333
333
|
# @return: lambda
|
334
334
|
#=========================================================================
|
335
|
-
def
|
335
|
+
def compute_lambda(jd)
|
336
336
|
year, month, day, hour, min, sec = jd2ymd(jd - Const::JST_D)
|
337
337
|
dt = compute_dt(year, month, day) # deltaT
|
338
338
|
jy = (jd - Const::JST_D + dt / 86400.0 - 2451545.0) / 365.25 # Julian Year
|
@@ -365,7 +365,7 @@ module MkCalendar
|
|
365
365
|
# @param: jd (ユリウス日(JST))
|
366
366
|
# @return: lambda
|
367
367
|
#=========================================================================
|
368
|
-
def
|
368
|
+
def compute_alpha(jd)
|
369
369
|
year, month, day, hour, min, sec = jd2ymd(jd - Const::JST_D)
|
370
370
|
dt = compute_dt(year, month, day) # deltaT
|
371
371
|
jy = (jd - Const::JST_D + dt / 86400.0 - 2451545.0) / 365.25 # Julian Year
|
@@ -669,7 +669,7 @@ module MkCalendar
|
|
669
669
|
tm2 -= Const::JST_D
|
670
670
|
|
671
671
|
# 直前の二分二至の黄経 λsun0 を求める
|
672
|
-
rm_sun =
|
672
|
+
rm_sun = compute_lambda(jd + 0.5)
|
673
673
|
rm_sun0 = kbn * (rm_sun / kbn.to_f).truncate
|
674
674
|
|
675
675
|
# 繰り返し計算によって直前の二分二至の時刻を計算する
|
@@ -678,7 +678,7 @@ module MkCalendar
|
|
678
678
|
while (delta_t1 + delta_t2).abs > (1.0 / 86400.0)
|
679
679
|
# λsun を計算
|
680
680
|
t = tm1 + tm2 + Const::JST_D + 0.5
|
681
|
-
rm_sun =
|
681
|
+
rm_sun = compute_lambda(t)
|
682
682
|
|
683
683
|
# 黄経差 Δλ=λsun -λsun0
|
684
684
|
delta_rm = rm_sun - rm_sun0
|
@@ -751,8 +751,8 @@ module MkCalendar
|
|
751
751
|
while (delta_t1 + delta_t2).abs > (1.0 / 86400.0)
|
752
752
|
# 太陽の黄経λsun ,月の黄経λmoon を計算
|
753
753
|
t = tm1 + tm2 + Const::JST_D + 0.5
|
754
|
-
rm_sun =
|
755
|
-
rm_moon =
|
754
|
+
rm_sun = compute_lambda(t)
|
755
|
+
rm_moon = compute_alpha(t)
|
756
756
|
# 月と太陽の黄経差Δλ
|
757
757
|
# Δλ=λmoon-λsun
|
758
758
|
delta_rm = rm_moon - rm_sun
|
data/lib/mk_calendar/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mk_calendar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- komasaru
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mk_time
|