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.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/.ruby-version +1 -1
  4. data/Gemfile +6 -4
  5. data/Gemfile.lock +21 -14
  6. data/Guardfile +4 -21
  7. data/Manifest.txt +18 -52
  8. data/README.rdoc +6 -6
  9. data/Rakefile +53 -92
  10. data/equationoftime.gemspec +48 -49
  11. data/examples/my_lst.rb +9 -0
  12. data/examples/use_addr.rb +20 -0
  13. data/examples/use_ajd.rb +40 -0
  14. data/ext/eot/ceot.c +18 -14
  15. data/ext/eot/extconf.rb +4 -5
  16. data/lib/eot/angle_displays.rb +95 -0
  17. data/lib/eot/angles.rb +160 -291
  18. data/lib/eot/constants.rb +78 -81
  19. data/lib/eot/deltas.rb +40 -0
  20. data/lib/eot/geo_lat_lng_smt.rb +30 -57
  21. data/lib/eot/init.rb +86 -124
  22. data/lib/eot/time_displays.rb +105 -0
  23. data/lib/eot/times.rb +118 -121
  24. data/lib/eot/trigometric.rb +51 -0
  25. data/lib/eot/utilities.rb +49 -50
  26. data/lib/eot/version.rb +3 -2
  27. data/lib/eot.rb +11 -5
  28. data/test/eot/aliased_angles_spec.rb +291 -0
  29. data/test/eot/aliased_displays_spec.rb +126 -0
  30. data/test/{aliased_utilities_spec.rb → eot/aliased_utilities_spec.rb} +32 -36
  31. data/test/eot/angles_spec.rb +261 -0
  32. data/test/eot/constants_spec.rb +17 -0
  33. data/test/eot/displays_spec.rb +111 -0
  34. data/test/eot/geo_spec.rb +40 -0
  35. data/test/eot/init_spec.rb +45 -0
  36. data/test/eot/times_spec.rb +137 -0
  37. data/wiki.md +55 -0
  38. data/wiki2.md +4 -0
  39. data.tar.gz.sig +0 -0
  40. metadata +55 -69
  41. metadata.gz.sig +0 -0
  42. data/.settings/org.eclipse.ltk.core.refactoring.prefs +0 -2
  43. data/examples/analemma_data_generator.rb +0 -58
  44. data/examples/check_date_type.rb +0 -60
  45. data/examples/compare_geoc_long_ra.rb +0 -44
  46. data/examples/data_table_for_astro_dog.rb +0 -45
  47. data/examples/earth_rotation.rb +0 -42
  48. data/examples/eot_methods_list.rb +0 -48
  49. data/examples/eot_plot.r +0 -57
  50. data/examples/eot_suntimes.rb +0 -149
  51. data/examples/equation_of_time.py +0 -186
  52. data/examples/figure_1.jpg +0 -0
  53. data/examples/file_converter.rb +0 -31
  54. data/examples/from_readme.rb +0 -14
  55. data/examples/from_wiki.rb +0 -46
  56. data/examples/geo_locator.rb +0 -16
  57. data/examples/getjd.rb +0 -45
  58. data/examples/gmst_gast_non_sofa.rb +0 -406
  59. data/examples/input_suntimes.rb +0 -24
  60. data/examples/julian_day_formula.rb +0 -29
  61. data/examples/julian_day_formula.txt +0 -12
  62. data/examples/my_time_conversion.rb +0 -21
  63. data/examples/nutation_series.txt +0 -678
  64. data/examples/nutation_table5_3a.txt +0 -682
  65. data/examples/ptime.rb +0 -162
  66. data/examples/suntimes.rb +0 -30
  67. data/examples/suntimes_test.rb +0 -50
  68. data/examples/t_sofa.rb +0 -8228
  69. data/examples/test_celes.rb +0 -51
  70. data/examples/test_ceot.rb +0 -55
  71. data/examples/test_poly_eval.rb +0 -32
  72. data/examples/time_scales.rb +0 -29
  73. data/examples/times_year.rb +0 -53
  74. data/examples/usage_example.rb +0 -26
  75. data/examples/use_angles.rb +0 -222
  76. data/lib/eot/displays.rb +0 -216
  77. data/lib/eot/eot.so +0 -0
  78. data/lib/eot/nutation.rb +0 -78
  79. data/run_tests_eclipse.rb +0 -1
  80. data/test/aliased_angles_spec.rb +0 -239
  81. data/test/aliased_displays_spec.rb +0 -105
  82. data/test/angles_spec.rb +0 -264
  83. data/test/constants_spec.rb +0 -20
  84. data/test/displays_spec.rb +0 -110
  85. data/test/geo_spec.rb +0 -38
  86. data/test/init_spec.rb +0 -44
  87. data/test/nutation_spec.rb +0 -37
  88. data/test/spec_config.rb +0 -8
  89. data/test/times_spec.rb +0 -133
  90. 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 a, e, e2, e3, e4, e5;
34
- e = eoe(t);
35
- e2 = pow(e, 2);
36
- e3 = pow(e, 3);
37
- e4 = pow(e, 4);
38
- e5 = pow(e, 5);
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 = sin( 1.0 * ma ) * (e * 2.0 - e3 * 1.0/4.0 + e5 * 5.0/96.0) +
42
- sin( 2.0 * ma ) * (e2 * 5.0/4.0 - 0.0 - e4 * 11.0/24.0) +
43
- sin( 3.0 * ma ) * (e3 * 13.0/12.0 - 0.0 - e5 * 43.0/64.0) +
44
- sin( 4.0 * ma ) * e4 * 103.0/96.0 +
45
- sin( 5.0 * ma ) * e5 * 1097.0/960.0;
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 "mkmf"
2
- #create_makefile('ceot')
3
- extension_name = 'eot/eot'
4
- dir_config(extension_name)
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
- require 'celes'
4
-
5
- class Eot
6
- include Math
7
- # From angles.rb:
8
- # Apparent solar longitude = true longitude - aberation
9
- def al_Sun()
10
- #Celes.anp(tl_Sun() - 0.00569 * D2R - 0.00478 * D2R * sin(omega()))
11
- al(@ma, @ta, Celes.faom03(@ta))
12
- end
13
- alias_method :apparent_longitude, :al_Sun
14
- alias_method :alsun, :al_Sun
15
-
16
- # From angles.rb:
17
- # delta epsilon
18
- # component of equation of equinox
19
- def angle_delta_epsilon()
20
- Celes.nut06a(@ajd, 0)[ 1 ]
21
- end
22
- alias_method :delta_epsilon, :angle_delta_epsilon
23
-
24
- # From angles.rb:
25
- # one time component to total equation of time
26
- def angle_delta_oblique()
27
- al(@ma, @ta, Celes.faom03(@ta)) - ra_Sun()
28
- end
29
- alias_method :delta_t_ecliptic, :angle_delta_oblique
30
- alias_method :delta_oblique, :angle_delta_oblique
31
-
32
- # From angles.rb:
33
- # one time component to total equation of time
34
- def angle_delta_orbit()
35
- @ma - Celes.anp(@ma + eqc( @ma, @ta ))
36
- end
37
- alias_method :delta_t_elliptic, :angle_delta_orbit
38
- alias_method :delta_orbit, :angle_delta_orbit
39
-
40
-
41
- # From angles.rb:
42
- # component of equation of equinox
43
- def angle_delta_psi()
44
- Celes.nut06a(@ajd, 0)[ 0 ]
45
- end
46
- alias_method :delta_psi, :angle_delta_psi
47
-
48
- # From angles.rb:
49
- # total equation of time
50
- def angle_equation_of_time()
51
- #~ @ma = ma_Sun()
52
- @ma - Celes.anp(@ma + eqc( @ma, @ta )) + al(@ma, @ta, Celes.faom03(@ta)) - ra_Sun()
53
- end
54
- alias_method :eot, :angle_equation_of_time
55
-
56
- # From angles.rb:
57
- # equation of centre
58
- # added to mean anomaly to get true anomaly.
59
- def center()
60
- # sine_1M = sin( 1.0 * @ma )
61
- # sine_2M = sin( 2.0 * @ma )
62
- # sine_3M = sin( 3.0 * @ma )
63
- # sine_4M = sin( 4.0 * @ma )
64
- # sine_5M = sin( 5.0 * @ma )
65
- # e = eccentricity_Earth()
66
- # sine_1M * ( 2.0 * e - e**3 * 1.0/4.0 + 5/96.0 * e**5 ) +
67
- # sine_2M * ( 5.0/4.0 * e**2 - 11/24.0 * e**4 ) +
68
- # sine_3M * ( 13.0/12.0 * e**3 - 43/64.0 * e**5 ) +
69
- # sine_4M * 103.0/96.0 * e**4 +
70
- # sine_5M * 1097.0/960.0 * e**5
71
- # sine_1M * ( 1.914602 - @ta * ( 0.004817 + @ta * 0.000014 )) + +
72
- # sine_2M * ( 0.019993 - @ta * 0.000101 ) + +
73
- # sine_3M * 0.000289
74
- eqc( @ma, @ta )
75
- end
76
- alias_method :equation_of_center, :center
77
-
78
- # From angles.rb:
79
- # cosine apparent longitude
80
- # could be useful when dividing
81
- def cosine_al_Sun()
82
- cos( al(@ma, @ta, Celes.faom03(@ta)) )
83
- end
84
- alias_method :cosine_apparent_longitude, :cosine_al_Sun
85
- alias_method :cosalsun, :cosine_al_Sun
86
-
87
- # From angles.rb:
88
- # cosine true longitude
89
- # used in solar right ascension
90
- def cosine_tl_Sun()
91
- cos( tl(@ma, @ta) )
92
- end
93
- alias_method :cosine_true_longitude, :cosine_tl_Sun
94
-
95
- # From angles.rb:
96
- # cosine true obliquity
97
- # used in solar right ascension and equation of equinox
98
- def cosine_to_Earth()
99
- cos( Celes.nut06a(@ajd, 0)[ 1 ] + Celes.obl06(@ajd, 0) )
100
- end
101
- alias_method :cosine_true_obliquity, :cosine_to_Earth
102
-
103
- # From angles.rb:
104
- # solar declination
105
- def dec_Sun()
106
- asin( sin(Celes.nut06a(@ajd, 0)[ 1 ] + Celes.obl06(@ajd, 0)) *
107
- sin( al(@ma, @ta, Celes.faom03(@ta))))
108
- end
109
- alias_method :declination, :dec_Sun
110
-
111
-
112
- # From angles.rb:
113
- # eccentricity of elliptical Earth orbit around Sun
114
- # Horners' calculation method
115
- def eccentricity_Earth()
116
- # [-0.0000001235, -0.000042037, 0.016708617].inject(0.0) {|p, a| p * @ta + a}
117
- eoe(@ta)
118
- end
119
- alias_method :eccentricity_earth_orbit, :eccentricity_Earth
120
-
121
- # From angles.rb:
122
- # equation of equinox
123
- # used for true longitude of Aries
124
- # Depricated by Celes.gst06a()
125
- def eq_of_equinox()
126
- cos( Celes.nut06a(@ajd, 0)[ 1 ] + Celes.obl06(@ajd, 0) ) * Celes.nut06a(@ajd, 0)[ 0 ]
127
- end
128
-
129
-
130
- # From angles.rb:
131
- # angle geometric mean longitude
132
- # needed to get true longitude for low accuracy.
133
- def gml_Sun()
134
- #total = [ 1.0/-19880000.0, 1.0/-152990.0, 1.0/499310.0,
135
- # 0.0003032028, 36000.76982779, 280.4664567 ]
136
- # mod_360(total.inject(0.0) {|p, a| p * @ta + a}) * D2R
137
- ml(@ta)
138
- end
139
- alias_method :geometric_mean_longitude, :gml_Sun
140
-
141
- # From angles.rb:
142
- # horizon angle for provided geo coordinates
143
- # used for angles from transit to horizons
144
- def ha_Sun()
145
- zenith = 90.8333 # use other zeniths here for non commercial
146
- top = cosZ( zenith ) - sin( dec_Sun() ) * sin( @latitude * D2R )
147
- bottom = cos( dec_Sun() ) * cos( @latitude * D2R )
148
- t_cosine = top / bottom
149
- t_cosine > 1.0 || t_cosine < -1.0 ? cos = 1.0 : cos = t_cosine
150
- acos( cos )
151
- end
152
- alias_method :horizon_angle, :ha_Sun
153
-
154
- # From angles.rb:
155
- # angle of Suns' mean anomaly
156
- # calculated in nutation.rb via celes function
157
- # sets ta attribute for the rest the methods needing it.
158
- # used in equation of time
159
- # and to get true anomaly true longitude via center equation
160
- def ma_Sun()
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