equationoftime 4.1.6 → 4.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitignore +24 -0
- data/Gemfile.lock +1 -1
- data/Rakefile +32 -10
- data/equationoftime.gemspec +1 -1
- data/lib/eot/delta_times.rb +24 -0
- data/lib/eot/jd_times.rb +73 -0
- data/lib/eot/version.rb +1 -1
- metadata +51 -62
- data/.gemtest +0 -0
- data/examples/Equation_of_Time.png +0 -0
- data/examples/my_lst.rb +0 -11
- data/examples/use_addr.rb +0 -20
- data/examples/use_ajd.rb +0 -40
- data/test/eot/aliased_angles_spec.rb +0 -293
- data/test/eot/aliased_displays_spec.rb +0 -127
- data/test/eot/aliased_utilities_spec.rb +0 -34
- data/test/eot/angles_spec.rb +0 -264
- data/test/eot/constants_spec.rb +0 -18
- data/test/eot/displays_spec.rb +0 -114
- data/test/eot/geo_spec.rb +0 -40
- data/test/eot/init_spec.rb +0 -45
- data/test/eot/times_spec.rb +0 -199
data/test/eot/angles_spec.rb
DELETED
@@ -1,264 +0,0 @@
|
|
1
|
-
# angles_spec.rb
|
2
|
-
gem 'minitest'
|
3
|
-
require 'minitest/autorun'
|
4
|
-
lib = File.expand_path('../../../lib', __FILE__)
|
5
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
6
|
-
require 'eot'
|
7
|
-
|
8
|
-
angles = Eot.new
|
9
|
-
|
10
|
-
describe 'Tests ajd of 2456885.0 ' do
|
11
|
-
|
12
|
-
before(:each) do
|
13
|
-
angles.ajd = 2_456_885.0
|
14
|
-
ajd = angles.ajd
|
15
|
-
angles.ma_ta_set
|
16
|
-
# check date for this ajd when needed.
|
17
|
-
angles.date = angles.ajd_to_datetime(ajd)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'expected 2456885.0 for angles.ajd'do
|
21
|
-
assert_equal(2_456_885.0, angles.ajd)
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'expected "2014-08-15T12:00:00+00:00" for angles.date'.to_s do
|
25
|
-
assert_equal('2014-08-15T12:00:00+00:00', angles.date.to_s)
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'expected 3.8508003966038915 for angles.ma'do
|
29
|
-
assert_equal(3.8508003966038915, angles.ma)
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'expected 2.4887103398436143 from angles.al_sun()? ' do
|
33
|
-
assert_equal(2.4887103398436143, angles.al_sun)
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'expected -0.021413249720702462 from angles.centre()? ' do
|
37
|
-
assert_equal(-0.021413249720702462, angles.center)
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'expected -0.7943361570447028 from angles.cosine_al_sun()? ' do
|
41
|
-
assert_equal(-0.7943361570447028, angles.cosine_al_sun)
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'expected -0.7943772759574919 from angles.cosine_tl_sun()? ' do
|
45
|
-
assert_equal(-0.7943772759574919, angles.cosine_tl_sun)
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'expected 0.9175115346811911 from angles.cosine_to_earth()? ' do
|
49
|
-
assert_equal(0.9175115346811911, angles.cosine_to_earth)
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'expected 0.24401410218543554 from angles.dec_sun()? ' do
|
53
|
-
assert_equal(0.24401410218543554, angles.dec_sun)
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'expected -4.069792718159396e-05 from angles.delta_epsilon()? ' do
|
57
|
-
assert_equal(-4.069792718159396e-05, angles.delta_epsilon)
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'expected -0.04103082558803539 from angles.delta_oblique()? ' do
|
61
|
-
assert_equal(-0.04103082558803539, angles.delta_oblique)
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'expected 0.021413249720702462 from angles.delta_orbit()? ' do
|
65
|
-
assert_equal(0.021413249720702462, angles.delta_orbit)
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'expected 3.75123821843003e-05 from angles.delta_psi()? ' do
|
69
|
-
assert_equal(3.75123821843003e-05, angles.delta_psi)
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'expected 0.016702468499021204 from \
|
73
|
-
angles.eccentricity_earth()? ' do
|
74
|
-
assert_equal(0.016702468499021204, angles.eccentricity_earth)
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'expected 3.4412912434333975e-05 from angles.eq_of_equinox()? ' do
|
78
|
-
assert_equal(3.4412912434333975e-05, angles.eq_of_equinox)
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'expected -0.01961757586733293 from angles.eot()? ' do
|
82
|
-
assert_equal(-0.01961757586733293, angles.eot)
|
83
|
-
end
|
84
|
-
|
85
|
-
it 'expected 2.5101912804141424 from angles.gml_sun()? ' do
|
86
|
-
assert_equal(2.5101912804141424, angles.gml_sun)
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'expected 1.5857841877939605 from angles.ha_sun(1)? ' do
|
90
|
-
assert_equal(1.5857841877939605, angles.ha_sun(1))
|
91
|
-
end
|
92
|
-
|
93
|
-
it 'expected 3.8508003966038915 from angles.ma_sun()? ' do
|
94
|
-
assert_equal(3.8508003966038915, angles.ma_sun)
|
95
|
-
end
|
96
|
-
|
97
|
-
it 'expected 2.510089864980358 from angles.ml_aries()? ' do
|
98
|
-
assert_equal(2.510089864980358, angles.ml_aries)
|
99
|
-
end
|
100
|
-
|
101
|
-
it 'expected 0.40905940254265843 from angles.mo_earth()? ' do
|
102
|
-
assert_equal(0.40905940254265843, angles.mo_earth)
|
103
|
-
end
|
104
|
-
|
105
|
-
it 'expected -2.7528817371494685 from angles.omega()? ' do
|
106
|
-
assert_equal(-2.7528817371494685, angles.omega)
|
107
|
-
end
|
108
|
-
|
109
|
-
it 'expected 2.5297411654316497 from angles.ra_sun()? ' do
|
110
|
-
assert_equal(2.5297411654316497, angles.ra_sun)
|
111
|
-
end
|
112
|
-
|
113
|
-
it 'expected 0.6074784519729512 from angles.sine_al_sun()? ' do
|
114
|
-
assert_equal(0.6074784519729512, angles.sine_al_sun)
|
115
|
-
end
|
116
|
-
|
117
|
-
it 'expected 0.6074246812917259 from angles.sine_tl_sun()? ' do
|
118
|
-
assert_equal(0.6074246812917259, angles.sine_tl_sun)
|
119
|
-
end
|
120
|
-
|
121
|
-
it 'expected 3.8293871468831893 from angles.ta_sun()? ' do
|
122
|
-
assert_equal(3.8293871468831893, angles.ta_sun)
|
123
|
-
end
|
124
|
-
|
125
|
-
it 'expected 2.5101242776531474 from angles.tl_aries()? ' do
|
126
|
-
assert_equal(2.5101242776531474, angles.tl_aries)
|
127
|
-
end
|
128
|
-
|
129
|
-
it 'expected 2.48877803069344 from angles.tl_sun()? ' do
|
130
|
-
assert_equal(2.48877803069344, angles.tl_sun)
|
131
|
-
end
|
132
|
-
|
133
|
-
it 'expected 0.40901870461547685 from angles.to_earth()? ' do
|
134
|
-
assert_equal(0.40901870461547685, angles.to_earth)
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
describe 'Tests ajd of 2455055.5 ' do
|
139
|
-
|
140
|
-
before(:each) do
|
141
|
-
angles.ajd = 2_455_055.0
|
142
|
-
ajd = angles.ajd
|
143
|
-
angles.ma_ta_set
|
144
|
-
# check date for this ajd when needed.
|
145
|
-
angles.date = angles.ajd_to_datetime(ajd)
|
146
|
-
end
|
147
|
-
|
148
|
-
it 'expected 2455055.0, from angles.' do
|
149
|
-
assert_equal(2_455_055.0, angles.ajd)
|
150
|
-
end
|
151
|
-
|
152
|
-
it 'expected "2009-08-11T12:00:00+00:00", from angles.date.to_s' do
|
153
|
-
assert_equal('2009-08-11T12:00:00+00:00', angles.date.to_s)
|
154
|
-
end
|
155
|
-
|
156
|
-
it 'expected 3.7871218188949207, from angles.' do
|
157
|
-
assert_equal(3.7871218188949207, angles.ma)
|
158
|
-
end
|
159
|
-
|
160
|
-
it 'expected 2.4252140645725033 from angles.al_sun()? ' do
|
161
|
-
assert_equal(2.4252140645725033, angles.al_sun)
|
162
|
-
end
|
163
|
-
|
164
|
-
it 'expected -0.019768413456709915 from angles.center()? ' do
|
165
|
-
assert_equal(-0.019768413456709915, angles.center)
|
166
|
-
end
|
167
|
-
|
168
|
-
it 'expected -0.7541886969975007 from angles.cosine_al_sun()? ' do
|
169
|
-
assert_equal(-0.7541886969975007, angles.cosine_al_sun)
|
170
|
-
end
|
171
|
-
|
172
|
-
it 'expected -0.7542060769936684 from angles.cosine_tl_sun()? ' do
|
173
|
-
assert_equal(-0.7542060769936684, angles.cosine_tl_sun)
|
174
|
-
end
|
175
|
-
|
176
|
-
it 'expected 0.9174818088112336 from angles.cosine_to_earth()? ' do
|
177
|
-
assert_equal(0.9174818088112336, angles.cosine_to_earth)
|
178
|
-
end
|
179
|
-
|
180
|
-
it 'expected 0.2642691272294404 from angles.dec_sun()? ' do
|
181
|
-
assert_equal(0.2642691272294404, angles.dec_sun)
|
182
|
-
end
|
183
|
-
|
184
|
-
it 'expected 2.2661506700250296e-05 from angles.delta_epsilon()? ' do
|
185
|
-
assert_equal(2.2661506700250296e-05, angles.delta_epsilon)
|
186
|
-
end
|
187
|
-
|
188
|
-
it 'expected -0.04234904897476355 from angles.delta_oblique()? ' do
|
189
|
-
assert_equal(-0.04234904897476355, angles.delta_oblique)
|
190
|
-
end
|
191
|
-
|
192
|
-
it 'expected 0.019768413456709915 from angles.delta_orbit()? ' do
|
193
|
-
assert_equal(0.019768413456709915, angles.delta_orbit)
|
194
|
-
end
|
195
|
-
|
196
|
-
it 'expected 7.639341522992976e-05 from angles.delta_psi()? ' do
|
197
|
-
assert_equal(7.639341522992976e-05, angles.delta_psi)
|
198
|
-
end
|
199
|
-
|
200
|
-
it 'expected 0.016704576164208475 from \
|
201
|
-
angles.eccentricity_earth()? ' do
|
202
|
-
assert_equal(0.016704576164208475, angles.eccentricity_earth)
|
203
|
-
end
|
204
|
-
|
205
|
-
it 'expected 7.007879585074761e-05 from angles.eq_of_equinox()? ' do
|
206
|
-
assert_equal(7.007879585074761e-05, angles.eq_of_equinox)
|
207
|
-
end
|
208
|
-
|
209
|
-
it 'expected -0.022580635518053633 from angles.eot()? ' do
|
210
|
-
assert_equal(-0.022580635518053633, angles.eot)
|
211
|
-
end
|
212
|
-
|
213
|
-
it 'expected 2.445008945789877 from angles.gml_sun()? ' do
|
214
|
-
assert_equal(2.445008945789877, angles.gml_sun)
|
215
|
-
end
|
216
|
-
|
217
|
-
it 'expected 1.585863261753274 from angles.ha_sun(1)? ' do
|
218
|
-
assert_equal(1.585863261753274, angles.ha_sun(1))
|
219
|
-
end
|
220
|
-
|
221
|
-
it 'expected 3.7871218188949207 from angles.ma_sun()? ' do
|
222
|
-
assert_equal(3.7871218188949207, angles.ma_sun)
|
223
|
-
end
|
224
|
-
|
225
|
-
it 'expected 2.444907382260759 from angles.ml_aries()? ' do
|
226
|
-
assert_equal(2.444907382260759, angles.ml_aries)
|
227
|
-
end
|
228
|
-
|
229
|
-
it 'expected 0.4090707793981491 from angles.mo_earth()? ' do
|
230
|
-
assert_equal(0.4090707793981491, angles.mo_earth)
|
231
|
-
end
|
232
|
-
|
233
|
-
it 'expected -1.0615640635268548 from angles.omega()? ' do
|
234
|
-
assert_equal(-1.0615640635268548, angles.omega)
|
235
|
-
end
|
236
|
-
|
237
|
-
it 'expected 2.467563113547267 from angles.ra_sun()? ' do
|
238
|
-
assert_equal(2.467563113547267, angles.ra_sun)
|
239
|
-
end
|
240
|
-
|
241
|
-
it 'expected 0.6566577566139093 from angles.sine_al_sun()? ' do
|
242
|
-
assert_equal(0.6566577566139093, angles.sine_al_sun)
|
243
|
-
end
|
244
|
-
|
245
|
-
it 'expected 0.6566377946979757 from angles.sine_tl_sun()? ' do
|
246
|
-
assert_equal(0.6566377946979757, angles.sine_tl_sun)
|
247
|
-
end
|
248
|
-
|
249
|
-
it 'expected 3.767353405438211 from angles.ta_sun()? ' do
|
250
|
-
assert_equal(3.767353405438211, angles.ta_sun)
|
251
|
-
end
|
252
|
-
|
253
|
-
it 'expected 2.4449774607872907 from angles.tl_aries()? ' do
|
254
|
-
assert_equal(2.4449774607872907, angles.tl_aries)
|
255
|
-
end
|
256
|
-
|
257
|
-
it 'expected 2.4252405323331674 from angles.tl_sun()? ' do
|
258
|
-
assert_equal(2.4252405323331674, angles.tl_sun)
|
259
|
-
end
|
260
|
-
|
261
|
-
it 'expected 0.4090934409048494 from angles.to_earth()? ' do
|
262
|
-
assert_equal(0.4090934409048494, angles.to_earth)
|
263
|
-
end
|
264
|
-
end
|
data/test/eot/constants_spec.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# constants_spec.rb
|
2
|
-
gem 'minitest'
|
3
|
-
require 'minitest/autorun'
|
4
|
-
lib = File.expand_path('../../../lib', __FILE__)
|
5
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
6
|
-
require 'eot'
|
7
|
-
|
8
|
-
describe 'Equation of Time constants.' do
|
9
|
-
|
10
|
-
it "01 require 'eot' should find all constants." do
|
11
|
-
assert_equal 24.0, Eot::DAY_HOURS
|
12
|
-
assert_equal 1440.0, Eot::DAY_MINUTES
|
13
|
-
assert_equal 86_400.0, Eot::DAY_SECONDS
|
14
|
-
assert_equal 86_400.0 * 1.0e+6, Eot::DAY_USECS
|
15
|
-
assert_equal 57.29577951308232, Eot::R2D
|
16
|
-
assert_equal 0.017453292519943295, Eot::D2R
|
17
|
-
end
|
18
|
-
end
|
data/test/eot/displays_spec.rb
DELETED
@@ -1,114 +0,0 @@
|
|
1
|
-
# displays_spec.rb
|
2
|
-
|
3
|
-
gem 'minitest'
|
4
|
-
require 'minitest/autorun'
|
5
|
-
lib = File.expand_path('../../../lib', __FILE__)
|
6
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
7
|
-
require 'eot'
|
8
|
-
|
9
|
-
displays = Eot.new
|
10
|
-
|
11
|
-
describe 'Eot displays using ajd of 2456885.0' do
|
12
|
-
|
13
|
-
before(:each) do
|
14
|
-
displays.ajd = 2_456_885.0
|
15
|
-
ajd = displays.ajd
|
16
|
-
displays.ma_ta_set
|
17
|
-
# check date for this ajd when needed.
|
18
|
-
displays.date = displays.ajd_to_datetime(ajd)
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'expected 2456885.0 for displays.ajd'do
|
22
|
-
assert_equal 2_456_885.0, displays.ajd
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'expected "2014-08-15T12:00:00+00:00", from displays.date.to_s' do
|
26
|
-
assert_equal '2014-08-15T12:00:00+00:00', displays.date.to_s
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'expected 3.8508003966038915, from displays.' do
|
30
|
-
assert_equal 3.8508003966038915, displays.ma
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'expected "+000:00:00.000" from displays.degrees_to_s() ' do
|
34
|
-
assert_equal '+000:00:00.000', displays.degrees_to_s
|
35
|
-
assert_equal '+000:00:00.000', displays.degrees_to_s(nil)
|
36
|
-
assert_equal '+000:00:00.000', displays.degrees_to_s(0)
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'expected "+142:35:33.356" from displays.string_al_sun() ' do
|
40
|
-
assert_equal '+142:35:33.356', displays.string_al_sun
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'expected "12:00:00" from displays.string_day_fraction_to_time() ' do
|
44
|
-
assert_equal '12:00:00', displays.string_day_fraction_to_time
|
45
|
-
assert_equal '12:00:00', displays.string_day_fraction_to_time(nil)
|
46
|
-
assert_equal '12:00:00', displays.string_day_fraction_to_time(0)
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'expected "+013:58:51.522" from displays.string_dec_sun() ' do
|
50
|
-
assert_equal '+013:58:51.522', displays.string_dec_sun
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'expected "-04m, 29.2s" from displays.string_eot() ' do
|
54
|
-
assert_equal '-04m, 29.2s', displays.string_eot
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'expected "2000-01-01" from displays.string_jd_to_date() ' do
|
58
|
-
assert_equal '2000-01-01', displays.string_jd_to_date
|
59
|
-
assert_equal '2000-01-01', displays.string_jd_to_date(nil)
|
60
|
-
assert_equal '2000-01-01', displays.string_jd_to_date(0)
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'expected "2014-08-15" from \
|
64
|
-
displays.jd_to_date_string(displays.ajd)? ' do
|
65
|
-
assert_equal '2014-08-15', displays.jd_to_date_string(displays.ajd)
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'expected "+220:38:04.598" from displays.string_ma_sun() ' do
|
69
|
-
assert_equal '+220:38:04.598', displays.string_ma_sun
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'expected "+144:56:36.571" from displays.string_ra_sun() ' do
|
73
|
-
assert_equal '+144:56:36.571', displays.string_ra_sun
|
74
|
-
end
|
75
|
-
|
76
|
-
it 'expected "+219:24:27.798" from displays.string_ta_sun() ' do
|
77
|
-
assert_equal '+219:24:27.798', displays.string_ta_sun
|
78
|
-
end
|
79
|
-
|
80
|
-
it 'expected "12:00:00.000" from displays.string_time() ' do
|
81
|
-
assert_equal '12:00:00.000', displays.string_time
|
82
|
-
assert_equal '12:00:00.000', displays.string_time(nil)
|
83
|
-
assert_equal '12:00:00.000', displays.string_time(0)
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'expected "12:00:00.000" from \
|
87
|
-
displays.display_time_string(Eot_adisplays.date)? ' do
|
88
|
-
assert_equal '12:00:00.000', \
|
89
|
-
displays.display_time_string(displays.date)
|
90
|
-
end
|
91
|
-
|
92
|
-
it 'expected "+142:35:47.318" from \
|
93
|
-
displays.string_tl_sun() ' do
|
94
|
-
assert_equal '+142:35:47.318', displays.string_tl_sun
|
95
|
-
end
|
96
|
-
|
97
|
-
it 'expected "+023:26:06.164" from displays.string_to_earth() ' do
|
98
|
-
assert_equal '+023:26:06.164', displays.string_to_earth
|
99
|
-
end
|
100
|
-
|
101
|
-
end
|
102
|
-
|
103
|
-
describe 'Eot displays explicit values' do
|
104
|
-
|
105
|
-
it 'expected "16:40:40.800" from displays.string_time(16.6780) ' do
|
106
|
-
assert_equal '16:40:40.800', displays.string_time(16.6780)
|
107
|
-
end
|
108
|
-
|
109
|
-
it 'expected "17:59:16.800" from displays.string_time(17988) ' do
|
110
|
-
displays.date = Date.today.to_s
|
111
|
-
assert_equal '17:59:16.800', displays.string_time(17.988)
|
112
|
-
end
|
113
|
-
|
114
|
-
end
|
data/test/eot/geo_spec.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
# geo_spec.rb/
|
2
|
-
gem 'minitest'
|
3
|
-
require 'minitest/autorun'
|
4
|
-
|
5
|
-
lib = File.expand_path('../../../lib', __FILE__)
|
6
|
-
$LOAD_PATH.unshift(lib) unless$LOAD_PATH.include?(lib)
|
7
|
-
require 'eot'
|
8
|
-
|
9
|
-
geo = GeoLatLng.new
|
10
|
-
|
11
|
-
describe 'Geo defaults' do
|
12
|
-
|
13
|
-
INTERNATIONAL = geo.default_int
|
14
|
-
it "expected #{INTERNATIONAL}" do
|
15
|
-
assert_equal INTERNATIONAL, geo.addr
|
16
|
-
end
|
17
|
-
|
18
|
-
BASE = 'http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address='
|
19
|
-
it "expected #{BASE}" do
|
20
|
-
assert_equal BASE, geo.base_json
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'expected #{INTERNATIONAL 'do
|
24
|
-
assert_equal INTERNATIONAL, geo.default_int
|
25
|
-
end
|
26
|
-
|
27
|
-
DEFAULT_US = '3333 Coyote Hill Road, Palo Alto, CA, 94304, USA'
|
28
|
-
it 'expected DEFAULT_US 'do
|
29
|
-
assert_equal DEFAULT_US, geo.default_us
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'expected 0.0'do
|
33
|
-
assert_equal 0.0, geo.lat
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'expected 0.0'do
|
37
|
-
assert_equal 0.0, geo.lng
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
data/test/eot/init_spec.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
# init_spec.rb
|
2
|
-
gem 'minitest'
|
3
|
-
require 'minitest/autorun'
|
4
|
-
|
5
|
-
lib = File.expand_path('../../../lib', __FILE__)
|
6
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
7
|
-
require 'eot'
|
8
|
-
|
9
|
-
describe 'Eot_initialize has set attributes ' do
|
10
|
-
|
11
|
-
JD_TODAY = DateTime.now.to_time.utc.to_datetime.jd.to_f
|
12
|
-
it "expected #{JD_TODAY} from Eot.new.ajd" do
|
13
|
-
assert_equal(JD_TODAY, Eot.new.ajd)
|
14
|
-
end
|
15
|
-
|
16
|
-
UK_LAT = 0.0
|
17
|
-
it "expected #{UK_LAT} from Eot.new.latitude" do
|
18
|
-
assert_equal(UK_LAT, Eot.new.latitude)
|
19
|
-
end
|
20
|
-
|
21
|
-
UK_LNG = 0.0
|
22
|
-
it "expected #{UK_LNG} from Eot.new.longitude" do
|
23
|
-
assert_equal(UK_LNG, Eot.new.longitude)
|
24
|
-
end
|
25
|
-
|
26
|
-
MA_SUN = Eot.new.ma_sun
|
27
|
-
it "expected #{MA_SUN} from @ma" do
|
28
|
-
eot = Eot.new
|
29
|
-
eot.ajd = JD_TODAY
|
30
|
-
assert_equal(MA_SUN, eot.ma)
|
31
|
-
end
|
32
|
-
|
33
|
-
FRAC_CENT = (Eot.new.ajd - Eot::DJ00) / Eot::DJC
|
34
|
-
it "expected #{FRAC_CENT} from @ta" do
|
35
|
-
eot = Eot.new
|
36
|
-
eot.ajd = JD_TODAY
|
37
|
-
assert_equal(FRAC_CENT, eot.ta)
|
38
|
-
end
|
39
|
-
|
40
|
-
DEFAULT_INT = nil
|
41
|
-
it "expected #{DEFAULT_INT} from Eot.new.addr" do
|
42
|
-
assert_equal(DEFAULT_INT, Eot.new.addr)
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
data/test/eot/times_spec.rb
DELETED
@@ -1,199 +0,0 @@
|
|
1
|
-
# times_spec.rb
|
2
|
-
gem 'minitest'
|
3
|
-
require 'minitest/autorun'
|
4
|
-
lib = File.expand_path('../../../lib', __FILE__)
|
5
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
6
|
-
require 'eot'
|
7
|
-
|
8
|
-
times = Eot.new
|
9
|
-
|
10
|
-
describe 'tests ajd of 2456885.0 ' do
|
11
|
-
|
12
|
-
before(:each) do
|
13
|
-
times.ajd = 2_456_885.0
|
14
|
-
ajd = times.ajd
|
15
|
-
times.ma_ta_set
|
16
|
-
# check date for this ajd when needed.
|
17
|
-
times.date = times.ajd_to_datetime(ajd)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'expected 2456885.0 for times.ajd'do
|
21
|
-
assert_equal(2_456_885.0, times.ajd)
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'expected "2014-08-15T12:00:00+00:00" for times.date'.to_s do
|
25
|
-
assert_equal '2014-08-15T12:00:00+00:00', times.date.to_s
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'expected 3.8508003966038915 for times.ma'do
|
29
|
-
assert_equal(3.8508003966038915, times.ma)
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'expected "2014-08-15T12:00:00+00:00" from \
|
33
|
-
times.ajd_to_datetime(times.ajd).to_s ' do
|
34
|
-
assert_equal '2014-08-15T12:00:00+00:00',\
|
35
|
-
times.ajd_to_datetime(times.ajd).to_s
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'expected "2014-08-15T19:18:45+00:00" from \
|
39
|
-
times.astronomical_twilight_end_dt.to_s ' do
|
40
|
-
assert_equal('2014-08-15T19:18:45+00:00', \
|
41
|
-
times.astronomical_twilight_end_dt.to_s)
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'expected "2014-08-15T04:50:12+00:00" from \
|
45
|
-
times.astronomical_twilight_start_dt.to_s ' do
|
46
|
-
assert_equal('2014-08-15T04:50:12+00:00', \
|
47
|
-
times.astronomical_twilight_start_dt.to_s)
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'expected 2_456_885.3046949888 from \
|
51
|
-
times.astronomical_twilight_end_jd ' do
|
52
|
-
assert_equal(2_456_885.3046949888, \
|
53
|
-
times.astronomical_twilight_end_jd)
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'expected 2_456_884.701532429 from \
|
57
|
-
times.astronomical_twilight_start_jd ' do
|
58
|
-
assert_equal(2_456_884.701532429, \
|
59
|
-
times.astronomical_twilight_start_jd)
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'expected "2014-08-15T18:29:13+00:00" from \
|
63
|
-
times.civil_twilight_end_dt.to_s ' do
|
64
|
-
assert_equal('2014-08-15T18:29:13+00:00', \
|
65
|
-
times.civil_twilight_end_dt.to_s)
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'expected "2014-08-15T05:39:44+00:00" from \
|
69
|
-
times.civil_twilight_start_dt.to_s ' do
|
70
|
-
assert_equal('2014-08-15T05:39:44+00:00', \
|
71
|
-
times.civil_twilight_start_dt.to_s)
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'expected 2_456_885.270291137 from times.civil_twilight_end_jd() ' do
|
75
|
-
assert_equal(2_456_885.270291137, times.civil_twilight_end_jd)
|
76
|
-
end
|
77
|
-
|
78
|
-
it 'expected 2_456_884.735936281 from \
|
79
|
-
times.civil_twilight_start_jd() ' do
|
80
|
-
assert_equal(2_456_884.735936281, times.civil_twilight_start_jd)
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'expected -0.003113709117457967 from times.eot_jd() ' do
|
84
|
-
assert_equal(-0.003113709117457967, times.eot_jd)
|
85
|
-
end
|
86
|
-
|
87
|
-
it 'expected "2014-08-15T12:04:29+00:00" \
|
88
|
-
from times.local_noon_dt().to_s ' do
|
89
|
-
assert_equal '2014-08-15T12:04:29+00:00', times.local_noon_dt.to_s
|
90
|
-
end
|
91
|
-
|
92
|
-
it 'expected "2014-08-15T18:53:58+00:00" from \
|
93
|
-
times.nautical_twilight_end_dt.to_s ' do
|
94
|
-
assert_equal('2014-08-15T18:53:58+00:00', \
|
95
|
-
times.nautical_twilight_end_dt.to_s)
|
96
|
-
end
|
97
|
-
|
98
|
-
it 'expected "2014-08-15T05:14:59+00:00" from \
|
99
|
-
times.nautical_twilight_start_dt.to_s ' do
|
100
|
-
assert_equal('2014-08-15T05:14:59+00:00', \
|
101
|
-
times.nautical_twilight_start_dt.to_s)
|
102
|
-
end
|
103
|
-
|
104
|
-
it 'expected 2_456_885.2874805206 from \
|
105
|
-
times.nautical_twilight_end_jd ' do
|
106
|
-
assert_equal(2_456_885.2874805206, \
|
107
|
-
times.nautical_twilight_end_jd)
|
108
|
-
end
|
109
|
-
|
110
|
-
it 'expected 2_456_884.7187468973 from \
|
111
|
-
times.nautical_twilight_start_jd ' do
|
112
|
-
assert_equal(2_456_884.7187468973, \
|
113
|
-
times.nautical_twilight_start_jd)
|
114
|
-
end
|
115
|
-
|
116
|
-
it 'expected "2014-08-15T06:01:02+00:00" from times.sunrise_dt() ' do
|
117
|
-
assert_equal '2014-08-15T06:01:02+00:00', times.sunrise_dt.to_s
|
118
|
-
end
|
119
|
-
|
120
|
-
it 'expected "2014-08-15T18:07:55+00:00" from times.sunset_dt() ' do
|
121
|
-
assert_equal '2014-08-15T18:07:55+00:00', times.sunset_dt.to_s
|
122
|
-
end
|
123
|
-
|
124
|
-
it 'expected 2_456_884.7507283166 from times.sunrise_jd() ' do
|
125
|
-
assert_equal(2_456_884.7507283166, times.sunrise_jd)
|
126
|
-
end
|
127
|
-
|
128
|
-
it 'expected 2_456_885.2554991012 from times.sunset_jd() ' do
|
129
|
-
assert_equal(2_456_885.2554991012, times.sunset_jd)
|
130
|
-
end
|
131
|
-
|
132
|
-
it 'expected -9.37789671342477 from times.time_delta_oblique() ' do
|
133
|
-
assert_equal(-9.37789671342477, times.time_delta_oblique)
|
134
|
-
end
|
135
|
-
|
136
|
-
it 'expected 4.894155584285298 from times.time_delta_orbit() ' do
|
137
|
-
assert_equal(4.894155584285298, times.time_delta_orbit)
|
138
|
-
end
|
139
|
-
|
140
|
-
it 'expected -4.483741129139473 from times.time_eot() ' do
|
141
|
-
assert_equal(-4.483741129139473, times.time_eot)
|
142
|
-
end
|
143
|
-
|
144
|
-
end
|
145
|
-
|
146
|
-
describe 'tests ajd of 2455055.0 ' do
|
147
|
-
|
148
|
-
before(:each) do
|
149
|
-
times.ajd = 2_455_055.0
|
150
|
-
ajd = times.ajd
|
151
|
-
times.ma_ta_set
|
152
|
-
# check date for this ajd when needed.
|
153
|
-
times.date = times.ajd_to_datetime(ajd)
|
154
|
-
end
|
155
|
-
|
156
|
-
it 'expected 2_455_055.0, from times. ' do
|
157
|
-
assert_equal(2_455_055.0, times.ajd)
|
158
|
-
end
|
159
|
-
|
160
|
-
it 'expected "2009-08-11T12:00:00+00:00" from times.date.to_s ' do
|
161
|
-
assert_equal '2009-08-11T12:00:00+00:00', times.date.to_s
|
162
|
-
end
|
163
|
-
|
164
|
-
it 'expected 3.7871218188949207 from times. ' do
|
165
|
-
assert_equal(3.7871218188949207, times.ma)
|
166
|
-
end
|
167
|
-
|
168
|
-
it 'expected "2009-08-11T12:00:00+00:00" from \
|
169
|
-
times.ajd_to_datetime(times.ajd).to_s ' do
|
170
|
-
assert_equal '2009-08-11T12:00:00+00:00', \
|
171
|
-
times.ajd_to_datetime(times.ajd).to_s
|
172
|
-
end
|
173
|
-
|
174
|
-
it 'expected -0.003584007074372416 from times.eot_jd() ' do
|
175
|
-
assert_equal(-0.003584007074372416, times.eot_jd)
|
176
|
-
end
|
177
|
-
|
178
|
-
it 'expected "2009-08-11T06:01:42+00:00" \
|
179
|
-
from times.sunrise_dt().to_s ' do
|
180
|
-
assert_equal '2009-08-11T06:01:42+00:00', times.sunrise_dt.to_s
|
181
|
-
end
|
182
|
-
|
183
|
-
it 'expected 2_455_054.75118603 from times.sunrise_jd()' do
|
184
|
-
assert_equal(2_455_054.75118603, times.sunrise_jd)
|
185
|
-
end
|
186
|
-
|
187
|
-
it 'expected "2009-08-11T18:08:36+00:00" from times.sunset_dt() ' do
|
188
|
-
assert_equal '2009-08-11T18:08:36+00:00', times.sunset_dt.to_s
|
189
|
-
end
|
190
|
-
|
191
|
-
it 'expected 2_455_055.2559819845 from times.sunset_jd() ' do
|
192
|
-
assert_equal(2_455_055.2559819845, times.sunset_jd)
|
193
|
-
end
|
194
|
-
|
195
|
-
it 'expected -5.160970187096279 is from times.time_eot() ' do
|
196
|
-
assert_equal(-5.160970187096279, times.time_eot)
|
197
|
-
end
|
198
|
-
|
199
|
-
end
|