equationoftime 3.0.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (251) hide show
  1. checksums.yaml +4 -4
  2. data/.buildpath +5 -0
  3. data/.project +17 -0
  4. data/.rvmrc +1 -0
  5. data/.settings/org.eclipse.ltk.core.refactoring.prefs +2 -0
  6. data/Makefile +238 -0
  7. data/Rakefile +40 -3
  8. data/analemma_data.yml +2925 -0
  9. data/equationoftime.gemspec +6 -3
  10. data/examples/analemma_data_generator.rb +12 -12
  11. data/examples/celes_parts/.RUBYARCHDIR.time +0 -0
  12. data/examples/celes_parts/.cproject +56 -0
  13. data/examples/celes_parts/.project +78 -0
  14. data/examples/celes_parts/a2af.c +120 -0
  15. data/examples/celes_parts/a2tf.c +116 -0
  16. data/examples/celes_parts/af2a.c +107 -0
  17. data/examples/celes_parts/anp.c +82 -0
  18. data/examples/celes_parts/anpm.c +82 -0
  19. data/examples/celes_parts/bi00.c +116 -0
  20. data/examples/celes_parts/bp00.c +173 -0
  21. data/examples/celes_parts/bp06.c +136 -0
  22. data/examples/celes_parts/bpn2xy.c +100 -0
  23. data/examples/celes_parts/c2i00a.c +139 -0
  24. data/examples/celes_parts/c2i00b.c +139 -0
  25. data/examples/celes_parts/c2i06a.c +136 -0
  26. data/examples/celes_parts/c2ibpn.c +142 -0
  27. data/examples/celes_parts/c2ixy.c +131 -0
  28. data/examples/celes_parts/c2ixys.c +123 -0
  29. data/examples/celes_parts/c2s.c +96 -0
  30. data/examples/celes_parts/c2t00a.c +154 -0
  31. data/examples/celes_parts/c2t00b.c +150 -0
  32. data/examples/celes_parts/c2t06a.c +152 -0
  33. data/examples/celes_parts/c2tcio.c +122 -0
  34. data/examples/celes_parts/c2teqx.c +122 -0
  35. data/examples/celes_parts/c2tpe.c +167 -0
  36. data/examples/celes_parts/c2txy.c +159 -0
  37. data/examples/celes_parts/cal2jd.c +139 -0
  38. data/examples/celes_parts/celes_core.c +2522 -0
  39. data/examples/celes_parts/cp.c +80 -0
  40. data/examples/celes_parts/cpv.c +82 -0
  41. data/examples/celes_parts/cr.c +83 -0
  42. data/examples/celes_parts/d2dtf.c +206 -0
  43. data/examples/celes_parts/d2tf.c +160 -0
  44. data/examples/celes_parts/dat.c +289 -0
  45. data/examples/celes_parts/depend +25 -0
  46. data/examples/celes_parts/dtdb.c +1213 -0
  47. data/examples/celes_parts/dtf2d.c +196 -0
  48. data/examples/celes_parts/ee00.c +128 -0
  49. data/examples/celes_parts/ee00a.c +135 -0
  50. data/examples/celes_parts/ee00b.c +141 -0
  51. data/examples/celes_parts/ee06a.c +122 -0
  52. data/examples/celes_parts/eect00.c +282 -0
  53. data/examples/celes_parts/eform.c +147 -0
  54. data/examples/celes_parts/eo06a.c +131 -0
  55. data/examples/celes_parts/eors.c +108 -0
  56. data/examples/celes_parts/epb.c +96 -0
  57. data/examples/celes_parts/epb2jd.c +91 -0
  58. data/examples/celes_parts/epj.c +93 -0
  59. data/examples/celes_parts/epj2jd.c +91 -0
  60. data/examples/celes_parts/epv00.c +2589 -0
  61. data/examples/celes_parts/eqeq94.c +131 -0
  62. data/examples/celes_parts/era00.c +136 -0
  63. data/examples/celes_parts/extconf.rb +4 -0
  64. data/examples/celes_parts/fad03.c +103 -0
  65. data/examples/celes_parts/fae03.c +102 -0
  66. data/examples/celes_parts/faf03.c +106 -0
  67. data/examples/celes_parts/faju03.c +102 -0
  68. data/examples/celes_parts/fal03.c +103 -0
  69. data/examples/celes_parts/falp03.c +103 -0
  70. data/examples/celes_parts/fama03.c +102 -0
  71. data/examples/celes_parts/fame03.c +102 -0
  72. data/examples/celes_parts/fane03.c +99 -0
  73. data/examples/celes_parts/faom03.c +104 -0
  74. data/examples/celes_parts/fapa03.c +103 -0
  75. data/examples/celes_parts/fasa03.c +102 -0
  76. data/examples/celes_parts/faur03.c +99 -0
  77. data/examples/celes_parts/fave03.c +102 -0
  78. data/examples/celes_parts/fk52h.c +143 -0
  79. data/examples/celes_parts/fk5hip.c +126 -0
  80. data/examples/celes_parts/fk5hz.c +160 -0
  81. data/examples/celes_parts/fw2m.c +134 -0
  82. data/examples/celes_parts/fw2xy.c +120 -0
  83. data/examples/celes_parts/gc2gd.c +134 -0
  84. data/examples/celes_parts/gc2gde.c +200 -0
  85. data/examples/celes_parts/gd2gc.c +134 -0
  86. data/examples/celes_parts/gd2gce.c +138 -0
  87. data/examples/celes_parts/gmst00.c +145 -0
  88. data/examples/celes_parts/gmst06.c +136 -0
  89. data/examples/celes_parts/gmst82.c +151 -0
  90. data/examples/celes_parts/gst00a.c +138 -0
  91. data/examples/celes_parts/gst00b.c +146 -0
  92. data/examples/celes_parts/gst06.c +140 -0
  93. data/examples/celes_parts/gst06a.c +131 -0
  94. data/examples/celes_parts/gst94.c +131 -0
  95. data/examples/celes_parts/h2fk5.c +148 -0
  96. data/examples/celes_parts/hfk5z.c +175 -0
  97. data/examples/celes_parts/ir.c +83 -0
  98. data/examples/celes_parts/jd2cal.c +155 -0
  99. data/examples/celes_parts/jdcalf.c +161 -0
  100. data/examples/celes_parts/num00a.c +121 -0
  101. data/examples/celes_parts/num00b.c +121 -0
  102. data/examples/celes_parts/num06a.c +125 -0
  103. data/examples/celes_parts/numat.c +109 -0
  104. data/examples/celes_parts/nut00a.c +2047 -0
  105. data/examples/celes_parts/nut00b.c +372 -0
  106. data/examples/celes_parts/nut06a.c +153 -0
  107. data/examples/celes_parts/nut80.c +325 -0
  108. data/examples/celes_parts/nutm80.c +117 -0
  109. data/examples/celes_parts/obl06.c +118 -0
  110. data/examples/celes_parts/obl80.c +118 -0
  111. data/examples/celes_parts/p06e.c +321 -0
  112. data/examples/celes_parts/p2pv.c +83 -0
  113. data/examples/celes_parts/p2s.c +91 -0
  114. data/examples/celes_parts/pap.c +139 -0
  115. data/examples/celes_parts/pas.c +96 -0
  116. data/examples/celes_parts/pb06.c +144 -0
  117. data/examples/celes_parts/pdp.c +84 -0
  118. data/examples/celes_parts/pfw06.c +165 -0
  119. data/examples/celes_parts/plan94.c +514 -0
  120. data/examples/celes_parts/pm.c +83 -0
  121. data/examples/celes_parts/pmat00.c +118 -0
  122. data/examples/celes_parts/pmat06.c +122 -0
  123. data/examples/celes_parts/pmat76.c +141 -0
  124. data/examples/celes_parts/pmp.c +85 -0
  125. data/examples/celes_parts/pn.c +109 -0
  126. data/examples/celes_parts/pn00.c +177 -0
  127. data/examples/celes_parts/pn00a.c +162 -0
  128. data/examples/celes_parts/pn00b.c +162 -0
  129. data/examples/celes_parts/pn06.c +187 -0
  130. data/examples/celes_parts/pn06a.c +152 -0
  131. data/examples/celes_parts/pnm00a.c +121 -0
  132. data/examples/celes_parts/pnm00b.c +121 -0
  133. data/examples/celes_parts/pnm06a.c +124 -0
  134. data/examples/celes_parts/pnm80.c +126 -0
  135. data/examples/celes_parts/pom00.c +115 -0
  136. data/examples/celes_parts/ppp.c +85 -0
  137. data/examples/celes_parts/ppsp.c +94 -0
  138. data/examples/celes_parts/pr00.c +142 -0
  139. data/examples/celes_parts/prec76.c +148 -0
  140. data/examples/celes_parts/pv2p.c +81 -0
  141. data/examples/celes_parts/pv2s.c +144 -0
  142. data/examples/celes_parts/pvdpv.c +102 -0
  143. data/examples/celes_parts/pvm.c +86 -0
  144. data/examples/celes_parts/pvmpv.c +87 -0
  145. data/examples/celes_parts/pvppv.c +87 -0
  146. data/examples/celes_parts/pvstar.c +207 -0
  147. data/examples/celes_parts/pvu.c +93 -0
  148. data/examples/celes_parts/pvup.c +88 -0
  149. data/examples/celes_parts/pvxpv.c +107 -0
  150. data/examples/celes_parts/pxp.c +94 -0
  151. data/examples/celes_parts/rm2v.c +111 -0
  152. data/examples/celes_parts/rv2m.c +118 -0
  153. data/examples/celes_parts/rx.c +110 -0
  154. data/examples/celes_parts/rxp.c +99 -0
  155. data/examples/celes_parts/rxpv.c +86 -0
  156. data/examples/celes_parts/rxr.c +99 -0
  157. data/examples/celes_parts/ry.c +110 -0
  158. data/examples/celes_parts/rz.c +110 -0
  159. data/examples/celes_parts/s00.c +371 -0
  160. data/examples/celes_parts/s00a.c +143 -0
  161. data/examples/celes_parts/s00b.c +143 -0
  162. data/examples/celes_parts/s06.c +368 -0
  163. data/examples/celes_parts/s06a.c +145 -0
  164. data/examples/celes_parts/s2c.c +85 -0
  165. data/examples/celes_parts/s2p.c +88 -0
  166. data/examples/celes_parts/s2pv.c +103 -0
  167. data/examples/celes_parts/s2xpv.c +87 -0
  168. data/examples/celes_parts/sepp.c +105 -0
  169. data/examples/celes_parts/seps.c +93 -0
  170. data/examples/celes_parts/sofa.h +379 -0
  171. data/examples/celes_parts/sofam.h +155 -0
  172. data/examples/celes_parts/sp00.c +118 -0
  173. data/examples/celes_parts/starpm.c +205 -0
  174. data/examples/celes_parts/starpv.c +264 -0
  175. data/examples/celes_parts/sxp.c +84 -0
  176. data/examples/celes_parts/sxpv.c +85 -0
  177. data/examples/celes_parts/taitt.c +110 -0
  178. data/examples/celes_parts/taiut1.c +112 -0
  179. data/examples/celes_parts/taiutc.c +182 -0
  180. data/examples/celes_parts/tcbtdb.c +132 -0
  181. data/examples/celes_parts/tcgtt.c +109 -0
  182. data/examples/celes_parts/tdbtcb.c +137 -0
  183. data/examples/celes_parts/tdbtt.c +122 -0
  184. data/examples/celes_parts/test_celes.rb +48 -0
  185. data/examples/celes_parts/tf2a.c +107 -0
  186. data/examples/celes_parts/tf2d.c +107 -0
  187. data/examples/celes_parts/tr.c +93 -0
  188. data/examples/celes_parts/trxp.c +93 -0
  189. data/examples/celes_parts/trxpv.c +93 -0
  190. data/examples/celes_parts/tttai.c +110 -0
  191. data/examples/celes_parts/tttcg.c +112 -0
  192. data/examples/celes_parts/tttdb.c +121 -0
  193. data/examples/celes_parts/ttut1.c +110 -0
  194. data/examples/celes_parts/ut1tai.c +111 -0
  195. data/examples/celes_parts/ut1tt.c +110 -0
  196. data/examples/celes_parts/ut1utc.c +193 -0
  197. data/examples/celes_parts/utctai.c +163 -0
  198. data/examples/celes_parts/utcut1.c +151 -0
  199. data/examples/celes_parts/xy06.c +2758 -0
  200. data/examples/celes_parts/xys00a.c +133 -0
  201. data/examples/celes_parts/xys00b.c +133 -0
  202. data/examples/celes_parts/xys06a.c +133 -0
  203. data/examples/celes_parts/zp.c +77 -0
  204. data/examples/celes_parts/zpv.c +79 -0
  205. data/examples/celes_parts/zr.c +83 -0
  206. data/examples/check_date_type.rb +2 -4
  207. data/examples/compare_geoc_long_ra.rb +19 -11
  208. data/examples/data_table_for_astro_dog.rb +40 -0
  209. data/examples/earth_rotation.rb +28 -3
  210. data/examples/eot.c +15 -0
  211. data/examples/eot.h +2 -0
  212. data/examples/eot_methods_list.rb +30 -3
  213. data/examples/eot_suntimes.rb +99 -95
  214. data/examples/extconf.rb +2 -0
  215. data/examples/{read_nutation_data.rb → gmst_gast_non_sofa.rb} +103 -98
  216. data/examples/nutation_table5_3a.yaml +1658 -1658
  217. data/examples/rbeot.c +24 -0
  218. data/examples/test_eot.rb +17 -0
  219. data/examples/test_poly_eval.rb +6 -17
  220. data/examples/time_scales.rb +4 -7
  221. data/examples/times_year.rb +50 -0
  222. data/examples/usage_example.rb +15 -5
  223. data/examples/use_angles.rb +151 -87
  224. data/lib/eot/angles.rb +130 -177
  225. data/lib/eot/constants.rb +41 -44
  226. data/lib/eot/displays.rb +40 -37
  227. data/lib/eot/geo_lat_lng_smt.rb +7 -6
  228. data/lib/eot/init.rb +62 -39
  229. data/lib/eot/nutation.rb +53 -45
  230. data/lib/eot/times.rb +32 -41
  231. data/lib/eot/utilities.rb +11 -90
  232. data/lib/eot/version.rb +3 -2
  233. data/rise_set_data.yml +1461 -0
  234. data/run_tests_eclipse.rb +1 -0
  235. data/tests/minitest/aliased_angles_spec.rb +119 -165
  236. data/tests/minitest/aliased_displays_spec.rb +41 -39
  237. data/tests/minitest/aliased_utilities_spec.rb +11 -22
  238. data/tests/minitest/angles_spec.rb +134 -181
  239. data/tests/minitest/constants_spec.rb +4 -10
  240. data/tests/minitest/delta_epsilon_spec.rb +13 -16
  241. data/tests/minitest/displays_spec.rb +39 -37
  242. data/tests/minitest/geo_spec.rb +15 -11
  243. data/tests/minitest/init_spec.rb +30 -16
  244. data/tests/minitest/nutation_spec.rb +19 -13
  245. data/tests/minitest/times_spec.rb +77 -75
  246. data/tests/minitest/utilities_spec.rb +10 -94
  247. data/wiki.md +7 -9
  248. metadata +218 -26
  249. data/examples/data_table.rb +0 -26
  250. data/lib/eot/nutation_table5_3a.yaml +0 -9532
  251. data/tests/minitest/aliased_times_spec.rb +0 -36
@@ -1,27 +1,21 @@
1
1
  # constants_spec.rb
2
2
  #
3
- # uncomment below for minitest
3
+ # comment out next two lines and uncomment below for rpec tests.
4
4
  gem 'minitest'
5
5
  require 'minitest/autorun'
6
6
  # require_relative '../spec_config'
7
+
7
8
  lib = File.expand_path('../../../lib', __FILE__)
8
- # puts "Loading gem from #{lib}/eot.rb"
9
9
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
10
10
  require 'eot'
11
11
 
12
12
  describe "Equation of Time constants." do
13
13
 
14
14
  it "01 require 'eot' should find all constants." do
15
- assert_equal 3600.0, Eot::ASD
16
- assert_equal 4.8481368110953599358991410235795e-6, Eot::DTR
17
- assert_equal 206264.80624709635515647335733078, Eot::RTD
18
15
  assert_equal 24.0, Eot::DAY_HOURS
19
16
  assert_equal 1440.0, Eot::DAY_MINUTES
20
17
  assert_equal 86400.0, Eot::DAY_SECONDS
21
- assert_equal 86400.0 * 1.0e+6, Eot::DAY_USECS
22
- assert_equal [0.0, 0.0, 0.0, 0.0, 0.0], Eot::A2000
23
- assert_equal "2000-01-01", Eot::D2000
24
- assert_equal 2451545.0, Eot::J2000
25
- assert_equal DateTime.new( 2000, 01, 01, 12, 00, 00, "+00:00" ), Eot::DT2000
18
+ assert_equal 86400.0 * 1.0e+6, Eot::DAY_USECS
19
+ assert_equal 57.29577951308232, Eot::R2D
26
20
  end
27
21
  end
@@ -1,35 +1,32 @@
1
- # uncomment below for minitest
1
+ # delta_epsilon_spec.rb
2
+ #
3
+ # comment out next two lines and uncomment below for rpec tests.
2
4
  gem 'minitest'
3
5
  require 'minitest/autorun'
4
6
  # require_relative '../spec_config'
5
7
 
6
8
  lib = File.expand_path('../../../lib', __FILE__)
7
- # puts "Loading gem from #{lib}/eot.rb"
8
9
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
9
10
  require 'eot'
10
11
 
11
12
  Eot_first = Eot.new
12
13
 
13
- describe 'Eot_first default, nil, 0' do
14
-
15
- # set ma attribute first as it gets tested anyway but a lot of methods
16
- # now rely on @ma so we don't have to keep calling it unless we change
17
- # @ajd attribute.
14
+ describe 'set ajd to 2456885.0' do
18
15
 
19
16
  before(:each) do
20
- @ajd = 2456885.0
21
- Eot_first.ajd = @ajd
22
- Eot_first.ma_Sun()
17
+ ajd = 2456885.0
18
+ Eot_first.ajd = ajd
23
19
  end
24
20
 
25
- it 'expected 2456885.0 for Eot_first.ajd'do
21
+ it 'expected 2456885.0 for Eot_first.ajd' do
26
22
  assert_equal 2456885.0, Eot_first.ajd
27
- assert_equal 220.63461047326172, Eot_first.ma
28
23
  end
29
24
 
30
- it 'expected -0.0015940313608572006 returned by delta_epsilon()' do
31
- assert_equal -0.0015940313608572006, Eot_first.delta_epsilon()
32
- assert_equal -0.0015940313608572006, Eot_first.delta_epsilon(nil)
33
- assert_equal -0.0015940313608572006, Eot_first.delta_epsilon(0)
25
+ it 'expected 220.63461047270653 for Eot_first.ma' do
26
+ assert_equal 220.63461047270653, Eot_first.ma * Eot::R2D
27
+ end
28
+
29
+ it 'expected -0.0023318194624360874 returned by delta_epsilon()' do
30
+ assert_equal -0.0023318194624360874, Eot_first.delta_epsilon() * Eot::R2D
34
31
  end
35
32
  end
@@ -1,31 +1,37 @@
1
1
  # displays_spec.rb
2
2
  #
3
- # uncomment below for minitest
3
+ # comment out next two lines and uncomment below for rpec tests.
4
4
  gem 'minitest'
5
5
  require 'minitest/autorun'
6
6
  # require_relative '../spec_config'
7
+
7
8
  lib = File.expand_path('../../../lib', __FILE__)
8
- # puts "Loading gem from #{lib}/eot.rb"
9
9
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
10
10
  require 'eot'
11
11
 
12
12
  Eot_displays = Eot.new
13
13
 
14
- describe 'Eot displays default, nil, 0' do
15
-
16
- # set ma attribute first as it gets tested anyway but a lot of methods
17
- # now rely on @ma so we don't have to keep calling it unless we change
18
- # @ajd attribute.
14
+ describe 'Eot displays using ajd of 2456885.0' do
15
+
19
16
  before(:each) do
20
- @ajd = 2456885.0
21
- Eot_displays.ajd = @ajd
22
- Eot_displays.ma_Sun()
23
- end
17
+ ajd = 2456885.0
18
+ Eot_displays.ajd = ajd
19
+
20
+ # check date for this ajd when needed.
21
+ Eot_displays.date = Eot_displays.ajd_to_datetime(ajd)
22
+ end
24
23
 
25
24
  it 'expected 2456885.0 for Eot_displays.ajd'do
26
25
  assert_equal 2456885.0, Eot_displays.ajd
27
- assert_equal 220.63461047326172, Eot_displays.ma
28
- end
26
+ end
27
+
28
+ it 'expected "2014-08-15T12:00:00+00:00", returned by Eot_displays.date.to_s' do
29
+ assert_equal "2014-08-15T12:00:00+00:00", Eot_displays.date.to_s
30
+ end
31
+
32
+ it 'expected 220.63461047270653, returned by Eot_displays.' do
33
+ assert_equal 220.63461047270653, Eot_displays.ma * Eot::R2D
34
+ end
29
35
 
30
36
  it 'expected "+000:00:00.000" returned by Eot_displays.degrees_to_s() ' do
31
37
  assert_equal "+000:00:00.000", Eot_displays.degrees_to_s()
@@ -33,10 +39,8 @@ describe 'Eot displays default, nil, 0' do
33
39
  assert_equal "+000:00:00.000", Eot_displays.degrees_to_s(0)
34
40
  end
35
41
 
36
- it 'expected "+279:13:46.271" returned by Eot_displays.string_al_Sun() ' do
37
- assert_equal "+279:13:46.271", Eot_displays.string_al_Sun()
38
- assert_equal "+279:13:46.271", Eot_displays.string_al_Sun(nil)
39
- assert_equal "+279:13:46.271", Eot_displays.string_al_Sun(0)
42
+ it 'expected "+142:35:33.356" returned by Eot_displays.string_al_Sun() ' do
43
+ assert_equal "+142:35:33.356", Eot_displays.string_al_Sun()
40
44
  end
41
45
 
42
46
  it 'expected "12:00:00" returned by Eot_displays.string_day_fraction_to_time() ' do
@@ -45,10 +49,8 @@ describe 'Eot displays default, nil, 0' do
45
49
  assert_equal "12:00:00", Eot_displays.string_day_fraction_to_time(0)
46
50
  end
47
51
 
48
- it 'expected "-023:06:59.415" returned by Eot_displays.string_dec_Sun() ' do
49
- assert_equal "-023:06:59.415", Eot_displays.string_dec_Sun()
50
- assert_equal "-023:06:59.415", Eot_displays.string_dec_Sun(nil)
51
- assert_equal "-023:06:59.415", Eot_displays.string_dec_Sun(0)
52
+ it 'expected "+013:58:51.521" returned by Eot_displays.string_dec_Sun() ' do
53
+ assert_equal "+013:58:51.521", Eot_displays.string_dec_Sun()
52
54
  end
53
55
 
54
56
  it 'expected "-04m, 28.9s" returned by Eot_displays.string_eot() ' do
@@ -61,38 +63,38 @@ describe 'Eot displays default, nil, 0' do
61
63
  assert_equal "2000-01-01", Eot_displays.string_jd_to_date(0)
62
64
  end
63
65
 
66
+ it 'expected "2014-08-15" returned by Eot_displays.jd_to_date_string(Eot_displays.ajd)? ' do
67
+ assert_equal "2014-08-15", Eot_displays.jd_to_date_string(Eot_displays.ajd)
68
+ end
69
+
64
70
  it 'expected "+220:38:04.597" returned by Eot_displays.string_ma_Sun() ' do
65
71
  assert_equal "+220:38:04.597", Eot_displays.string_ma_Sun()
66
72
  end
67
73
 
68
- it 'expected "+280:02:35.793" returned by Eot_displays.string_ra_Sun() ' do
69
- assert_equal "+280:02:35.793", Eot_displays.string_ra_Sun()
70
- assert_equal "+280:02:35.793", Eot_displays.string_ra_Sun(nil)
71
- assert_equal "+280:02:35.793", Eot_displays.string_ra_Sun(0)
74
+ it 'expected "+144:56:36.571" returned by Eot_displays.string_ra_Sun() ' do
75
+ assert_equal "+144:56:36.571", Eot_displays.string_ra_Sun()
72
76
  end
73
77
 
74
- it 'expected "+219:24:26.197" returned by Eot_displays.string_ta_Sun() ' do
75
- assert_equal "+219:24:26.197", Eot_displays.string_ta_Sun()
76
- assert_equal "+219:24:26.197", Eot_displays.string_ta_Sun(nil)
77
- assert_equal "+219:24:26.197", Eot_displays.string_ta_Sun(0)
78
+ it 'expected "+219:24:27.797" returned by Eot_displays.string_ta_Sun() ' do
79
+ assert_equal "+219:24:27.797", Eot_displays.string_ta_Sun()
78
80
  end
79
81
 
80
82
  it 'expected "12:00:00.000" returned by Eot_displays.string_time() ' do
81
83
  assert_equal "12:00:00.000", Eot_displays.string_time()
82
84
  assert_equal "12:00:00.000", Eot_displays.string_time(nil)
83
85
  assert_equal "12:00:00.000", Eot_displays.string_time(0)
86
+ end
87
+
88
+ it 'expected "12:00:00.000" returned by Eot_displays.display_time_string(Eot_adisplays.date)? ' do
89
+ assert_equal "12:00:00.000", Eot_displays.display_time_string(Eot_displays.date)
84
90
  end
85
91
 
86
- it 'expected "+279:14:20.844" returned by Eot_displays.string_tl_Sun() ' do
87
- assert_equal "+279:14:20.844", Eot_displays.string_tl_Sun()
88
- assert_equal "+279:14:20.844", Eot_displays.string_tl_Sun(nil)
89
- assert_equal "+279:14:20.844", Eot_displays.string_tl_Sun(0)
92
+ it 'expected "+142:35:47.318" returned by Eot_displays.string_tl_Sun() ' do
93
+ assert_equal "+142:35:47.318", Eot_displays.string_tl_Sun()
90
94
  end
91
95
 
92
- it 'expected "+023:26:15.667" returned by Eot_displays.string_to_Earth() ' do
93
- assert_equal "+023:26:15.667", Eot_displays.string_to_Earth()
94
- assert_equal "+023:26:15.667", Eot_displays.string_to_Earth(nil)
95
- assert_equal "+023:26:15.667", Eot_displays.string_to_Earth(0)
96
+ it 'expected "+023:26:06.163" returned by Eot_displays.string_to_Earth() ' do
97
+ assert_equal "+023:26:06.163", Eot_displays.string_to_Earth()
96
98
  end
97
99
 
98
100
  end
@@ -1,36 +1,40 @@
1
- # geo_spec.rb
1
+ # geo_spec.rb/
2
2
  #
3
- # uncomment below for minitest
3
+ # comment out next two lines and uncomment below for rpec tests.
4
4
  gem 'minitest'
5
5
  require 'minitest/autorun'
6
6
  # require_relative '../spec_config'
7
- lib = File.expand_path('../../../lib', __FILE__)
8
- # puts "Loading gem from #{lib}/eot.rb"
9
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
7
+
8
+ lib = File.expand_path('../../../lib', __FILE__)
9
+ $LOAD_PATH.unshift(lib)unless$LOAD_PATH.include?(lib)
10
10
  require 'eot'
11
11
 
12
- Geo = GeoLatLng.new
12
+ geo = GeoLatLng.new()
13
13
 
14
14
  describe 'Geo defaults' do
15
+
16
+ it 'expected "Blackheath Ave, London SE10 8XJ, UK" 'do
17
+ assert_equal "Blackheath Ave, London SE10 8XJ, UK", geo.addr
18
+ end
15
19
 
16
20
  it'expected "http://maps.googleapis.com/maps/api/geocode/xml?sensor=false&address="' do
17
- assert_equal "http://maps.googleapis.com/maps/api/geocode/xml?sensor=false&address=", Geo.base
21
+ assert_equal "http://maps.googleapis.com/maps/api/geocode/xml?sensor=false&address=", geo.base
18
22
  end
19
23
 
20
24
  it'expected "Blackheath Ave, London SE10 8XJ, UK" 'do
21
- assert_equal "Blackheath Ave, London SE10 8XJ, UK", Geo.default_int
25
+ assert_equal "Blackheath Ave, London SE10 8XJ, UK", geo.default_int
22
26
  end
23
27
 
24
28
  it'expected "3333 Coyote Hill Road, Palo Alto, CA, 94304, USA" 'do
25
- assert_equal "3333 Coyote Hill Road, Palo Alto, CA, 94304, USA", Geo.default_us
29
+ assert_equal "3333 Coyote Hill Road, Palo Alto, CA, 94304, USA", geo.default_us
26
30
  end
27
31
 
28
32
  it'expected 0.0'do
29
- assert_equal 0.0, Geo.lat
33
+ assert_equal 0.0, geo.lat
30
34
  end
31
35
 
32
36
  it'expected 0.0'do
33
- assert_equal 0.0, Geo.lng
37
+ assert_equal 0.0, geo.lng
34
38
  end
35
39
 
36
40
  end
@@ -1,32 +1,46 @@
1
1
  # init_spec.rb
2
2
  #
3
- # uncomment below for minitest
3
+ # comment out next two lines and uncomment below for rpec tests.
4
4
  gem 'minitest'
5
5
  require 'minitest/autorun'
6
6
  # require_relative '../spec_config'
7
+
8
+
7
9
  lib = File.expand_path('../../../lib', __FILE__)
8
- # puts "Loading gem from #{lib}/eot.rb"
9
10
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
10
11
  require 'eot'
11
12
 
12
- Eot_initialize = Eot.new
13
13
 
14
- describe 'Eot methods for init.rb' do
14
+ describe 'Eot_initialize using today matchers' do
15
+
16
+ it 'expected DateTime.now.to_time.utc.to_datetime.jd.to_f' do
17
+ @test1 = Eot.new()
18
+ assert_equal DateTime.now.to_time.utc.to_datetime.jd.to_f, @test1.ajd
19
+ end
20
+
21
+ it 'expected 0.0' do
22
+ @test2 = Eot.new()
23
+ assert_equal 51.4769388, @test2.latitude
24
+ end
25
+
26
+ it 'expected 0.0' do
27
+ @test3 = Eot.new()
28
+ assert_equal -4.2e-05, @test3.longitude
29
+ end
30
+
31
+ it 'expected @test4.ma_Sun()' do
32
+ @test4 = Eot.new()
33
+ assert_equal @test4.ma_Sun(), @test4.ma
34
+ end
15
35
 
16
- it 'expected defaults returned by Eot_initialize() ?' do
17
-
18
- date = DateTime.now.to_time.utc.to_datetime
19
- refute_nil Eot_initialize.data
20
- assert_equal date.jd.to_f, Eot_initialize.ajd
21
- assert_equal date.to_date, Eot_initialize.date
22
- assert_equal date.jd, Eot_initialize.jd
23
- assert_equal 0.0, Eot_initialize.latitude
24
- assert_equal 0.0, Eot_initialize.longitude
36
+ it 'expected (@test5.ajd - Eot::DJ00) / Eot::DJC' do
37
+ @test5 = Eot.new()
38
+ assert_equal (@test5.ajd - Eot::DJ00) / Eot::DJC, @test5.ta
25
39
  end
26
40
 
27
- it 'expected 0.0 returned by Eot_initialize.initialize(addr) ' do
28
- @test6 = Eot.new("some comma separated address")
29
- assert_equal "some comma separated address", @test6.addr
41
+ it 'expected 0.0 returned by Eot_initialize.new() ' do
42
+ @test6 = Eot.new()
43
+ assert_equal "Blackheath Ave, London SE10 8XJ, UK", @test6.addr
30
44
  end
31
45
 
32
46
  end
@@ -1,33 +1,39 @@
1
1
  # nutation_spec.rb
2
2
  #
3
- # uncomment below for minitest
3
+ # comment out next two lines and uncomment below for rpec tests.
4
4
  gem 'minitest'
5
5
  require 'minitest/autorun'
6
6
  # require_relative '../spec_config'
7
+
7
8
  lib = File.expand_path('../../../lib', __FILE__)
8
- # puts "Loading gem from #{lib}/eot.rb"
9
9
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
10
10
  require 'eot'
11
11
 
12
+
12
13
  Eot_nutation = Eot.new
13
14
 
14
- describe "Eot_nutation default" do
15
+ describe 'Eot_nutation using ajd of 2456885.0' do
15
16
 
16
17
  before(:each) do
17
- @ajd = 2456885.0
18
- Eot_nutation.ajd = @ajd
19
- Eot_nutation.ma_Sun()
18
+ ajd = 2456885.0
19
+ Eot_nutation.ajd = ajd
20
+ Eot_nutation.date = Eot_nutation.ajd_to_datetime(ajd)
20
21
  end
21
22
 
22
- it 'expected 2456885.0 for Eot_nutation.ajd'do
23
- assert_equal 2456885.0, Eot_nutation.ajd
24
- assert_equal 220.63461047326172, Eot_nutation.ma
23
+ it 'expected 2456885.0 from Eot_nutation.ajd' do
24
+ assert_equal 2456885.0, Eot_nutation.ajd
25
25
  end
26
26
 
27
- it "expected [-0.0015940313608572006, -0.0038550497869660255] from Eot_nutation.delta_equinox() for default" do
28
- assert_equal [-0.0015940313608572006, -0.0038550497869660255], Eot_nutation.delta_equinox()[0..1]
29
- assert_equal [-0.0015940313608572006, -0.0038550497869660255], Eot_nutation.delta_equinox(nil)[0..1]
30
- assert_equal [-0.0015940313608572006, -0.0038550497869660255], Eot_nutation.delta_equinox(0)[0..1]
27
+ it 'expected "2014-08-15T12:00:00+00:00" from Eot_nutation.date.to_s' do
28
+ assert_equal "2014-08-15T12:00:00+00:00", Eot_nutation.date.to_s
29
+ end
30
+
31
+ it 'expected 220.63461047270653 from Eot_nutation.ma' do
32
+ assert_equal 220.63461047270653, Eot_nutation.ma * Eot::R2D
33
+ end
34
+
35
+ it 'expected [3.75123821843003e-05, -4.069792718159396e-05] from Eot_nutation.delta_equinox()' do
36
+ assert_equal [3.75123821843003e-05, -4.069792718159396e-05], Eot_nutation.delta_equinox()
31
37
  end
32
38
 
33
39
  end
@@ -1,136 +1,138 @@
1
1
  # times_spec.rb
2
2
  #
3
- # uncomment below for minitest
3
+ # comment out next two lines and uncomment below for rpec tests.
4
4
  gem 'minitest'
5
5
  require 'minitest/autorun'
6
6
  # require_relative '../spec_config'
7
+
7
8
  lib = File.expand_path('../../../lib', __FILE__)
8
- # puts "Loading gem from #{lib}/eot.rb"
9
9
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
10
10
  require 'eot'
11
11
 
12
12
  Eot_times = Eot.new
13
13
 
14
- describe ' Eot times default, nil, 0' do
14
+ describe 'tests ajd of 2456885.0' do
15
15
 
16
- # set ma attribute first as it gets tested anyway but a lot of methods
17
- # now rely on @ma so we don't have to keep calling it unless we change
18
- # @ajd attribute.
19
16
  before(:each) do
20
- @ajd = 2456885.0
21
- Eot_times.ajd = @ajd
22
- Eot_times.ma_Sun()
23
- end
17
+ ajd = 2456885.0
18
+ Eot_times.ajd = ajd
19
+ # check date for this ajd when needed.
20
+ Eot_times.date = Eot_times.ajd_to_datetime(ajd)
21
+ # use ta attribute as matcher
22
+ @ta = Eot_times.ta
23
+ end
24
24
 
25
25
  it 'expected 2456885.0 for Eot_times.ajd'do
26
- assert_equal 2456885.0, Eot_times.ajd
27
- assert_equal 220.63461047326172, Eot_times.ma
28
- end
29
-
30
- it 'expected "2014-08-15T06:01:02+00:00", returned by Eot_times.sunrise_dt() ' do
31
- assert_equal "2014-08-15T06:01:02+00:00", Eot_times.sunrise_dt().to_s
26
+ assert_equal 2456885.0, Eot_times.ajd
32
27
  end
33
28
 
34
- it 'expected 2456884.7507175957, returned by Eot_times.sunrise_jd() ' do
35
- assert_equal 2456884.7507175957, Eot_times.sunrise_jd()
29
+ it 'expected "2014-08-15T12:00:00+00:00" for Eot_times.date'.to_s do
30
+ assert_equal "2014-08-15T12:00:00+00:00", Eot_times.date.to_s
31
+ end
32
+
33
+ it 'expected 220.63461047270653 for Eot_times.ma'do
34
+ assert_equal 220.63461047270653, Eot_times.ma * Eot::R2D
36
35
  end
37
36
 
38
- it 'expected "2014-08-15T18:07:54+00:00", returned by Eot_times.sunset_dt() ' do
39
- assert_equal "2014-08-15T18:07:54+00:00", Eot_times.sunset_dt().to_s
37
+ it 'expected "2014-08-15T12:00:00+00:00" from Eot_times.ajd_to_datetime(Eot_times.ajd).to_s ' do
38
+ assert_equal "2014-08-15T12:00:00+00:00", Eot_times.ajd_to_datetime(Eot_times.ajd).to_s
39
+ end
40
+
41
+ it 'expected -0.003102965199978262 from Eot_times.eot_jd() ' do
42
+ assert_equal -0.003102965199978262, Eot_times.eot_jd()
43
+ end
44
+
45
+ it 'expected "2014-08-15T12:04:28+00:00" from Eot_times.local_noon_dt().to_s ' do
46
+ assert_equal "2014-08-15T12:04:28+00:00", Eot_times.local_noon_dt().to_s
47
+ end
48
+
49
+ it 'expected "2014-08-15T12:00:00+00:00" from Eot_times.mean_local_noon_dt().to_s ' do
50
+ assert_equal "2014-08-15T12:00:00+00:00", Eot_times.mean_local_noon_dt().to_s
40
51
  end
52
+
53
+ it 'expected "2014-08-15T04:45:44+00:00" from Eot_times.sunrise_dt() ' do
54
+ assert_equal "2014-08-15T04:45:44+00:00", Eot_times.sunrise_dt().to_s
55
+ end
56
+
57
+ it 'expected "2014-08-15T19:23:11+00:00" from Eot_times.sunset_dt() ' do
58
+ assert_equal "2014-08-15T19:23:11+00:00", Eot_times.sunset_dt().to_s
59
+ end
60
+
61
+ it 'expected 2456884.6984291207 from Eot_times.sunrise_jd() ' do
62
+ assert_equal 2456884.6984291207, Eot_times.sunrise_jd()
63
+ end
41
64
 
42
- it 'expected 2456885.25548836, returned by Eot_times.sunset_jd() ' do
43
- assert_equal 2456885.25548836, Eot_times.sunset_jd()
65
+ it 'expected 2456885.3077770434 from Eot_times.sunset_jd() ' do
66
+ assert_equal 2456885.3077770434, Eot_times.sunset_jd()
44
67
  end
45
68
 
46
- it 'expected -9.362443838775045, returned by Eot_times.time_delta_oblique() ' do
47
- assert_equal -9.362443838775045, Eot_times.time_delta_oblique()
69
+ it 'expected -9.362425472253944 from Eot_times.time_delta_oblique() ' do
70
+ assert_equal -9.362425472253944, Eot_times.time_delta_oblique()
48
71
  end
49
72
 
50
- it 'expected 4.894155584341185, returned by Eot_times.time_delta_orbit() ' do
51
- assert_equal 4.894155584341185, Eot_times.time_delta_orbit()
73
+ it 'expected 4.894155584285248 from Eot_times.time_delta_orbit() ' do
74
+ assert_equal 4.894155584285248, Eot_times.time_delta_orbit()
52
75
  end
53
76
 
54
- it 'expected -4.468288254433861, returned by Eot_times.time_eot() ' do
55
- assert_equal -4.468288254433861, Eot_times.time_eot()
77
+ it 'expected -4.468269887968697 from Eot_times.time_eot() ' do
78
+ assert_equal -4.468269887968697, Eot_times.time_eot()
56
79
  end
57
80
 
58
- it 'expected [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] returned by Eot_times.time_julian_century() ' do
59
- assert_equal [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], Eot_times.time_julian_century()
60
- assert_equal [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], Eot_times.time_julian_century(nil)
61
- assert_equal [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], Eot_times.time_julian_century(0)
62
- end
63
-
64
-
65
81
  end
66
82
 
67
- describe 'Eot times for ajd 2455055.0 a non default value' do
83
+ describe 'tests ajd of 2455055.0' do
68
84
 
69
- # set ma attribute first as it gets tested anyway but a lot of methods
70
- # now rely on @ma so we don't have to keep calling it unless we change
71
- # @ajd attribute
72
85
  before(:each) do
73
- @ajd = 2455055.0
74
- Eot_times.ajd = @ajd
75
- @dt = Eot_times.ajd_to_datetime(@ajd)
76
- Eot_times.date = @dt
77
- Eot_times.ma_Sun
86
+ ajd = 2455055.0
87
+ Eot_times.ajd = ajd
88
+ # check date for this ajd when needed.
89
+ Eot_times.date = Eot_times.ajd_to_datetime(ajd)
90
+ # use ta attribute as matcher
91
+ @ta = Eot_times.ta
78
92
  end
79
93
 
80
- it 'expected 2455055.0, returned by Eot_times.' do
94
+ it 'expected 2455055.0, from Eot_times.' do
81
95
  assert_equal 2455055.0, Eot_times.ajd
82
96
  end
83
97
 
84
- it 'expected "2009-08-11T12:00:00+00:00", returned by Eot_times.date.to_s' do
98
+ it 'expected "2009-08-11T12:00:00+00:00" from Eot_times.date.to_s' do
85
99
  assert_equal "2009-08-11T12:00:00+00:00", Eot_times.date.to_s
86
100
  end
87
101
 
88
- it 'expected 216.98609672514223, returned by Eot_times.' do
89
- assert_equal 216.98609672514223, Eot_times.ma
102
+ it 'expected 216.98609672458667 from Eot_times.' do
103
+ assert_equal 216.98609672458667, Eot_times.ma * Eot::R2D
90
104
  end
91
105
 
92
- it 'expected "2009-08-11T12:00:00+00:00", returned by Eot_times.ajd_to_datetime(@ajd).to_s' do
93
- assert_equal "2009-08-11T12:00:00+00:00", Eot_times.ajd_to_datetime(@ajd).to_s
106
+ it 'expected "2009-08-11T12:00:00+00:00" from Eot_times.ajd_to_datetime(Eot_times.ajd).to_s' do
107
+ assert_equal "2009-08-11T12:00:00+00:00", Eot_times.ajd_to_datetime(Eot_times.ajd).to_s
94
108
  end
95
109
 
96
- it 'expected -0.0035798034147912243, returned by Eot_times.eot_jd()' do
97
- assert_equal -0.0035798034147912243, Eot_times.eot_jd()
110
+ it 'expected -0.003579806101313601 from Eot_times.eot_jd()' do
111
+ assert_equal -0.003579806101313601, Eot_times.eot_jd()
98
112
  end
99
113
 
100
- it 'expected "2009-08-11T12:00:00+00:00", returned by Eot_times.mean_local_noon_dt().to_s' do
114
+ it 'expected "2009-08-11T12:00:00+00:00" from Eot_times.mean_local_noon_dt().to_s' do
101
115
  assert_equal "2009-08-11T12:00:00+00:00", Eot_times.mean_local_noon_dt().to_s
102
116
  end
103
117
 
104
- it 'expected "2009-08-11T06:01:42+00:00" returned by Eot_times.sunrise_dt().to_s' do
105
- assert_equal "2009-08-11T06:01:42+00:00", Eot_times.sunrise_dt().to_s
118
+ it 'expected "2009-08-11T04:39:44+00:00" from Eot_times.sunrise_dt().to_s' do
119
+ assert_equal "2009-08-11T04:39:44+00:00", Eot_times.sunrise_dt().to_s
106
120
  end
107
121
 
108
- it 'expected 2455054.7511818386 returned by Eot_times.sunrise_jd()' do
109
- assert_equal 2455054.7511818386, Eot_times.sunrise_jd()
122
+ it 'expected 2455054.6942686504 from Eot_times.sunrise_jd()' do
123
+ assert_equal 2455054.6942686504, Eot_times.sunrise_jd()
110
124
  end
111
125
 
112
- it 'expected "2009-08-11T18:08:36+00:00" returned by Eot_times.sunset_dt()' do
113
- assert_equal "2009-08-11T18:08:36+00:00", Eot_times.sunset_dt().to_s
126
+ it 'expected "2009-08-11T19:30:33+00:00" from Eot_times.sunset_dt()' do
127
+ assert_equal "2009-08-11T19:30:33+00:00", Eot_times.sunset_dt().to_s
114
128
  end
115
129
 
116
- it 'expected 2455055.255977768 returned by Eot_times.sunset_jd() ' do
117
- assert_equal 2455055.255977768, Eot_times.sunset_jd()
130
+ it 'expected 2455055.3128911955 from Eot_times.sunset_jd() ' do
131
+ assert_equal 2455055.3128911955, Eot_times.sunset_jd()
118
132
  end
119
133
 
120
- it 'expected -5.154916917299363 is returned by Eot_times.time_eot() ' do
121
- assert_equal -5.154916917299363, Eot_times.time_eot()
122
- end
123
-
124
- it 'expected [0.09609856262833676, 0.009234933739232362, 0.0008874638583081612, 8.528400116801221e-05, 8.195669927439366e-06,
125
- 7.87592099803208e-07, 7.568646872852184e-08, 7.2733608552255084e-09, 6.989595236643814e-10, 6.716900555953398e-11] returned by Eot_times.time_julian_century(@dt)' do
126
- assert_equal [0.09609856262833676, 0.009234933739232362, 0.0008874638583081612, 8.528400116801221e-05, 8.195669927439366e-06,
127
- 7.87592099803208e-07, 7.568646872852184e-08, 7.2733608552255084e-09, 6.989595236643814e-10, 6.716900555953398e-11], Eot_times.time_julian_century(@dt)
128
- end
129
-
130
- it 'expected [0.09609856262833676, 0.009234933739232362, 0.0008874638583081612, 8.528400116801221e-05, 8.195669927439366e-06,
131
- 7.87592099803208e-07, 7.568646872852184e-08, 7.2733608552255084e-09, 6.989595236643814e-10, 6.716900555953398e-11] returned by Eot_times.time_julian_century(@ajd)' do
132
- assert_equal [0.09609856262833676, 0.009234933739232362, 0.0008874638583081612, 8.528400116801221e-05, 8.195669927439366e-06,
133
- 7.87592099803208e-07, 7.568646872852184e-08, 7.2733608552255084e-09, 6.989595236643814e-10, 6.716900555953398e-11], Eot_times.time_julian_century(@ajd)
134
+ it 'expected -5.154920785891585 is from Eot_times.time_eot() ' do
135
+ assert_equal -5.154920785891585, Eot_times.time_eot()
134
136
  end
135
137
 
136
138
  end