equationoftime 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.rspec +1 -0
- data/Gemfile +4 -0
- data/LICENSE.md +22 -0
- data/LICENSE.txt +22 -0
- data/README.md +80 -0
- data/README2.txt +70 -0
- data/Rakefile +80 -0
- data/doc/GeoLatLng.html +770 -0
- data/doc/_index.html +123 -0
- data/doc/class_list.html +54 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +179 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +179 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +178 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +611 -0
- data/doc/top-level-namespace.html +112 -0
- data/equationoftime.gemspec +35 -0
- data/examples/Equation_of_Time.jpg +0 -0
- data/examples/analemma_data_generator.rb +53 -0
- data/examples/check_date_type.rb +57 -0
- data/examples/compare_geoc_long_ra.rb +31 -0
- data/examples/data_table.rb +26 -0
- data/examples/earth_rotation.rb +13 -0
- data/examples/eot_methods_list.rb +16 -0
- data/examples/eot_plot.r +57 -0
- data/examples/eot_suntimes.rb +140 -0
- data/examples/equation_of_time.py +186 -0
- data/examples/figure_1.jpg +0 -0
- data/examples/file_converter.rb +31 -0
- data/examples/from_readme.rb +10 -0
- data/examples/geo_locator.rb +12 -0
- data/examples/getjd.rb +45 -0
- data/examples/input_suntimes.rb +21 -0
- data/examples/julian_day_formula.rb +29 -0
- data/examples/julian_day_formula.txt +12 -0
- data/examples/my_time_conversion.rb +21 -0
- data/examples/nutation_series.txt +678 -0
- data/examples/nutation_series.yaml +14239 -0
- data/examples/nutation_table5_3a.txt +682 -0
- data/examples/nutation_table5_3a.yaml +9532 -0
- data/examples/ptime.rb +162 -0
- data/examples/read_nutation_data.rb +399 -0
- data/examples/suntimes.rb +28 -0
- data/examples/suntimes_test.rb +47 -0
- data/examples/test_poly_eval.rb +38 -0
- data/examples/time_scales.rb +29 -0
- data/examples/usage_example.rb +13 -0
- data/examples/use_angles.rb +155 -0
- data/lib/eot/angles.rb +337 -0
- data/lib/eot/constants.rb +168 -0
- data/lib/eot/displays.rb +213 -0
- data/lib/eot/geo_lat_lng_smt.rb +80 -0
- data/lib/eot/init.rb +93 -0
- data/lib/eot/nutation.rb +70 -0
- data/lib/eot/nutation_table5_3a.yaml +9532 -0
- data/lib/eot/times.rb +130 -0
- data/lib/eot/utilities.rb +129 -0
- data/lib/eot/version.rb +6 -0
- data/lib/eot.rb +11 -0
- data/tests/minitest/aliased_angles_spec.rb +287 -0
- data/tests/minitest/aliased_displays_spec.rb +106 -0
- data/tests/minitest/aliased_times_spec.rb +36 -0
- data/tests/minitest/aliased_utilities_spec.rb +49 -0
- data/tests/minitest/angles_spec.rb +313 -0
- data/tests/minitest/constants_spec.rb +27 -0
- data/tests/minitest/delta_epsilon_spec.rb +35 -0
- data/tests/minitest/displays_spec.rb +111 -0
- data/tests/minitest/geo_spec.rb +36 -0
- data/tests/minitest/init_spec.rb +32 -0
- data/tests/minitest/nutation_spec.rb +33 -0
- data/tests/minitest/times_spec.rb +137 -0
- data/tests/minitest/utilities_spec.rb +121 -0
- data/tests/spec_config.rb +3 -0
- data/wiki.md +46 -0
- data/wiki2.md +4 -0
- metadata +240 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
#
|
2
|
+
# uncomment below for minitest
|
3
|
+
gem 'minitest'
|
4
|
+
require 'minitest/autorun'
|
5
|
+
# require_relative '../spec_config'
|
6
|
+
lib = File.expand_path('../../../lib', __FILE__)
|
7
|
+
# puts "Loading gem from #{lib}/eot.rb"
|
8
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
9
|
+
require 'eot'
|
10
|
+
|
11
|
+
Eot_aliased_times = Eot.new
|
12
|
+
|
13
|
+
describe 'Eot_aliased_times defaults' 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.
|
18
|
+
|
19
|
+
before(:each) do
|
20
|
+
@ajd = 2456885.0
|
21
|
+
Eot_aliased_times.ajd = @ajd
|
22
|
+
Eot_aliased_times.ma_Sun()
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'expected 2456885.0 for Eot_aliased_times.ajd'do
|
26
|
+
assert_equal 2456885.0, Eot_aliased_times.ajd
|
27
|
+
assert_equal 220.63461047326172, Eot_aliased_times.ma
|
28
|
+
end
|
29
|
+
|
30
|
+
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_aliased_times.deg_to_rad() ' do
|
31
|
+
assert_equal [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], Eot_aliased_times.time_julian_centurey()
|
32
|
+
assert_equal [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], Eot_aliased_times.time_julian_centurey(nil)
|
33
|
+
assert_equal [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], Eot_aliased_times.time_julian_centurey(0)
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# aliased_utilities_spec.rb
|
2
|
+
#
|
3
|
+
# uncomment below for minitest
|
4
|
+
gem 'minitest'
|
5
|
+
require 'minitest/autorun'
|
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)
|
10
|
+
require 'eot'
|
11
|
+
|
12
|
+
Eot_aliased_utilities = Eot.new
|
13
|
+
|
14
|
+
describe 'Eot_aliased_utilities defaults' 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.
|
19
|
+
|
20
|
+
before(:each) do
|
21
|
+
@ajd = 2456885.0
|
22
|
+
Eot_aliased_utilities.ajd = @ajd
|
23
|
+
Eot_aliased_utilities.ma_Sun()
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'expected 2456885.0 for Eot_aliased_utilities.ajd'do
|
27
|
+
assert_equal 2456885.0, Eot_aliased_utilities.ajd
|
28
|
+
assert_equal 220.63461047326172, Eot_aliased_utilities.ma
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'expected 0.0 returned by Eot_aliased_utilities.degrees_to_radians() ' do
|
32
|
+
assert_equal 0.0, Eot_aliased_utilities.degrees_to_radians()
|
33
|
+
assert_equal 0.0, Eot_aliased_utilities.degrees_to_radians(nil)
|
34
|
+
assert_equal 0.0, Eot_aliased_utilities.degrees_to_radians(0)
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'expected 0.0 returned by Eot_aliased_utilities.radians_to_degrees() ' do
|
38
|
+
assert_equal 0.0, Eot_aliased_utilities.radians_to_degrees()
|
39
|
+
assert_equal 0.0, Eot_aliased_utilities.radians_to_degrees(nil)
|
40
|
+
assert_equal 0.0, Eot_aliased_utilities.radians_to_degrees(0)
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'expected 0.0 returned by Eot_aliased_utilities.truncate() ' do
|
44
|
+
assert_equal 0.0, Eot_aliased_utilities.truncate()
|
45
|
+
assert_equal 0.0, Eot_aliased_utilities.truncate(nil)
|
46
|
+
assert_equal 0.0, Eot_aliased_utilities.truncate(0)
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,313 @@
|
|
1
|
+
# angles_spec.rb
|
2
|
+
#
|
3
|
+
# comment below for rspec
|
4
|
+
gem 'minitest'
|
5
|
+
require 'minitest/autorun'
|
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)
|
10
|
+
require 'eot'
|
11
|
+
Eot_angles = Eot.new
|
12
|
+
describe 'Eot angles default, nil, 0' do
|
13
|
+
|
14
|
+
# set ma attribute first as it gets tested anyway but a lot of methods
|
15
|
+
# now rely on @ma so we don't have to keep calling it unless we change
|
16
|
+
# @ajd attribute.
|
17
|
+
|
18
|
+
before(:each) do
|
19
|
+
@ajd = 2456885.0
|
20
|
+
Eot_angles.ajd = @ajd
|
21
|
+
Eot_angles.ma_Sun()
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'expected 2456885.0 for Eot_angles.ajd'do
|
25
|
+
assert_equal 2456885.0, Eot_angles.ajd
|
26
|
+
assert_equal 220.63461047326172, Eot_angles.ma
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'expected 279.2295199333757 returned by Eot_angles.al_Sun()? ' do
|
30
|
+
assert_equal 279.2295199333757, Eot_angles.al_Sun()
|
31
|
+
assert_equal 279.2295199333757, Eot_angles.al_Sun(nil)
|
32
|
+
assert_equal 279.2295199333757, Eot_angles.al_Sun(0)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'expected -1.227333353065282 returned by Eot_angles.centre()? ' do
|
36
|
+
assert_equal -1.227333353065282, Eot_angles.center()
|
37
|
+
assert_equal -1.227333353065282, Eot_angles.center(nil)
|
38
|
+
assert_equal -1.227333353065282, Eot_angles.center(0)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'expected 0.16038975882741865 returned by Eot_angles.cosine_al_Sun()? ' do
|
42
|
+
assert_equal 0.16038975882741865, Eot_angles.cosine_al_Sun()
|
43
|
+
assert_equal 0.16038975882741865, Eot_angles.cosine_al_Sun(nil)
|
44
|
+
assert_equal 0.16038975882741865, Eot_angles.cosine_al_Sun(0)
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'expected 0.16055519782509398 returned by Eot_angles.cosine_tl_Sun()? ' do
|
48
|
+
assert_equal 0.16055519782509398, Eot_angles.cosine_tl_Sun()
|
49
|
+
assert_equal 0.16055519782509398, Eot_angles.cosine_tl_Sun(nil)
|
50
|
+
assert_equal 0.16055519782509398, Eot_angles.cosine_tl_Sun(0)
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'expected 0.9174932093012645 returned by Eot_angles.cosine_to_Earth()? ' do
|
54
|
+
assert_equal 0.9174932093012645, Eot_angles.cosine_to_Earth()
|
55
|
+
assert_equal 0.9174932093012645, Eot_angles.cosine_to_Earth(nil)
|
56
|
+
assert_equal 0.9174932093012645, Eot_angles.cosine_to_Earth(0)
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'expected -23.116504240687046 returned by Eot_angles.dec_Sun()? ' do
|
60
|
+
assert_equal -23.116504240687046, Eot_angles.dec_Sun()
|
61
|
+
assert_equal -23.116504240687046, Eot_angles.dec_Sun(nil)
|
62
|
+
assert_equal -23.116504240687046, Eot_angles.dec_Sun(0)
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'expected -0.0015940313608572006 returned by Eot_angles.delta_epsilon()? ' do
|
66
|
+
assert_equal -0.0015940313608572006, Eot_angles.delta_epsilon()
|
67
|
+
assert_equal -0.0015940313608572006, Eot_angles.delta_epsilon(nil)
|
68
|
+
assert_equal -0.0015940313608572006, Eot_angles.delta_epsilon(0)
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'expected -0.8041525701173668 returned by Eot_angles.delta_oblique()? ' do
|
72
|
+
assert_equal -0.8041525701173668, Eot_angles.delta_oblique()
|
73
|
+
assert_equal -0.8041525701173668, Eot_angles.delta_oblique(nil)
|
74
|
+
assert_equal -0.8041525701173668, Eot_angles.delta_oblique(0)
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'expected 1.2273333530652906 returned by Eot_angles.delta_orbit()? ' do
|
78
|
+
assert_equal 1.2273333530652906, Eot_angles.delta_orbit()
|
79
|
+
assert_equal 1.2273333530652906, Eot_angles.delta_orbit(nil)
|
80
|
+
assert_equal 1.2273333530652906, Eot_angles.delta_orbit(0)
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'expected -0.0038550497869660255 returned by Eot_angles.delta_psi()? ' do
|
84
|
+
assert_equal -0.0038550497869660255, Eot_angles.delta_psi()
|
85
|
+
assert_equal -0.0038550497869660255, Eot_angles.delta_psi(nil)
|
86
|
+
assert_equal -0.0038550497869660255, Eot_angles.delta_psi(0)
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'expected 0.016708617 returned by Eot_angles.eccentricity_Earth()? ' do
|
90
|
+
assert_equal 0.016708617, Eot_angles.eccentricity_Earth()
|
91
|
+
assert_equal 0.016708617, Eot_angles.eccentricity_Earth(nil)
|
92
|
+
assert_equal 0.016708617, Eot_angles.eccentricity_Earth(0)
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'expected -0.0035369820010596148 returned by Eot_angles.eq_of_equinox()? ' do
|
96
|
+
assert_equal -0.0035369820010596148, Eot_angles.eq_of_equinox()
|
97
|
+
assert_equal -0.0035369820010596148, Eot_angles.eq_of_equinox(nil)
|
98
|
+
assert_equal -0.0035369820010596148, Eot_angles.eq_of_equinox(0)
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'expected -1.120130505656931 returned by Eot_angles.eot()? ' do
|
102
|
+
assert_equal -1.120130505656931, Eot_angles.eot()
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'expected 280.4664567 returned by Eot_angles.gml_Sun()? ' do
|
106
|
+
assert_equal 280.4664567, Eot_angles.gml_Sun()
|
107
|
+
assert_equal 280.4664567, Eot_angles.gml_Sun(nil)
|
108
|
+
assert_equal 280.4664567, Eot_angles.gml_Sun(0)
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'expected 90.9060538240478 returned by Eot_angles.ha_Sun()? ' do
|
112
|
+
assert_equal 90.9060538240478, Eot_angles.ha_Sun()
|
113
|
+
assert_equal 90.9060538240478, Eot_angles.ha_Sun(nil)
|
114
|
+
assert_equal 90.9060538240478, Eot_angles.ha_Sun(0)
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'expected 220.63461047326172 returned by Eot_angles.ma_Sun()? ' do
|
118
|
+
assert_equal 220.63461047326172, Eot_angles.ma_Sun()
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'expected 280.460622404583 returned by Eot_angles.ml_Aries()? ' do
|
122
|
+
assert_equal 280.460622404583, Eot_angles.ml_Aries()
|
123
|
+
assert_equal 280.460622404583, Eot_angles.ml_Aries(nil)
|
124
|
+
assert_equal 280.460622404583, Eot_angles.ml_Aries(0)
|
125
|
+
end
|
126
|
+
|
127
|
+
it 'expected 23.439279444444445 returned by Eot_angles.mo_Earth()? ' do
|
128
|
+
assert_equal 23.439279444444445, Eot_angles.mo_Earth()
|
129
|
+
assert_equal 23.439279444444445, Eot_angles.mo_Earth(nil)
|
130
|
+
assert_equal 23.439279444444445, Eot_angles.mo_Earth(0)
|
131
|
+
end
|
132
|
+
|
133
|
+
it 'expected 125.04455501000001 returned by Eot_angles.omega()? ' do
|
134
|
+
assert_equal 125.04455501000001, Eot_angles.omega()
|
135
|
+
assert_equal 125.04455501000001, Eot_angles.omega(nil)
|
136
|
+
assert_equal 125.04455501000001, Eot_angles.omega(0)
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'expected 280.0432759170521 returned by Eot_angles.ra_Sun()? ' do
|
140
|
+
assert_equal 280.0432759170521, Eot_angles.ra_Sun()
|
141
|
+
assert_equal 280.0432759170521, Eot_angles.ra_Sun(nil)
|
142
|
+
assert_equal 280.0432759170521, Eot_angles.ra_Sun(0)
|
143
|
+
end
|
144
|
+
|
145
|
+
it 'expected -0.9870537600674456 returned by Eot_angles.sine_al_Sun()? ' do
|
146
|
+
assert_equal -0.9870537600674456, Eot_angles.sine_al_Sun()
|
147
|
+
assert_equal -0.9870537600674456, Eot_angles.sine_al_Sun(nil)
|
148
|
+
assert_equal -0.9870537600674456, Eot_angles.sine_al_Sun(0)
|
149
|
+
end
|
150
|
+
|
151
|
+
it 'expected -0.9870268630849643 returned by Eot_angles.sine_tl_Sun()? ' do
|
152
|
+
assert_equal -0.9870268630849643, Eot_angles.sine_tl_Sun()
|
153
|
+
assert_equal -0.9870268630849643, Eot_angles.sine_tl_Sun(nil)
|
154
|
+
assert_equal -0.9870268630849643, Eot_angles.sine_tl_Sun(0)
|
155
|
+
end
|
156
|
+
|
157
|
+
it 'expected 219.40727712019643 returned by Eot_angles.ta_Sun()? ' do
|
158
|
+
assert_equal 219.40727712019643, Eot_angles.ta_Sun()
|
159
|
+
assert_equal 219.40727712019643, Eot_angles.ta_Sun(nil)
|
160
|
+
assert_equal 219.40727712019643, Eot_angles.ta_Sun(0)
|
161
|
+
end
|
162
|
+
|
163
|
+
it 'expected 280.45708542258194 returned by Eot_angles.tl_Aries()? ' do
|
164
|
+
assert_equal 280.45708542258194, Eot_angles.tl_Aries()
|
165
|
+
assert_equal 280.45708542258194, Eot_angles.tl_Aries(nil)
|
166
|
+
assert_equal 280.45708542258194, Eot_angles.tl_Aries(0)
|
167
|
+
end
|
168
|
+
|
169
|
+
it 'expected 279.2391233469347 returned by Eot_angles.tl_Sun()? ' do
|
170
|
+
assert_equal 279.2391233469347, Eot_angles.tl_Sun()
|
171
|
+
assert_equal 279.2391233469347, Eot_angles.tl_Sun(nil)
|
172
|
+
assert_equal 279.2391233469347, Eot_angles.tl_Sun(0)
|
173
|
+
end
|
174
|
+
|
175
|
+
it 'expected 23.43768541308359 returned by Eot_angles.to_Earth()? ' do
|
176
|
+
assert_equal 23.43768541308359, Eot_angles.to_Earth()
|
177
|
+
assert_equal 23.43768541308359, Eot_angles.to_Earth(nil)
|
178
|
+
assert_equal 23.43768541308359, Eot_angles.to_Earth(0)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
describe ' Eot angles tjc array for jd 2455055.5 a non default value' do
|
185
|
+
|
186
|
+
# set ma attribute first as it gets tested anyway but a lot of methods
|
187
|
+
# now rely on @ma so we don't have to keep calling it unless we change
|
188
|
+
# @ajd attribute
|
189
|
+
before(:each) do
|
190
|
+
@ajd = 2455055.0
|
191
|
+
Eot_angles.ajd = @ajd
|
192
|
+
@dt = Eot_angles.ajd_to_datetime(@ajd)
|
193
|
+
Eot_angles.date = @dt
|
194
|
+
Eot_angles.ma_Sun
|
195
|
+
@ta = Eot_angles.time_julian_century(@ajd)
|
196
|
+
end
|
197
|
+
|
198
|
+
it 'expected 2455055.0, returned by Eot_angles.' do
|
199
|
+
assert_equal 2455055.0, Eot_angles.ajd
|
200
|
+
end
|
201
|
+
|
202
|
+
it 'expected "2009-08-11T12:00:00+00:00", returned by Eot_angles.date.to_s' do
|
203
|
+
assert_equal "2009-08-11T12:00:00+00:00", Eot_angles.date.to_s
|
204
|
+
end
|
205
|
+
|
206
|
+
it 'expected 216.98609672514223, returned by Eot_angles.' do
|
207
|
+
assert_equal 216.98609672514223, Eot_angles.ma
|
208
|
+
end
|
209
|
+
|
210
|
+
it 'expected 138.95453031575755 returned by Eot_angles.al_Sun(@ta)? ' do
|
211
|
+
assert_equal 138.95453031575755, Eot_angles.al_Sun(@ta)
|
212
|
+
end
|
213
|
+
|
214
|
+
it 'expected -1.1326466587538162 returned by Eot_angles.centre(@ta)? ' do
|
215
|
+
assert_equal -1.1326466587538162, Eot_angles.center(@ta)
|
216
|
+
end
|
217
|
+
|
218
|
+
it 'expected -0.7541886969973313 returned by Eot_angles.cosine_al_Sun(@ta)? ' do
|
219
|
+
assert_equal -0.7541886969973313, Eot_angles.cosine_al_Sun(@ta)
|
220
|
+
end
|
221
|
+
|
222
|
+
it 'expected -0.7542060769934986 returned by Eot_angles.cosine_tl_Sun(@ta)? ' do
|
223
|
+
assert_equal -0.7542060769934986, Eot_angles.cosine_tl_Sun(@ta)
|
224
|
+
end
|
225
|
+
|
226
|
+
it 'expected 0.9174818406562965 returned by Eot_angles.cosine_to_Earth(@ta)? ' do
|
227
|
+
assert_equal 0.9174818406562965, Eot_angles.cosine_to_Earth(@ta)
|
228
|
+
end
|
229
|
+
|
230
|
+
it 'expected 15.141502782959178 returned by Eot_angles.dec_Sun(@ta)? ' do
|
231
|
+
assert_equal 15.141502782959178, Eot_angles.dec_Sun(@ta)
|
232
|
+
end
|
233
|
+
|
234
|
+
it 'expected 0.001293821738156411 returned by Eot_angles.delta_epsilon(@ta)? ' do
|
235
|
+
assert_equal 0.001293821738156411, Eot_angles.delta_epsilon(@ta).round(18)
|
236
|
+
end
|
237
|
+
|
238
|
+
it 'expected -2.42490431188628 returned by Eot_angles.delta_oblique(@ta)? ' do
|
239
|
+
assert_equal -2.42490431188628, Eot_angles.delta_oblique(@ta)
|
240
|
+
end
|
241
|
+
|
242
|
+
it 'expected 1.1326466587538278 returned by Eot_angles.delta_orbit(@ta)? ' do
|
243
|
+
assert_equal 1.1326466587538278, Eot_angles.delta_orbit(@ta)
|
244
|
+
end
|
245
|
+
|
246
|
+
it 'expected 0.0043768851558214535 returned by Eot_angles.delta_psi(@ta)? ' do
|
247
|
+
assert_equal 0.0043768851558214535, Eot_angles.delta_psi(@ta)
|
248
|
+
end
|
249
|
+
|
250
|
+
it 'expected 0.016704576164208475 returned by Eot_angles.eccentricity_Earth(@ta)? ' do
|
251
|
+
assert_equal 0.016704576164208475, Eot_angles.eccentricity_Earth(@ta)
|
252
|
+
end
|
253
|
+
|
254
|
+
it 'expected 0.004015712649104288 returned by Eot_angles.eq_of_equinox(@ta)? ' do
|
255
|
+
assert_equal 0.004015712649104288, Eot_angles.eq_of_equinox(@ta)
|
256
|
+
end
|
257
|
+
|
258
|
+
it 'expected -1.2922576531324523 returned by Eot_angles.eot()? ' do
|
259
|
+
assert_equal -1.2922576531324523, Eot_angles.eot()
|
260
|
+
end
|
261
|
+
|
262
|
+
it 'expected 140.08869346549056 returned by Eot_angles.gml_Sun(@ta)? ' do
|
263
|
+
assert_equal 140.08869346549056, Eot_angles.gml_Sun(@ta)
|
264
|
+
end
|
265
|
+
|
266
|
+
it 'expected 90.86327177163999 returned by Eot_angles.ha_Sun(@ta)? ' do
|
267
|
+
assert_equal 90.86327177163999, Eot_angles.ha_Sun(@ta)
|
268
|
+
end
|
269
|
+
|
270
|
+
it 'expected 216.98609672514223 returned by Eot_angles.ma_Sun()? ' do
|
271
|
+
assert_equal 216.98609672514223, Eot_angles.ma_Sun()
|
272
|
+
end
|
273
|
+
|
274
|
+
it 'expected 140.08287431273857 returned by Eot_angles.ml_Aries(@ta)? ' do
|
275
|
+
assert_equal 140.08287431273857, Eot_angles.ml_Aries(@ta)
|
276
|
+
end
|
277
|
+
|
278
|
+
it 'expected 23.43802918164109 returned by Eot_angles.mo_Earth(@ta)? ' do
|
279
|
+
assert_equal 23.43802918164109, Eot_angles.mo_Earth(@ta)
|
280
|
+
end
|
281
|
+
|
282
|
+
it 'expected -60.82314052284639 returned by Eot_angles.omega(@ta)? ' do
|
283
|
+
assert_equal -60.82314052284639, Eot_angles.omega(@ta)
|
284
|
+
end
|
285
|
+
|
286
|
+
it 'expected 141.38095111862302 returned by Eot_angles.ra_Sun(@ta)? ' do
|
287
|
+
assert_equal 141.38095111862302, Eot_angles.ra_Sun(@ta)
|
288
|
+
end
|
289
|
+
|
290
|
+
it 'expected 0.6566577566141039 returned by Eot_angles.sine_al_Sun(@ta)? ' do
|
291
|
+
assert_equal 0.6566577566141039, Eot_angles.sine_al_Sun(@ta)
|
292
|
+
end
|
293
|
+
|
294
|
+
it 'expected 0.6566377946981706 returned by Eot_angles.sine_tl_Sun(@ta)? ' do
|
295
|
+
assert_equal 0.6566377946981706, Eot_angles.sine_tl_Sun(@ta)
|
296
|
+
end
|
297
|
+
|
298
|
+
it 'expected 215.8534500663884 returned by Eot_angles.ta_Sun(@ta)? ' do
|
299
|
+
assert_equal 215.8534500663884, Eot_angles.ta_Sun(@ta)
|
300
|
+
end
|
301
|
+
|
302
|
+
it 'expected 140.08689002538767 returned by Eot_angles.tl_Aries(@ta)? ' do
|
303
|
+
assert_equal 140.08689002538767, Eot_angles.tl_Aries(@ta)
|
304
|
+
end
|
305
|
+
|
306
|
+
it 'expected 138.95604680673674 returned by Eot_angles.tl_Sun(@ta)? ' do
|
307
|
+
assert_equal 138.95604680673674, Eot_angles.tl_Sun(@ta)
|
308
|
+
end
|
309
|
+
|
310
|
+
it 'expected 23.439323003379247 returned by Eot_angles.to_Earth(@ta)? ' do
|
311
|
+
assert_equal 23.439323003379247, Eot_angles.to_Earth(@ta)
|
312
|
+
end
|
313
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# constants_spec.rb
|
2
|
+
#
|
3
|
+
# uncomment below for minitest
|
4
|
+
gem 'minitest'
|
5
|
+
require 'minitest/autorun'
|
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)
|
10
|
+
require 'eot'
|
11
|
+
|
12
|
+
describe "Equation of Time constants." do
|
13
|
+
|
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
|
+
assert_equal 24.0, Eot::DAY_HOURS
|
19
|
+
assert_equal 1440.0, Eot::DAY_MINUTES
|
20
|
+
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
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# uncomment below for minitest
|
2
|
+
gem 'minitest'
|
3
|
+
require 'minitest/autorun'
|
4
|
+
# require_relative '../spec_config'
|
5
|
+
|
6
|
+
lib = File.expand_path('../../../lib', __FILE__)
|
7
|
+
# puts "Loading gem from #{lib}/eot.rb"
|
8
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
9
|
+
require 'eot'
|
10
|
+
|
11
|
+
Eot_first = Eot.new
|
12
|
+
|
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.
|
18
|
+
|
19
|
+
before(:each) do
|
20
|
+
@ajd = 2456885.0
|
21
|
+
Eot_first.ajd = @ajd
|
22
|
+
Eot_first.ma_Sun()
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'expected 2456885.0 for Eot_first.ajd'do
|
26
|
+
assert_equal 2456885.0, Eot_first.ajd
|
27
|
+
assert_equal 220.63461047326172, Eot_first.ma
|
28
|
+
end
|
29
|
+
|
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)
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
# displays_spec.rb
|
2
|
+
#
|
3
|
+
# uncomment below for minitest
|
4
|
+
gem 'minitest'
|
5
|
+
require 'minitest/autorun'
|
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)
|
10
|
+
require 'eot'
|
11
|
+
|
12
|
+
Eot_displays = Eot.new
|
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.
|
19
|
+
before(:each) do
|
20
|
+
@ajd = 2456885.0
|
21
|
+
Eot_displays.ajd = @ajd
|
22
|
+
Eot_displays.ma_Sun()
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'expected 2456885.0 for Eot_displays.ajd'do
|
26
|
+
assert_equal 2456885.0, Eot_displays.ajd
|
27
|
+
assert_equal 220.63461047326172, Eot_displays.ma
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'expected "+000:00:00.000" returned by Eot_displays.degrees_to_s() ' do
|
31
|
+
assert_equal "+000:00:00.000", Eot_displays.degrees_to_s()
|
32
|
+
assert_equal "+000:00:00.000", Eot_displays.degrees_to_s(nil)
|
33
|
+
assert_equal "+000:00:00.000", Eot_displays.degrees_to_s(0)
|
34
|
+
end
|
35
|
+
|
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)
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'expected "12:00:00" returned by Eot_displays.string_day_fraction_to_time() ' do
|
43
|
+
assert_equal "12:00:00", Eot_displays.string_day_fraction_to_time()
|
44
|
+
assert_equal "12:00:00", Eot_displays.string_day_fraction_to_time(nil)
|
45
|
+
assert_equal "12:00:00", Eot_displays.string_day_fraction_to_time(0)
|
46
|
+
end
|
47
|
+
|
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
|
+
end
|
53
|
+
|
54
|
+
it 'expected "-04m, 28.9s" returned by Eot_displays.string_eot() ' do
|
55
|
+
assert_equal "-04m, 28.9s", Eot_displays.string_eot()
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'expected "2000-01-01" returned by Eot_displays.string_jd_to_date() ' do
|
59
|
+
assert_equal "2000-01-01", Eot_displays.string_jd_to_date()
|
60
|
+
assert_equal "2000-01-01", Eot_displays.string_jd_to_date(nil)
|
61
|
+
assert_equal "2000-01-01", Eot_displays.string_jd_to_date(0)
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'expected "+220:38:04.597" returned by Eot_displays.string_ma_Sun() ' do
|
65
|
+
assert_equal "+220:38:04.597", Eot_displays.string_ma_Sun()
|
66
|
+
end
|
67
|
+
|
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)
|
72
|
+
end
|
73
|
+
|
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
|
+
end
|
79
|
+
|
80
|
+
it 'expected "12:00:00.000" returned by Eot_displays.string_time() ' do
|
81
|
+
assert_equal "12:00:00.000", Eot_displays.string_time()
|
82
|
+
assert_equal "12:00:00.000", Eot_displays.string_time(nil)
|
83
|
+
assert_equal "12:00:00.000", Eot_displays.string_time(0)
|
84
|
+
end
|
85
|
+
|
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)
|
90
|
+
end
|
91
|
+
|
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
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
describe 'Eot displays explicit values' do
|
101
|
+
|
102
|
+
it 'expected "16:40:40.800" returned by Eot_displays.string_time(16.6780) ' do
|
103
|
+
assert_equal "16:40:40.800", Eot_displays.string_time(16.6780)
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'expected "17:59:16.800" returned by Eot_displays.string_time(17988) ' do
|
107
|
+
Eot_displays.date= Date.today.to_s
|
108
|
+
assert_equal "17:59:16.800", Eot_displays.string_time(17.988)
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# geo_spec.rb
|
2
|
+
#
|
3
|
+
# uncomment below for minitest
|
4
|
+
gem 'minitest'
|
5
|
+
require 'minitest/autorun'
|
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)
|
10
|
+
require 'eot'
|
11
|
+
|
12
|
+
Geo = GeoLatLng.new
|
13
|
+
|
14
|
+
describe 'Geo defaults' do
|
15
|
+
|
16
|
+
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
|
18
|
+
end
|
19
|
+
|
20
|
+
it'expected "Blackheath Ave, London SE10 8XJ, UK" 'do
|
21
|
+
assert_equal "Blackheath Ave, London SE10 8XJ, UK", Geo.default_int
|
22
|
+
end
|
23
|
+
|
24
|
+
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
|
26
|
+
end
|
27
|
+
|
28
|
+
it'expected 0.0'do
|
29
|
+
assert_equal 0.0, Geo.lat
|
30
|
+
end
|
31
|
+
|
32
|
+
it'expected 0.0'do
|
33
|
+
assert_equal 0.0, Geo.lng
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# init_spec.rb
|
2
|
+
#
|
3
|
+
# uncomment below for minitest
|
4
|
+
gem 'minitest'
|
5
|
+
require 'minitest/autorun'
|
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)
|
10
|
+
require 'eot'
|
11
|
+
|
12
|
+
Eot_initialize = Eot.new
|
13
|
+
|
14
|
+
describe 'Eot methods for init.rb' do
|
15
|
+
|
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
|
25
|
+
end
|
26
|
+
|
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
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# nutation_spec.rb
|
2
|
+
#
|
3
|
+
# uncomment below for minitest
|
4
|
+
gem 'minitest'
|
5
|
+
require 'minitest/autorun'
|
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)
|
10
|
+
require 'eot'
|
11
|
+
|
12
|
+
Eot_nutation = Eot.new
|
13
|
+
|
14
|
+
describe "Eot_nutation default" do
|
15
|
+
|
16
|
+
before(:each) do
|
17
|
+
@ajd = 2456885.0
|
18
|
+
Eot_nutation.ajd = @ajd
|
19
|
+
Eot_nutation.ma_Sun()
|
20
|
+
end
|
21
|
+
|
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
|
25
|
+
end
|
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]
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|