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
data/ext/eot/ceot.c
CHANGED
|
@@ -30,21 +30,25 @@ double eoe(double t)
|
|
|
30
30
|
|
|
31
31
|
double eqc(double ma, double t)
|
|
32
32
|
{
|
|
33
|
-
double
|
|
34
|
-
e = eoe(t);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
double a1, a2, a3, a4, a5, s1, s2, s3, s4, s5, e;
|
|
34
|
+
e = eoe(t);
|
|
35
|
+
s1 = sin( 1.0 * ma );
|
|
36
|
+
s2 = sin( 2.0 * ma );
|
|
37
|
+
s3 = sin( 3.0 * ma );
|
|
38
|
+
s4 = sin( 4.0 * ma );
|
|
39
|
+
s5 = sin( 5.0 * ma );
|
|
40
|
+
a1 = s1 * 2;
|
|
41
|
+
a2 = s2 * 5.0/4.0;
|
|
42
|
+
a3 = s3 * 13.0/12.0 - s1 * 1.0/4.0;
|
|
43
|
+
a4 = s4 * 103.0/96.0 - s2 * 11.0/24.0;
|
|
44
|
+
a5 = s5 * 1097.0/960.0 + s1 * 5.0/96.0 - s3 * 43.0/64.0;
|
|
40
45
|
/* Equation of Center */
|
|
41
|
-
a =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return a;
|
|
46
|
+
//a = s1 * (e * 2.0 - e3 * 1.0/4.0 + e5 * 5.0/96.0) +
|
|
47
|
+
// s2 * (e2 * 5.0/4.0 - 0.0 - e4 * 11.0/24.0) +
|
|
48
|
+
// s3 * (e3 * 13.0/12.0 - 0.0 - e5 * 43.0/64.0) +
|
|
49
|
+
// s4 * e4 * 103.0/96.0 +
|
|
50
|
+
// s5 * e5 * 1097.0/960.0;
|
|
51
|
+
return e * (a1 + e * (a2 + e * (a3 + e * (a4 + e * a5))));
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
double tlSun(double ma, double t)
|
data/ext/eot/extconf.rb
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
require
|
|
2
|
-
|
|
3
|
-
extension_name
|
|
4
|
-
|
|
5
|
-
create_makefile(extension_name)
|
|
1
|
+
require 'mkmf'
|
|
2
|
+
extension_name = 'eot/eot'
|
|
3
|
+
dir_config(extension_name)
|
|
4
|
+
create_makefile(extension_name)
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# class Eot file = angle_displays.rb
|
|
2
|
+
class Eot
|
|
3
|
+
def deg_string(sgn, d, m, s, ds)
|
|
4
|
+
sgn +
|
|
5
|
+
format('%03d', d) +
|
|
6
|
+
':' +
|
|
7
|
+
format('%02d', m) +
|
|
8
|
+
':' +
|
|
9
|
+
format('%02d', s) +
|
|
10
|
+
'.' +
|
|
11
|
+
format('%3.3d', ds)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# From displays.rb
|
|
15
|
+
# String formatter for d:m:s display
|
|
16
|
+
def degrees_to_s(radians = 0.0)
|
|
17
|
+
radians.nil? ? radians = 0.0 : radians
|
|
18
|
+
radians < 0 ? sign = '-' : sign = '+'
|
|
19
|
+
deg = (radians * R2D).abs
|
|
20
|
+
int_deg = Integer(deg)
|
|
21
|
+
min = 60.0 * (deg - int_deg)
|
|
22
|
+
int_min = Integer(min)
|
|
23
|
+
sec = 60.0 * (min - int_min)
|
|
24
|
+
int_sec = Integer(sec)
|
|
25
|
+
int_ds = Integer(1000.0 * (sec - int_sec))
|
|
26
|
+
deg_string(sign, int_deg, int_min, int_sec, int_ds)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# From displays.rb
|
|
30
|
+
# String format of apparent longitude
|
|
31
|
+
def string_al_sun
|
|
32
|
+
degrees_to_s(al_sun)
|
|
33
|
+
end
|
|
34
|
+
alias_method :apparent_longitude_string, :string_al_sun
|
|
35
|
+
|
|
36
|
+
# From displays.rb
|
|
37
|
+
# String format of declination
|
|
38
|
+
def string_dec_sun
|
|
39
|
+
degrees_to_s(dec_sun)
|
|
40
|
+
end
|
|
41
|
+
alias_method :declination_string, :string_dec_sun
|
|
42
|
+
|
|
43
|
+
# From displays.rb
|
|
44
|
+
# String format for delta oblique
|
|
45
|
+
def string_delta_oblique
|
|
46
|
+
show_minutes(delta_oblique)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# From displays.rb
|
|
50
|
+
# String format for delta orbit
|
|
51
|
+
def string_delta_orbit
|
|
52
|
+
show_minutes(delta_orbit)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# From displays.rb
|
|
56
|
+
# String format for centre
|
|
57
|
+
def string_eqc
|
|
58
|
+
degrees_to_s(center)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# From displays.rb
|
|
62
|
+
# String format of mean anomaly
|
|
63
|
+
def string_ma_sun
|
|
64
|
+
degrees_to_s(@ma)
|
|
65
|
+
end
|
|
66
|
+
alias_method :mean_anomaly_string, :string_ma_sun
|
|
67
|
+
|
|
68
|
+
# From displays.rb
|
|
69
|
+
# String format of right ascension
|
|
70
|
+
def string_ra_sun
|
|
71
|
+
degrees_to_s(ra_sun)
|
|
72
|
+
end
|
|
73
|
+
alias_method :right_ascension_string, :string_ra_sun
|
|
74
|
+
|
|
75
|
+
# From displays.rb
|
|
76
|
+
# String format of true anomaly
|
|
77
|
+
def string_ta_sun
|
|
78
|
+
degrees_to_s(ta_sun)
|
|
79
|
+
end
|
|
80
|
+
alias_method :true_anomaly_string, :string_ta_sun
|
|
81
|
+
|
|
82
|
+
# From displays.rb
|
|
83
|
+
# String format of true longitude
|
|
84
|
+
def string_tl_sun
|
|
85
|
+
degrees_to_s(tl_sun)
|
|
86
|
+
end
|
|
87
|
+
alias_method :true_longitude_string, :string_tl_sun
|
|
88
|
+
|
|
89
|
+
# From displays.rb
|
|
90
|
+
# String format of true obliquity
|
|
91
|
+
def string_to_earth
|
|
92
|
+
degrees_to_s(to_earth)
|
|
93
|
+
end
|
|
94
|
+
alias_method :true_obliquity_string, :string_to_earth
|
|
95
|
+
end
|
data/lib/eot/angles.rb
CHANGED
|
@@ -1,291 +1,160 @@
|
|
|
1
|
-
# angles.rb
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
#
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
#
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
#
|
|
80
|
-
#
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
#
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
#
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
#
|
|
124
|
-
#
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
end
|
|
139
|
-
alias_method :
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
#
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
@ta = ( @ajd - DJ00 ) / DJC
|
|
162
|
-
# @ma = delta_equinox()[2]
|
|
163
|
-
@ma = Celes.falp03(@ta)
|
|
164
|
-
end
|
|
165
|
-
alias_method :mean_anomaly, :ma_Sun
|
|
166
|
-
|
|
167
|
-
# From angles.rb:
|
|
168
|
-
# Mean equinox point where right ascension is measured from as zero hours.
|
|
169
|
-
# # see http://www.iausofa.org/publications/aas04.pdf
|
|
170
|
-
def ml_Aries()
|
|
171
|
-
# jd = @ta * DJC # convert first term back to jdn - J2000
|
|
172
|
-
# old terms
|
|
173
|
-
# angle = (36000.770053608 / DJC + 360) * jd # 36000.770053608 = 0.9856473662862 * DJC
|
|
174
|
-
# total = [ -1.0/3.8710000e7, 3.87930e-4, 0, 100.460618375 ].inject(0.0) {|p, a| p * ta[0] + a} + 180 + angle
|
|
175
|
-
# newer terms seem to be in arcseconds / 15.0
|
|
176
|
-
# 0.0000013, - 0.0000062, 0.0931118, 307.4771600, 8639877.3173760, 24110.5493771
|
|
177
|
-
# angle = (35999.4888224 / DJC + 360) * jd
|
|
178
|
-
# total = angle + 280.460622404583 +
|
|
179
|
-
# @ta[ 0 ] * 1.281154833333 +
|
|
180
|
-
# @ta[ 1 ] * 3.87965833333e-4 +
|
|
181
|
-
# @ta[ 2 ] * -2.58333333333e-8 +
|
|
182
|
-
# @ta[ 3 ] * 5.41666666666e-9
|
|
183
|
-
# total = [5.41666666666e-9, -2.58333333333e-8, 3.87965833333e-4, 1.281154833333, 280.460622404583].inject(0.0) {|p, a| p * @ta + a}
|
|
184
|
-
# mod_360( angle + total ) * D2R
|
|
185
|
-
dt = 67.184
|
|
186
|
-
tt = @ajd + dt / 86400.0#Celes.ut1tt(@ajd, 0, dt)
|
|
187
|
-
Celes.gmst06(@ajd, 0, tt, 0)
|
|
188
|
-
end
|
|
189
|
-
alias_method :mean_longitude_aries, :ml_Aries
|
|
190
|
-
|
|
191
|
-
# From angles.rb:
|
|
192
|
-
# mean obliquity of Earth
|
|
193
|
-
def mo_Earth()
|
|
194
|
-
# [ -0.0000000434, -0.000000576, 0.00200340,
|
|
195
|
-
# -0.0001831, -46.836769, 84381.406 ].inject(0.0) {|p, a| p * @ta + a} * DAS2R
|
|
196
|
-
Celes.obl06(@ajd, 0)
|
|
197
|
-
end
|
|
198
|
-
alias_method :mean_obliquity_of_ecliptic, :mo_Earth
|
|
199
|
-
alias_method :mean_obliquity, :mo_Earth
|
|
200
|
-
|
|
201
|
-
# From angles.rb:
|
|
202
|
-
# omega is a component of nutation and used
|
|
203
|
-
# in apparent longitude
|
|
204
|
-
# omega is the longitude of the mean ascending node of the lunar orbit
|
|
205
|
-
# on the ecliptic plane measured from the mean equinox of date.
|
|
206
|
-
def omega()
|
|
207
|
-
# delta_equinox()[ 3 ]
|
|
208
|
-
Celes.faom03(@ta)
|
|
209
|
-
end
|
|
210
|
-
|
|
211
|
-
# From angles.rb:
|
|
212
|
-
# solar right ascension
|
|
213
|
-
def ra_Sun()
|
|
214
|
-
y0 = sin( al(@ma, @ta, Celes.faom03(@ta)) ) * cos( Celes.nut06a(@ajd, 0)[ 1 ] +
|
|
215
|
-
Celes.obl06(@ajd, 0) )
|
|
216
|
-
Celes.anp( PI + atan2( -y0, -cos( al(@ma, @ta, Celes.faom03(@ta)) ) ) )
|
|
217
|
-
end
|
|
218
|
-
alias_method :right_ascension, :ra_Sun
|
|
219
|
-
|
|
220
|
-
# From angles.rb:
|
|
221
|
-
# sine apparent longitude
|
|
222
|
-
# used in solar declination
|
|
223
|
-
def sine_al_Sun()
|
|
224
|
-
sin( al(@ma, @ta, Celes.faom03(@ta)) )
|
|
225
|
-
end
|
|
226
|
-
alias_method :sine_apparent_longitude, :sine_al_Sun
|
|
227
|
-
|
|
228
|
-
# From angles.rb:
|
|
229
|
-
# sine true longitude
|
|
230
|
-
# used in solar right ascension
|
|
231
|
-
def sine_tl_Sun()
|
|
232
|
-
sin( tl(@ma, @ta) )
|
|
233
|
-
end
|
|
234
|
-
alias_method :sine_true_longitude, :sine_tl_Sun
|
|
235
|
-
|
|
236
|
-
# From angles.rb:
|
|
237
|
-
# sine true obliquity angle of Earth
|
|
238
|
-
# used in solar declination
|
|
239
|
-
def sine_to_Earth()
|
|
240
|
-
sin(Celes.nut06a(@ajd, 0)[ 1 ] + Celes.obl06(@ajd, 0))
|
|
241
|
-
end
|
|
242
|
-
|
|
243
|
-
# From angles.rb:
|
|
244
|
-
# angle true anomaly
|
|
245
|
-
# used in equation of time
|
|
246
|
-
def ta_Sun()
|
|
247
|
-
Celes.anp(@ma + eqc( @ma, @ta ))
|
|
248
|
-
end
|
|
249
|
-
alias_method :true_anomaly, :ta_Sun
|
|
250
|
-
|
|
251
|
-
# From angles.rb:
|
|
252
|
-
# true longitude of equinox 'first point of aries'
|
|
253
|
-
# considers nutation
|
|
254
|
-
def tl_Aries()
|
|
255
|
-
# Celes.anp(eq_of_equinox() + ml_Aries())
|
|
256
|
-
dt = 67.184
|
|
257
|
-
tt = @ajd + dt / 86400.0#Celes.ut1tt(@ajd, 0, dt)
|
|
258
|
-
Celes.gst06a(@ajd, 0, tt, 0)
|
|
259
|
-
end
|
|
260
|
-
alias_method :true_longitude_aries, :tl_Aries
|
|
261
|
-
|
|
262
|
-
# From angles.rb:
|
|
263
|
-
# angle of true longitude sun
|
|
264
|
-
# used in equation of time
|
|
265
|
-
def tl_Sun()
|
|
266
|
-
#Celes.anp(gml_Sun() + center())
|
|
267
|
-
tl(@ma, @ta)
|
|
268
|
-
end
|
|
269
|
-
alias_method :true_longitude, :tl_Sun
|
|
270
|
-
alias_method :ecliptic_longitude, :tl_Sun
|
|
271
|
-
alias_method :lambda, :tl_Sun
|
|
272
|
-
|
|
273
|
-
# From angles.rb:
|
|
274
|
-
# true obliquity considers nutation
|
|
275
|
-
def to_Earth()
|
|
276
|
-
Celes.nut06a(@ajd, 0)[ 1 ] + Celes.obl06(@ajd, 0)
|
|
277
|
-
end
|
|
278
|
-
alias_method :obliquity_correction, :to_Earth
|
|
279
|
-
alias_method :true_obliquity, :to_Earth
|
|
280
|
-
alias_method :toearth, :to_Earth
|
|
281
|
-
|
|
282
|
-
end
|
|
283
|
-
|
|
284
|
-
if __FILE__ == $PROGRAM_NAME
|
|
285
|
-
|
|
286
|
-
spec = File.expand_path('../../../test/', __FILE__)
|
|
287
|
-
$LOAD_PATH.unshift(spec) unless $LOAD_PATH.include?(spec)
|
|
288
|
-
require 'angles_spec'
|
|
289
|
-
require 'aliased_angles_spec'
|
|
290
|
-
|
|
291
|
-
end
|
|
1
|
+
# class Eot file = angles.rb
|
|
2
|
+
class Eot
|
|
3
|
+
include Math
|
|
4
|
+
# From angles.rb:
|
|
5
|
+
# Apparent solar longitude = true longitude - aberation
|
|
6
|
+
def al_sun
|
|
7
|
+
Celes.anp(al(@ma, @ta, Celes.faom03(@ta)))
|
|
8
|
+
end
|
|
9
|
+
alias_method :apparent_longitude, :al_sun
|
|
10
|
+
alias_method :alsun, :al_sun
|
|
11
|
+
|
|
12
|
+
# From angles.rb:
|
|
13
|
+
# equation of centre
|
|
14
|
+
# added to mean anomaly to get true anomaly.
|
|
15
|
+
def center
|
|
16
|
+
eqc(@ma, @ta)
|
|
17
|
+
end
|
|
18
|
+
alias_method :equation_of_center, :center
|
|
19
|
+
|
|
20
|
+
# From angles.rb:
|
|
21
|
+
# solar declination
|
|
22
|
+
def dec_sun
|
|
23
|
+
asin(sin(Celes.nut06a(@ajd, 0)[1] + Celes.obl06(@ajd, 0)) *
|
|
24
|
+
sin(al(@ma, @ta, Celes.faom03(@ta))))
|
|
25
|
+
end
|
|
26
|
+
alias_method :declination, :dec_sun
|
|
27
|
+
|
|
28
|
+
# From angles.rb:
|
|
29
|
+
# eccentricity of elliptical Earth orbit around Sun
|
|
30
|
+
# Horners' calculation method
|
|
31
|
+
def eccentricity_earth
|
|
32
|
+
eoe(@ta)
|
|
33
|
+
end
|
|
34
|
+
alias_method :eccentricity_earth_orbit, :eccentricity_earth
|
|
35
|
+
|
|
36
|
+
# From angles.rb:
|
|
37
|
+
# equation of equinox
|
|
38
|
+
# used for true longitude of Aries
|
|
39
|
+
# Depricated by Celes.gst06a()
|
|
40
|
+
def eq_of_equinox
|
|
41
|
+
cos(Celes.nut06a(@ajd, 0)[1] +
|
|
42
|
+
Celes.obl06(@ajd, 0)) *
|
|
43
|
+
Celes.nut06a(@ajd, 0)[0]
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# From angles.rb:
|
|
47
|
+
# angle geometric mean longitude
|
|
48
|
+
# needed to get true longitude for low accuracy.
|
|
49
|
+
def gml_sun
|
|
50
|
+
ml(@ta)
|
|
51
|
+
end
|
|
52
|
+
alias_method :geometric_mean_longitude, :gml_sun
|
|
53
|
+
|
|
54
|
+
# From angles.rb:
|
|
55
|
+
# horizon angle for provided geo coordinates
|
|
56
|
+
# used for angles from transit to horizons
|
|
57
|
+
def ha_sun
|
|
58
|
+
zenith = 90.8333 # use other zeniths here for non commercial
|
|
59
|
+
top = cosZ(zenith) - sin(dec_sun) * sin(@latitude * D2R)
|
|
60
|
+
bottom = cos(dec_sun) * cos(@latitude * D2R)
|
|
61
|
+
t_cosine = top / bottom
|
|
62
|
+
t_cosine > 1.0 || t_cosine < -1.0 ? cos = 1.0 : cos = t_cosine
|
|
63
|
+
acos(cos)
|
|
64
|
+
end
|
|
65
|
+
alias_method :horizon_angle, :ha_sun
|
|
66
|
+
|
|
67
|
+
# From angles.rb:
|
|
68
|
+
# angle of Suns' mean anomaly
|
|
69
|
+
# calculated in nutation.rb via celes function
|
|
70
|
+
# sets ta attribute for the rest the methods needing it.
|
|
71
|
+
# used in equation of time
|
|
72
|
+
# and to get true anomaly true longitude via center equation
|
|
73
|
+
def ma_sun
|
|
74
|
+
@ta = (@ajd - DJ00) / DJC
|
|
75
|
+
@ma = Celes.falp03(@ta)
|
|
76
|
+
end
|
|
77
|
+
alias_method :mean_anomaly, :ma_sun
|
|
78
|
+
|
|
79
|
+
# From angles.rb:
|
|
80
|
+
# Mean equinox point where right ascension is measured from as zero hours.
|
|
81
|
+
# # see http://www.iausofa.org/publications/aas04.pdf
|
|
82
|
+
def ml_aries
|
|
83
|
+
dt = 67.184
|
|
84
|
+
tt = @ajd + dt / 86_400.0
|
|
85
|
+
Celes.gmst06(@ajd, 0, tt, 0)
|
|
86
|
+
end
|
|
87
|
+
alias_method :mean_longitude_aries, :ml_aries
|
|
88
|
+
|
|
89
|
+
# From angles.rb:
|
|
90
|
+
# mean obliquity of Earth
|
|
91
|
+
def mo_earth
|
|
92
|
+
Celes.obl06(@ajd, 0)
|
|
93
|
+
end
|
|
94
|
+
alias_method :mean_obliquity_of_ecliptic, :mo_earth
|
|
95
|
+
alias_method :mean_obliquity, :mo_earth
|
|
96
|
+
|
|
97
|
+
# From angles.rb:
|
|
98
|
+
# omega is a component of nutation and used
|
|
99
|
+
# in apparent longitude
|
|
100
|
+
# omega is the longitude of the mean ascending node of the lunar orbit
|
|
101
|
+
# on the ecliptic plane measured from the mean equinox of date.
|
|
102
|
+
def omega
|
|
103
|
+
Celes.faom03(@ta)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# From angles.rb:
|
|
107
|
+
# solar right ascension
|
|
108
|
+
def ra_sun
|
|
109
|
+
y0 = sin(al(@ma, @ta, Celes.faom03(@ta))) * cos(Celes.nut06a(@ajd, 0)[1] +
|
|
110
|
+
Celes.obl06(@ajd, 0))
|
|
111
|
+
Celes.anp(PI + atan2(-y0, -cos(al(@ma, @ta, Celes.faom03(@ta)))))
|
|
112
|
+
end
|
|
113
|
+
alias_method :right_ascension, :ra_sun
|
|
114
|
+
|
|
115
|
+
# From angles.rb:
|
|
116
|
+
# angle true anomaly
|
|
117
|
+
# used in equation of time
|
|
118
|
+
def ta_sun
|
|
119
|
+
Celes.anp(@ma + eqc(@ma, @ta))
|
|
120
|
+
end
|
|
121
|
+
alias_method :true_anomaly, :ta_sun
|
|
122
|
+
|
|
123
|
+
# From angles.rb:
|
|
124
|
+
# true longitude of equinox 'first point of aries'
|
|
125
|
+
# considers nutation
|
|
126
|
+
def tl_aries
|
|
127
|
+
dt = 67.184
|
|
128
|
+
tt = @ajd + dt / 86_400.0
|
|
129
|
+
Celes.gst06a(@ajd, 0, tt, 0)
|
|
130
|
+
end
|
|
131
|
+
alias_method :true_longitude_aries, :tl_aries
|
|
132
|
+
|
|
133
|
+
# From angles.rb:
|
|
134
|
+
# angle of true longitude sun
|
|
135
|
+
# used in equation of time
|
|
136
|
+
def tl_sun
|
|
137
|
+
tl(@ma, @ta)
|
|
138
|
+
end
|
|
139
|
+
alias_method :true_longitude, :tl_sun
|
|
140
|
+
alias_method :ecliptic_longitude, :tl_sun
|
|
141
|
+
alias_method :lambda, :tl_sun
|
|
142
|
+
|
|
143
|
+
# From angles.rb:
|
|
144
|
+
# true obliquity considers nutation
|
|
145
|
+
def to_earth
|
|
146
|
+
Celes.nut06a(@ajd, 0)[1] + Celes.obl06(@ajd, 0)
|
|
147
|
+
end
|
|
148
|
+
alias_method :obliquity_correction, :to_earth
|
|
149
|
+
alias_method :true_obliquity, :to_earth
|
|
150
|
+
alias_method :toearth, :to_earth
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
if __FILE__ == $PROGRAM_NAME
|
|
154
|
+
|
|
155
|
+
spec = File.expand_path('../../../test/eot', __FILE__)
|
|
156
|
+
$LOAD_PATH.unshift(spec) unless $LOAD_PATH.include?(spec)
|
|
157
|
+
require 'angles_spec'
|
|
158
|
+
require 'aliased_angles_spec'
|
|
159
|
+
|
|
160
|
+
end
|