mk_calendar 0.2.8 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c9771070413970572ce4a5e2029afc10085208a
4
- data.tar.gz: c495adcfa35c922922e3a19e4f65619dfc23e14e
3
+ metadata.gz: 68ad1bdf744dcdcfefa895c339f8b04dff417700
4
+ data.tar.gz: 4152d0bb721349c84df811fc65a51d674436a34d
5
5
  SHA512:
6
- metadata.gz: 4c44d5d22849c1fd2b4f3d042ced2b23689f00e93a63703bd81bb6644b37e31519e9b77f28d9707463a941f8382f1c578b1db9e80ea8fca874faca6e071df3c0
7
- data.tar.gz: b145f855bfb43fc779544970b73fa519ab6733d3ed895af8b72dad638648db1d83e539d4a8858be7853adffd0c90e656128c52f7841e735880057f007bd9e94e
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, lambda_sun, lambda_moon, moonage,
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
- ``` ruby
44
- require 'mk_calendar'
45
-
46
- obj = MkCalendar.new
47
-
48
- # Otherwise
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
- ``` ruby
55
- p o.year, o.month, o.day, o.jd, o.jd_jst
56
- p o.holiday
57
- p o.sekki_24
58
- p o.zassetsu
59
- p o.yobi
60
- p o.kanshi
61
- p o.sekku
62
- p o.lambda_sun
63
- p o.lambda_moon
64
- p o.moonage
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", o.oc[0], o.oc[2], o.oc[3])
25
- str << "(閏)" if o.oc[1] == 1
26
- str << " #{o.oc[4]}"
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.lambda_sun} #{o.lambda_moon} #{o.moonage}"
31
+ str << " #{o.lambda} #{o.alpha} #{o.moonage}"
31
32
  puts str
32
33
 
@@ -57,15 +57,15 @@ module MkCalendar
57
57
  #=========================================================================
58
58
  # 視黄経(太陽)
59
59
  #=========================================================================
60
- def lambda_sun
61
- return compute_lambda_sun(@jd_jst)
60
+ def lambda
61
+ return compute_lambda(@jd_jst)
62
62
  end
63
63
 
64
64
  #=========================================================================
65
65
  # 視黄経(月)
66
66
  #=========================================================================
67
- def lambda_moon
68
- return compute_lambda_moon(@jd_jst)
67
+ def alpha
68
+ return compute_alpha(@jd_jst)
69
69
  end
70
70
 
71
71
  #=========================================================================
@@ -133,8 +133,8 @@ module MkCalendar
133
133
  # @return: sekki_24 (二十四節気の文字列)
134
134
  #=========================================================================
135
135
  def compute_sekki_24(jd)
136
- lsun_today = compute_lambda_sun(jd)
137
- lsun_tomorrow = compute_lambda_sun(jd + 1)
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 = compute_lambda_sun(jd)
153
+ lsun_today = compute_lambda(jd)
154
154
  # 計算対象日の翌日の太陽の黄経
155
- lsun_tomorrow = compute_lambda_sun(jd + 1)
155
+ lsun_tomorrow = compute_lambda(jd + 1)
156
156
  # 計算対象日の5日前の太陽の黄経(社日計算用)
157
- lsun_before_5 = compute_lambda_sun(jd - 5)
157
+ lsun_before_5 = compute_lambda(jd - 5)
158
158
  # 計算対象日の4日前の太陽の黄経(社日計算用)
159
- lsun_before_4 = compute_lambda_sun(jd - 4)
159
+ lsun_before_4 = compute_lambda(jd - 4)
160
160
  # 計算対象日の5日後の太陽の黄経(社日計算用)
161
- lsun_after_5 = compute_lambda_sun(jd + 5)
161
+ lsun_after_5 = compute_lambda(jd + 5)
162
162
  # 計算対象日の6日後の太陽の黄経(社日計算用)
163
- lsun_after_6 = compute_lambda_sun(jd + 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 compute_lambda_sun(jd)
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 compute_lambda_moon(jd)
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 = compute_lambda_sun(jd + 0.5)
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 = compute_lambda_sun(t)
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 = compute_lambda_sun(t)
755
- rm_moon = compute_lambda_moon(t)
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
@@ -1,3 +1,3 @@
1
1
  module MkCalendar
2
- VERSION = "0.2.8"
2
+ VERSION = "0.3.0"
3
3
  end
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.2.8
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-07-27 00:00:00.000000000 Z
11
+ date: 2016-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mk_time