equationoftime 4.1.2 → 4.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.ruby-version +1 -1
- data/Gemfile +6 -4
- data/Gemfile.lock +21 -14
- data/Guardfile +4 -21
- data/Manifest.txt +18 -52
- data/README.rdoc +6 -6
- data/Rakefile +53 -92
- data/equationoftime.gemspec +48 -49
- data/examples/my_lst.rb +9 -0
- data/examples/use_addr.rb +20 -0
- data/examples/use_ajd.rb +40 -0
- data/ext/eot/ceot.c +18 -14
- data/ext/eot/extconf.rb +4 -5
- data/lib/eot/angle_displays.rb +95 -0
- data/lib/eot/angles.rb +160 -291
- data/lib/eot/constants.rb +78 -81
- data/lib/eot/deltas.rb +40 -0
- data/lib/eot/geo_lat_lng_smt.rb +30 -57
- data/lib/eot/init.rb +86 -124
- data/lib/eot/time_displays.rb +105 -0
- data/lib/eot/times.rb +118 -121
- data/lib/eot/trigometric.rb +51 -0
- data/lib/eot/utilities.rb +49 -50
- data/lib/eot/version.rb +3 -2
- data/lib/eot.rb +11 -5
- data/test/eot/aliased_angles_spec.rb +291 -0
- data/test/eot/aliased_displays_spec.rb +126 -0
- data/test/{aliased_utilities_spec.rb → eot/aliased_utilities_spec.rb} +32 -36
- data/test/eot/angles_spec.rb +261 -0
- data/test/eot/constants_spec.rb +17 -0
- data/test/eot/displays_spec.rb +111 -0
- data/test/eot/geo_spec.rb +40 -0
- data/test/eot/init_spec.rb +45 -0
- data/test/eot/times_spec.rb +137 -0
- data/wiki.md +55 -0
- data/wiki2.md +4 -0
- data.tar.gz.sig +0 -0
- metadata +55 -69
- metadata.gz.sig +0 -0
- data/.settings/org.eclipse.ltk.core.refactoring.prefs +0 -2
- data/examples/analemma_data_generator.rb +0 -58
- data/examples/check_date_type.rb +0 -60
- data/examples/compare_geoc_long_ra.rb +0 -44
- data/examples/data_table_for_astro_dog.rb +0 -45
- data/examples/earth_rotation.rb +0 -42
- data/examples/eot_methods_list.rb +0 -48
- data/examples/eot_plot.r +0 -57
- data/examples/eot_suntimes.rb +0 -149
- data/examples/equation_of_time.py +0 -186
- data/examples/figure_1.jpg +0 -0
- data/examples/file_converter.rb +0 -31
- data/examples/from_readme.rb +0 -14
- data/examples/from_wiki.rb +0 -46
- data/examples/geo_locator.rb +0 -16
- data/examples/getjd.rb +0 -45
- data/examples/gmst_gast_non_sofa.rb +0 -406
- data/examples/input_suntimes.rb +0 -24
- data/examples/julian_day_formula.rb +0 -29
- data/examples/julian_day_formula.txt +0 -12
- data/examples/my_time_conversion.rb +0 -21
- data/examples/nutation_series.txt +0 -678
- data/examples/nutation_table5_3a.txt +0 -682
- data/examples/ptime.rb +0 -162
- data/examples/suntimes.rb +0 -30
- data/examples/suntimes_test.rb +0 -50
- data/examples/t_sofa.rb +0 -8228
- data/examples/test_celes.rb +0 -51
- data/examples/test_ceot.rb +0 -55
- data/examples/test_poly_eval.rb +0 -32
- data/examples/time_scales.rb +0 -29
- data/examples/times_year.rb +0 -53
- data/examples/usage_example.rb +0 -26
- data/examples/use_angles.rb +0 -222
- data/lib/eot/displays.rb +0 -216
- data/lib/eot/eot.so +0 -0
- data/lib/eot/nutation.rb +0 -78
- data/run_tests_eclipse.rb +0 -1
- data/test/aliased_angles_spec.rb +0 -239
- data/test/aliased_displays_spec.rb +0 -105
- data/test/angles_spec.rb +0 -264
- data/test/constants_spec.rb +0 -20
- data/test/displays_spec.rb +0 -110
- data/test/geo_spec.rb +0 -38
- data/test/init_spec.rb +0 -44
- data/test/nutation_spec.rb +0 -37
- data/test/spec_config.rb +0 -8
- data/test/times_spec.rb +0 -133
- data/test/utilities_spec.rb +0 -35
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
# angles_spec.rb
|
|
2
|
+
|
|
3
|
+
lib = File.expand_path('../../../lib', __FILE__)
|
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
|
+
require 'eot'
|
|
6
|
+
|
|
7
|
+
Eot_angles = Eot.new
|
|
8
|
+
|
|
9
|
+
describe 'Tests ajd of 2456885.0' do
|
|
10
|
+
|
|
11
|
+
before(:each) do
|
|
12
|
+
Eot_angles.ajd = 2_456_885.0
|
|
13
|
+
ajd = Eot_angles.ajd
|
|
14
|
+
# check date for this ajd when needed.
|
|
15
|
+
Eot_angles.date = Eot_angles.ajd_to_datetime(ajd)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'should be 2456885.0 for Eot_angles.ajd'do
|
|
19
|
+
assert_equal(2_456_885.0, Eot_angles.ajd)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'should be "2014-08-15T12:00:00+00:00" for Eot_angles.date'.to_s do
|
|
23
|
+
assert_equal('2014-08-15T12:00:00+00:00', Eot_angles.date.to_s)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it 'should be 3.8508003966038915 for Eot_angles.ma'do
|
|
27
|
+
assert_equal(3.8508003966038915, Eot_angles.ma)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'should be 2.4887103398436143 from Eot_angles.al_sun()? ' do
|
|
31
|
+
assert_equal(2.4887103398436143, Eot_angles.al_sun)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'should be -0.021413249720702462 from Eot_angles.centre()? ' do
|
|
35
|
+
assert_equal(-0.021413249720702462, Eot_angles.center)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it 'should be -0.7943361570447028 from Eot_angles.cosine_al_sun()? ' do
|
|
39
|
+
assert_equal(-0.7943361570447028, Eot_angles.cosine_al_sun)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it 'should be -0.7943772759574919 from Eot_angles.cosine_tl_sun()? ' do
|
|
43
|
+
assert_equal(-0.7943772759574919, Eot_angles.cosine_tl_sun)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it 'should be 0.9175115346811911 from Eot_angles.cosine_to_earth()? ' do
|
|
47
|
+
assert_equal(0.9175115346811911, Eot_angles.cosine_to_earth)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'should be 0.24401410218543554 from Eot_angles.dec_sun()? ' do
|
|
51
|
+
assert_equal(0.24401410218543554, Eot_angles.dec_sun)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it 'should be -4.069792718159396e-05 from Eot_angles.delta_epsilon()? ' do
|
|
55
|
+
assert_equal(-4.069792718159396e-05, Eot_angles.delta_epsilon)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it 'should be -0.04103082558803539 from Eot_angles.delta_oblique()? ' do
|
|
59
|
+
assert_equal(-0.04103082558803539, Eot_angles.delta_oblique)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it 'should be 0.021413249720702462 from Eot_angles.delta_orbit()? ' do
|
|
63
|
+
assert_equal(0.021413249720702462, Eot_angles.delta_orbit)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it 'should be 3.75123821843003e-05 from Eot_angles.delta_psi()? ' do
|
|
67
|
+
assert_equal(3.75123821843003e-05, Eot_angles.delta_psi)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it 'should be 0.016702468499021204 from \
|
|
71
|
+
Eot_angles.eccentricity_earth()? ' do
|
|
72
|
+
assert_equal(0.016702468499021204, Eot_angles.eccentricity_earth)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
it 'should be 3.441804334746474e-05 from Eot_angles.eq_of_equinox()? ' do
|
|
76
|
+
assert_equal(3.441804334746474e-05, Eot_angles.eq_of_equinox)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
it 'should be -0.01961757586733293 from Eot_angles.eot()? ' do
|
|
80
|
+
assert_equal(-0.01961757586733293, Eot_angles.eot)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it 'should be 2.5101912804141424 from Eot_angles.gml_sun()? ' do
|
|
84
|
+
assert_equal(2.5101912804141424, Eot_angles.gml_sun)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
it 'should be 1.9143229567859146 from Eot_angles.ha_sun()? ' do
|
|
88
|
+
assert_equal(1.9143229567859146, Eot_angles.ha_sun)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
it 'should be 3.8508003966038915 from Eot_angles.ma_sun()? ' do
|
|
92
|
+
assert_equal(3.8508003966038915, Eot_angles.ma_sun)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
it 'should be 2.510089864980358 from Eot_angles.ml_aries()? ' do
|
|
96
|
+
assert_equal(2.510089864980358, Eot_angles.ml_aries)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
it 'should be 0.40905940254265843 from Eot_angles.mo_earth()? ' do
|
|
100
|
+
assert_equal(0.40905940254265843, Eot_angles.mo_earth)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
it 'should be -2.7528817371494685 from Eot_angles.omega()? ' do
|
|
104
|
+
assert_equal(-2.7528817371494685, Eot_angles.omega)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
it 'should be 2.5297411654316497 from Eot_angles.ra_sun()? ' do
|
|
108
|
+
assert_equal(2.5297411654316497, Eot_angles.ra_sun)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
it 'should be 0.6074784519729512 from Eot_angles.sine_al_sun()? ' do
|
|
112
|
+
assert_equal(0.6074784519729512, Eot_angles.sine_al_sun)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
it 'should be 0.6074246812917259 from Eot_angles.sine_tl_sun()? ' do
|
|
116
|
+
assert_equal(0.6074246812917259, Eot_angles.sine_tl_sun)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
it 'should be 3.8293871468831893 from Eot_angles.ta_sun()? ' do
|
|
120
|
+
assert_equal(3.8293871468831893, Eot_angles.ta_sun)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
it 'should be 2.5101242776531474 from Eot_angles.tl_aries()? ' do
|
|
124
|
+
assert_equal(2.5101242776531474, Eot_angles.tl_aries)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
it 'should be 2.48877803069344 from Eot_angles.tl_sun()? ' do
|
|
128
|
+
assert_equal(2.48877803069344, Eot_angles.tl_sun)
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
it 'should be 0.40901870461547685 from Eot_angles.to_earth()? ' do
|
|
132
|
+
assert_equal(0.40901870461547685, Eot_angles.to_earth)
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
describe 'Tests ajd of 2455055.5 ' do
|
|
137
|
+
|
|
138
|
+
before(:each) do
|
|
139
|
+
Eot_angles.ajd = 2_455_055.0
|
|
140
|
+
ajd = Eot_angles.ajd
|
|
141
|
+
# check date for this ajd when needed.
|
|
142
|
+
Eot_angles.date = Eot_angles.ajd_to_datetime(ajd)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
it 'should be 2455055.0, from Eot_angles.' do
|
|
146
|
+
assert_equal(2_455_055.0, Eot_angles.ajd)
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
it 'should be "2009-08-11T12:00:00+00:00", from Eot_angles.date.to_s' do
|
|
150
|
+
assert_equal('2009-08-11T12:00:00+00:00', Eot_angles.date.to_s)
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
it 'should be 3.7871218188949207, from Eot_angles.' do
|
|
154
|
+
assert_equal(3.7871218188949207, Eot_angles.ma)
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
it 'should be 2.4252140645725033 from Eot_angles.al_sun()? ' do
|
|
158
|
+
assert_equal(2.4252140645725033, Eot_angles.al_sun)
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
it 'should be -0.019768413456709915 from Eot_angles.center()? ' do
|
|
162
|
+
assert_equal(-0.019768413456709915, Eot_angles.center)
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
it 'should be -0.7541886969975007 from Eot_angles.cosine_al_sun()? ' do
|
|
166
|
+
assert_equal(-0.7541886969975007, Eot_angles.cosine_al_sun)
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
it 'should be -0.7542060769936684 from Eot_angles.cosine_tl_sun()? ' do
|
|
170
|
+
assert_equal(-0.7542060769936684, Eot_angles.cosine_tl_sun)
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
it 'should be 0.9174818088112336 from Eot_angles.cosine_to_earth()? ' do
|
|
174
|
+
assert_equal(0.9174818088112336, Eot_angles.cosine_to_earth)
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
it 'should be 0.26426912722944046 from Eot_angles.dec_sun()? ' do
|
|
178
|
+
assert_equal(0.26426912722944046, Eot_angles.dec_sun)
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
it 'should be 2.2661506700250296e-05 from Eot_angles.delta_epsilon()? ' do
|
|
182
|
+
assert_equal(2.2661506700250296e-05, Eot_angles.delta_epsilon)
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
it 'should be -0.04234904897476355 from Eot_angles.delta_oblique()? ' do
|
|
186
|
+
assert_equal(-0.04234904897476355, Eot_angles.delta_oblique)
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
it 'should be 0.019768413456709915 from Eot_angles.delta_orbit()? ' do
|
|
190
|
+
assert_equal(0.019768413456709915, Eot_angles.delta_orbit)
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
it 'should be 7.639341522992976e-05 from Eot_angles.delta_psi()? ' do
|
|
194
|
+
assert_equal(7.639341522992976e-05, Eot_angles.delta_psi)
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
it 'should be 0.016704576164208475 from \
|
|
198
|
+
Eot_angles.eccentricity_earth()? ' do
|
|
199
|
+
assert_equal(0.016704576164208475, Eot_angles.eccentricity_earth)
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
it 'should be 7.00895687864236e-05 from Eot_angles.eq_of_equinox()? ' do
|
|
203
|
+
assert_equal(7.00895687864236e-05, Eot_angles.eq_of_equinox)
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
it 'should be -0.022580635518053633 from Eot_angles.eot()? ' do
|
|
207
|
+
assert_equal(-0.022580635518053633, Eot_angles.eot)
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
it 'should be 2.445008945789877 from Eot_angles.gml_sun()? ' do
|
|
211
|
+
assert_equal(2.445008945789877, Eot_angles.gml_sun)
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
it 'should be 1.9434600427973594 from Eot_angles.ha_sun()? ' do
|
|
215
|
+
assert_equal(1.9434600427973594, Eot_angles.ha_sun)
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
it 'should be 3.7871218188949207 from Eot_angles.ma_sun()? ' do
|
|
219
|
+
assert_equal(3.7871218188949207, Eot_angles.ma_sun)
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
it 'should be 2.444907382260759 from Eot_angles.ml_aries()? ' do
|
|
223
|
+
assert_equal(2.444907382260759, Eot_angles.ml_aries)
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
it 'should be 0.4090707793981491 from Eot_angles.mo_earth()? ' do
|
|
227
|
+
assert_equal(0.4090707793981491, Eot_angles.mo_earth)
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
it 'should be -1.0615640635268548 from Eot_angles.omega()? ' do
|
|
231
|
+
assert_equal(-1.0615640635268548, Eot_angles.omega)
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
it 'should be 2.467563113547267 from Eot_angles.ra_sun()? ' do
|
|
235
|
+
assert_equal(2.467563113547267, Eot_angles.ra_sun)
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
it 'should be 0.6566577566139093 from Eot_angles.sine_al_sun()? ' do
|
|
239
|
+
assert_equal(0.6566577566139093, Eot_angles.sine_al_sun)
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
it 'should be 0.6566377946979757 from Eot_angles.sine_tl_sun()? ' do
|
|
243
|
+
assert_equal(0.6566377946979757, Eot_angles.sine_tl_sun)
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
it 'should be 3.767353405438211 from Eot_angles.ta_sun()? ' do
|
|
247
|
+
assert_equal(3.767353405438211, Eot_angles.ta_sun)
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
it 'should be 2.4449774607872907 from Eot_angles.tl_aries()? ' do
|
|
251
|
+
assert_equal(2.4449774607872907, Eot_angles.tl_aries)
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
it 'should be 2.4252405323331674 from Eot_angles.tl_sun()? ' do
|
|
255
|
+
assert_equal(2.4252405323331674, Eot_angles.tl_sun)
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
it 'should be 0.4090934409048494 from Eot_angles.to_earth()? ' do
|
|
259
|
+
assert_equal(0.4090934409048494, Eot_angles.to_earth)
|
|
260
|
+
end
|
|
261
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# constants_spec.rb
|
|
2
|
+
|
|
3
|
+
lib = File.expand_path('../../../lib', __FILE__)
|
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
|
+
require 'eot'
|
|
6
|
+
|
|
7
|
+
describe 'Equation of Time constants.' do
|
|
8
|
+
|
|
9
|
+
it "01 require 'eot' should find all constants." do
|
|
10
|
+
assert_equal 24.0, Eot::DAY_HOURS
|
|
11
|
+
assert_equal 1440.0, Eot::DAY_MINUTES
|
|
12
|
+
assert_equal 86_400.0, Eot::DAY_SECONDS
|
|
13
|
+
assert_equal 86_400.0 * 1.0e+6, Eot::DAY_USECS
|
|
14
|
+
assert_equal 57.29577951308232, Eot::R2D
|
|
15
|
+
assert_equal 0.017453292519943295, Eot::D2R
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# displays_spec.rb
|
|
2
|
+
|
|
3
|
+
lib = File.expand_path('../../../lib', __FILE__)
|
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
|
+
require 'eot'
|
|
6
|
+
|
|
7
|
+
Eot_displays = Eot.new
|
|
8
|
+
|
|
9
|
+
describe 'Eot displays using ajd of 2456885.0' do
|
|
10
|
+
|
|
11
|
+
before(:each) do
|
|
12
|
+
Eot_displays.ajd = 2_456_885.0
|
|
13
|
+
ajd = Eot_displays.ajd
|
|
14
|
+
# check date for this ajd when needed.
|
|
15
|
+
Eot_displays.date = Eot_displays.ajd_to_datetime(ajd)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'expected 2456885.0 for Eot_displays.ajd'do
|
|
19
|
+
assert_equal 2_456_885.0, Eot_displays.ajd
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'expected "2014-08-15T12:00:00+00:00", from Eot_displays.date.to_s' do
|
|
23
|
+
assert_equal '2014-08-15T12:00:00+00:00', Eot_displays.date.to_s
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it 'expected 3.8508003966038915, from Eot_displays.' do
|
|
27
|
+
assert_equal 3.8508003966038915, Eot_displays.ma
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'expected "+000:00:00.000" from 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 "+142:35:33.356" from Eot_displays.string_al_sun() ' do
|
|
37
|
+
assert_equal '+142:35:33.356', Eot_displays.string_al_sun
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it 'expected "12:00:00" from Eot_displays.string_day_fraction_to_time() ' do
|
|
41
|
+
assert_equal '12:00:00', Eot_displays.string_day_fraction_to_time
|
|
42
|
+
assert_equal '12:00:00', Eot_displays.string_day_fraction_to_time(nil)
|
|
43
|
+
assert_equal '12:00:00', Eot_displays.string_day_fraction_to_time(0)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it 'expected "+013:58:51.521" from Eot_displays.string_dec_sun() ' do
|
|
47
|
+
assert_equal '+013:58:51.521', Eot_displays.string_dec_sun
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'expected "-04m, 29.2s" from Eot_displays.string_eot() ' do
|
|
51
|
+
assert_equal '-04m, 29.2s', Eot_displays.string_eot
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it 'expected "2000-01-01" from Eot_displays.string_jd_to_date() ' do
|
|
55
|
+
assert_equal '2000-01-01', Eot_displays.string_jd_to_date
|
|
56
|
+
assert_equal '2000-01-01', Eot_displays.string_jd_to_date(nil)
|
|
57
|
+
assert_equal '2000-01-01', Eot_displays.string_jd_to_date(0)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it 'expected "2014-08-15" from \
|
|
61
|
+
Eot_displays.jd_to_date_string(Eot_displays.ajd)? ' do
|
|
62
|
+
assert_equal '2014-08-15', Eot_displays.jd_to_date_string(Eot_displays.ajd)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it 'expected "+220:38:04.597" from Eot_displays.string_ma_sun() ' do
|
|
66
|
+
assert_equal '+220:38:04.597', Eot_displays.string_ma_sun
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
it 'expected "+144:56:36.571" from Eot_displays.string_ra_sun() ' do
|
|
70
|
+
assert_equal '+144:56:36.571', Eot_displays.string_ra_sun
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it 'expected "+219:24:27.797" from Eot_displays.string_ta_sun() ' do
|
|
74
|
+
assert_equal '+219:24:27.797', Eot_displays.string_ta_sun
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
it 'expected "12:00:00.000" from Eot_displays.string_time() ' do
|
|
78
|
+
assert_equal '12:00:00.000', Eot_displays.string_time
|
|
79
|
+
assert_equal '12:00:00.000', Eot_displays.string_time(nil)
|
|
80
|
+
assert_equal '12:00:00.000', Eot_displays.string_time(0)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it 'expected "12:00:00.000" from \
|
|
84
|
+
Eot_displays.display_time_string(Eot_adisplays.date)? ' do
|
|
85
|
+
assert_equal '12:00:00.000', \
|
|
86
|
+
Eot_displays.display_time_string(Eot_displays.date)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
it 'expected "+142:35:47.318" from \
|
|
90
|
+
Eot_displays.string_tl_sun() ' do
|
|
91
|
+
assert_equal '+142:35:47.318', Eot_displays.string_tl_sun
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
it 'expected "+023:26:06.163" from Eot_displays.string_to_earth() ' do
|
|
95
|
+
assert_equal '+023:26:06.163', Eot_displays.string_to_earth
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
describe 'Eot displays explicit values' do
|
|
101
|
+
|
|
102
|
+
it 'expected "16:40:40.800" from 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" from 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,40 @@
|
|
|
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
|
+
# DEFAULT_INT = geo.default_int
|
|
14
|
+
it "expected #{DEFAULT_INT}" do
|
|
15
|
+
assert_equal DEFAULT_INT, 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 #{DEFAULT_INT 'do
|
|
24
|
+
assert_equal DEFAULT_INT, 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
|
|
@@ -0,0 +1,45 @@
|
|
|
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 = 51.4769388
|
|
17
|
+
it "expected #{UK_LAT} from Eot.new.latitude" do
|
|
18
|
+
assert_equal(UK_LAT, Eot.new.latitude)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
UK_LNG = -4.2e-05
|
|
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 = GeoLatLng.new.addr
|
|
41
|
+
it "expected #{DEFAULT_INT} from Eot.new.addr" do
|
|
42
|
+
assert_equal(DEFAULT_INT, Eot.new.addr)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
end
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# times_spec.rb
|
|
2
|
+
|
|
3
|
+
lib = File.expand_path('../../../lib', __FILE__)
|
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
|
+
require 'eot'
|
|
6
|
+
|
|
7
|
+
Eot_times = Eot.new
|
|
8
|
+
|
|
9
|
+
describe 'tests ajd of 2456885.0' do
|
|
10
|
+
|
|
11
|
+
before(:each) do
|
|
12
|
+
Eot_times.ajd = 2_456_885.0
|
|
13
|
+
ajd = Eot_times.ajd
|
|
14
|
+
# check date for this ajd when needed.
|
|
15
|
+
Eot_times.date = Eot_times.ajd_to_datetime(ajd)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'expected 2456885.0 for Eot_times.ajd'do
|
|
19
|
+
assert_equal(2_456_885.0, Eot_times.ajd)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'expected "2014-08-15T12:00:00+00:00" for Eot_times.date'.to_s do
|
|
23
|
+
assert_equal '2014-08-15T12:00:00+00:00', Eot_times.date.to_s
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it 'expected 3.8508003966038915 for Eot_times.ma'do
|
|
27
|
+
assert_equal(3.8508003966038915, Eot_times.ma)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'expected "2014-08-15T12:00:00+00:00" from \
|
|
31
|
+
Eot_times.ajd_to_datetime(Eot_times.ajd).to_s ' do
|
|
32
|
+
assert_equal '2014-08-15T12:00:00+00:00',\
|
|
33
|
+
Eot_times.ajd_to_datetime(Eot_times.ajd).to_s
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it 'expected -0.003113709117457967 from Eot_times.eot_jd() ' do
|
|
37
|
+
assert_equal(-0.003113709117457967, Eot_times.eot_jd)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it 'expected "2014-08-15T12:04:29+00:00" \
|
|
41
|
+
from Eot_times.local_noon_dt().to_s ' do
|
|
42
|
+
assert_equal '2014-08-15T12:04:29+00:00', Eot_times.local_noon_dt.to_s
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it 'expected "2014-08-15T12:00:00+00:00" from \
|
|
46
|
+
Eot_times.mean_local_noon_dt().to_s ' do
|
|
47
|
+
assert_equal '2014-08-15T12:00:00+00:00', Eot_times.mean_local_noon_dt.to_s
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'expected "2014-08-15T04:45:45+00:00" from Eot_times.sunrise_dt() ' do
|
|
51
|
+
assert_equal '2014-08-15T04:45:45+00:00', Eot_times.sunrise_dt.to_s
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it 'expected "2014-08-15T19:23:12+00:00" from Eot_times.sunset_dt() ' do
|
|
55
|
+
assert_equal '2014-08-15T19:23:12+00:00', Eot_times.sunset_dt.to_s
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it 'expected 2456884.6984398644 from Eot_times.sunrise_jd() ' do
|
|
59
|
+
assert_equal(2_456_884.6984398644, Eot_times.sunrise_jd)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it 'expected 2456885.307787787 from Eot_times.sunset_jd() ' do
|
|
63
|
+
assert_equal(2_456_885.307787787, Eot_times.sunset_jd)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it 'expected -9.362425472253944 from Eot_times.time_delta_oblique() ' do
|
|
67
|
+
assert_equal(-9.362425472253944, Eot_times.time_delta_oblique)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it 'expected 4.894155584285248 from Eot_times.time_delta_orbit() ' do
|
|
71
|
+
assert_equal(4.894155584285248, Eot_times.time_delta_orbit)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
it 'expected -4.483741129139473 from Eot_times.time_eot() ' do
|
|
75
|
+
assert_equal(-4.483741129139473, Eot_times.time_eot)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
describe 'tests ajd of 2455055.0' do
|
|
81
|
+
|
|
82
|
+
before(:each) do
|
|
83
|
+
Eot_times.ajd = 2_455_055.0
|
|
84
|
+
ajd = Eot_times.ajd
|
|
85
|
+
# check date for this ajd when needed.
|
|
86
|
+
Eot_times.date = Eot_times.ajd_to_datetime(ajd)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
it 'expected 2455055.0, from Eot_times.' do
|
|
90
|
+
assert_equal(2_455_055.0, Eot_times.ajd)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
it 'expected "2009-08-11T12:00:00+00:00" from Eot_times.date.to_s' do
|
|
94
|
+
assert_equal '2009-08-11T12:00:00+00:00', Eot_times.date.to_s
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
it 'expected 3.7871218188949207 from Eot_times.' do
|
|
98
|
+
assert_equal(3.7871218188949207, Eot_times.ma)
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
it 'expected "2009-08-11T12:00:00+00:00" from \
|
|
102
|
+
Eot_times.ajd_to_datetime(Eot_times.ajd).to_s' do
|
|
103
|
+
assert_equal '2009-08-11T12:00:00+00:00', \
|
|
104
|
+
Eot_times.ajd_to_datetime(Eot_times.ajd).to_s
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
it 'expected -0.003584007074372416 from Eot_times.eot_jd()' do
|
|
108
|
+
assert_equal(-0.003584007074372416, Eot_times.eot_jd)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
it 'expected "2009-08-11T12:00:00+00:00" from \
|
|
112
|
+
Eot_times.mean_local_noon_dt().to_s' do
|
|
113
|
+
assert_equal '2009-08-11T12:00:00+00:00', Eot_times.mean_local_noon_dt.to_s
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
it 'expected "2009-08-11T04:39:45+00:00" \
|
|
117
|
+
from Eot_times.sunrise_dt().to_s' do
|
|
118
|
+
assert_equal '2009-08-11T04:39:45+00:00', Eot_times.sunrise_dt.to_s
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
it 'expected 2455054.6942728516 from Eot_times.sunrise_jd()' do
|
|
122
|
+
assert_equal(2_455_054.6942728516, Eot_times.sunrise_jd)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
it 'expected "2009-08-11T19:30:34+00:00" from Eot_times.sunset_dt()' do
|
|
126
|
+
assert_equal '2009-08-11T19:30:34+00:00', Eot_times.sunset_dt.to_s
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
it 'expected 2455055.3128953967 from Eot_times.sunset_jd() ' do
|
|
130
|
+
assert_equal(2_455_055.3128953967, Eot_times.sunset_jd)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
it 'expected -5.160970187096279 is from Eot_times.time_eot() ' do
|
|
134
|
+
assert_equal(-5.160970187096279, Eot_times.time_eot)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
end
|
data/wiki.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
Wiki 2:
|
|
2
|
+
|
|
3
|
+
$ irb --simple-prompt
|
|
4
|
+
|
|
5
|
+
require 'eot'
|
|
6
|
+
eot = Eot.new()
|
|
7
|
+
loop do
|
|
8
|
+
puts "#{Time.now} #{eot.show_minutes(eot.now)}"
|
|
9
|
+
sleep 11
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
Wiki 3:
|
|
13
|
+
|
|
14
|
+
latitude, longitude, date = 41.9474, -88.74467, "2013-12-25"
|
|
15
|
+
require 'eot';eot = Eot.new()
|
|
16
|
+
# set the coordinates manually
|
|
17
|
+
eot.latitude = latitude; eot.longitude = longitude; eot.ajd = Date.parse(date).jd
|
|
18
|
+
eot.sunrise_dt().to_time
|
|
19
|
+
eot.sunset_dt().to_time
|
|
20
|
+
|
|
21
|
+
Wiki 4:
|
|
22
|
+
|
|
23
|
+
require 'eot';eot = Eot.new()
|
|
24
|
+
puts "Show the Local Apparent Sidereal time at the Royal Greenwich Observatory"
|
|
25
|
+
loop do
|
|
26
|
+
eot.ajd = DateTime.now.to_time.utc.to_datetime.ajd
|
|
27
|
+
puts "LST = #{ eot.string_time(((eot.tl_Aries() * Eot::R2D) / 15.0)) }"
|
|
28
|
+
sleep ( 1 - 0.00273790935/1.0027390935) / 1.00273790935
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
Wiki 5:
|
|
32
|
+
|
|
33
|
+
require 'eot';eot = Eot.new()
|
|
34
|
+
"There are #{Eot::SM * 6} hours in a sidereal day."
|
|
35
|
+
"That is why on the next day the stars are about 4 minutes earlier."
|
|
36
|
+
obtime0 = Time.now
|
|
37
|
+
obtime1 = obtime0 + Eot::SM * 6 * 3600
|
|
38
|
+
"Now you know when to look next time."
|
|
39
|
+
|
|
40
|
+
Wiki 6:
|
|
41
|
+
|
|
42
|
+
require 'eot'; eot = Eot.new(); eot.ajd = Date.today.jd.to_f
|
|
43
|
+
DateTime.jd(eot.sunrise_jd + 0.5)
|
|
44
|
+
DateTime.jd(eot.sunset_jd + 0.5)
|
|
45
|
+
|
|
46
|
+
wiki 7:
|
|
47
|
+
|
|
48
|
+
require 'eot'; eot = Eot.new(); eot.ajd = Date.today.jd.to_f
|
|
49
|
+
geo = GeoLatLng.new
|
|
50
|
+
geo.addr = "8000 South Michigan Ave., Chicago, IL"
|
|
51
|
+
geo.get_coordinates_from_address
|
|
52
|
+
eot.longitude = geo.lng;eot.latitude = geo.lat
|
|
53
|
+
eot.ajd_to_datetime(eot.sunrise_jd)
|
|
54
|
+
eot.ajd_to_datetime(eot.sunset_jd)
|
|
55
|
+
|
data/wiki2.md
ADDED
data.tar.gz.sig
ADDED
|
Binary file
|