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
@@ -1,406 +0,0 @@
1
- # read_nutation_data.rb is a leftover from building it so I just left it in examples.
2
-
3
- begin
4
- require 'eot'
5
- rescue LoadError
6
- lib = File.expand_path('../../lib', __FILE__)
7
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
8
- require 'eot'
9
- end
10
- eot = Eot.new
11
-
12
- now = DateTime.now.to_time.utc.to_datetime
13
-
14
- =begin
15
-
16
- The file this data comes from is 'Circular_179.pdf' IAU 2000A Nutation Series.
17
- The first 678 lines are for lunisolar data.
18
-
19
- # Try to make an array using each line of the file
20
- filename = 'nutation_series.txt'
21
- temp_array = []
22
- data = File.readlines(filename)
23
- # Clean out whitespace and new line breaks.
24
- data.each {|i| temp_array << i.strip}
25
- # Make new muti-dimensional data array.
26
- data = []
27
- temp_array.each {|i| data << i.split}
28
- # Save the array in a file.
29
- File::open( "nutation_series.data", "w" ) do |f|
30
- f << data
31
- end
32
-
33
- # Make new muti-dimensional data array using yaml
34
- data = []
35
- temp_array.each {|i| data << i.split}
36
- # Save the array in a yaml file.
37
- File::open( "nutation_series.yaml", "w" ) do |f|
38
- f << data.to_yaml
39
- end
40
-
41
-
42
- # $:.unshift(File.expand_path(File.dirname(__FILE__)))
43
- # require 'nutation_series_data'
44
- # or for => Ruby 1.9.2
45
- require_relative 'nutation_series_data'
46
- # I manually added @data = to the beginning of the new array file nutation_series.rb so we may use it
47
- # data = @data
48
-
49
- # load in the yaml data
50
- data = []
51
- File.open( "nutation_series2.yaml" ) do |f|
52
- YAML.load_documents( f ) do |doc|
53
- data = doc
54
- end
55
- end
56
-
57
- =end
58
-
59
- ## data was initialized when the class instance was via nutation_series2.yaml file.
60
- #data = eot.data
61
- #file_path = File.expand_path( File.dirname( __FILE__ ) + "/nutation_table5_3a.yaml" )
62
- #data = YAML::load( File.open( file_path, 'r'), :safe => true ).freeze
63
- ## Arc seconds to radians formula
64
- #ARCSEC = 3600.0
65
- #dtr = Math::PI / 180.0 / ARCSEC # adjusted for working in the arc seconds values
66
-
67
- ## sine degrees
68
- #def sind(dtr, x)
69
- # Math::sin(dtr*x)
70
- #end
71
- ## cod degrees
72
- #def cosd(dtr, x)
73
- # Math::cos(dtr*x)
74
- #end
75
-
76
-
77
- ## The JD is at Noon 12:00 UTC for today
78
- ## In all of these expressions, T is the number of Julian centuries of TDB since 2000 Jan 1, 12h TDB (or,
79
- ## with negligible error, the number of Julian centuries of TT since J2000.0).
80
- #jd2000 = 2451545.0 # the J2000 Julian Day Number
81
- #
82
- #ajd = DateTime.now.to_time.utc.to_datetime.ajd.to_f
83
- #
84
- ## calculate time to julian centuries
85
- #t = eot.time_julian_century()
86
-
87
- ## Values are in arc seconds see below for definitions of terms
88
- #ma_moon = 485868.249036 + 1717915923.2178 * t[0] + 31.8792 * t[1] + 0.051635 * t[2] - 0.00024470 * t[3]
89
- #ma_sun = 1287104.79305 + 129596581.0481 * t[0] - 0.5532 * t[1] + 0.000136 * t[2] - 0.00001149 * t[3]
90
- #md_moon = 335779.526232 + 1739527262.8478 * t[0] - 12.7512 * t[1] - 0.001037 * t[2] + 0.00000417 * t[3]
91
- #me_moon = 1072260.70369 + 1602961601.2090 * t[0] - 6.3706 * t[1] + 0.006593 * t[2] - 0.00003169 * t[3]
92
- #omega = 450160.398036 - 6962890.5431 * t[0] + 7.4722 * t[1] + 0.007702 * t[2] - 0.00005939 * t[3]
93
-
94
- ## declare and clear these two variables for the sigma loop
95
- #delta_psi, delta_eps = 0, 0
96
- #
97
- #lines = data.size - 1
98
- #for i in 0..lines
99
- # fma_sun = data[i][0].to_i
100
- # fma_moon = data[i][1].to_i
101
- # fmd_moon = data[i][2].to_i
102
- # fme_moon = data[i][3].to_i
103
- # fomega = data[i][4].to_i
104
- # sine = sind(dtr, fma_moon * ma_moon +
105
- # fma_sun * ma_sun +
106
- # fmd_moon * md_moon +
107
- # fme_moon * me_moon +
108
- # fomega * omega)
109
- # cosine = cosd(dtr, fma_moon * ma_moon +
110
- # fma_sun * ma_sun +
111
- # fmd_moon * md_moon +
112
- # fme_moon * me_moon +
113
- # fomega * omega)
114
- # delta_psi += (data[i][6].to_f +
115
- # data[i][7].to_f * t[0]) * sine +
116
- # data[i][10].to_f * cosine
117
- #
118
- # delta_eps += (data[i][8].to_f +
119
- # data[i][9].to_f * t[0]) * cosine +
120
- # data[i][12].to_f * sine
121
- #
122
- #end
123
- #
124
- ## convert arc seconds to degree
125
- #def to_deg( arc_secs )
126
- # arc_secs / ARCSEC
127
- #end
128
- #
129
- #delta_eps = to_deg( delta_eps ) / 1000.0
130
- #delta_eps = eot.delta_epsilon(t)
131
- #
132
- #delta_psi = to_deg( delta_psi ) / 1000.0
133
- #delta_psi = eot.delta_psi(t)
134
-
135
- #Delta epsilon degrees decimal = #{to_deg(delta_eps)}
136
-
137
-
138
-
139
- ##Delta psi needs to be degrees and eps is degrees but dtr uses ARCSEC constant also we need the result back in ARCSEC / 15 to get time in secs.
140
- ## eoe = delta_psi / ARCSEC * cosd( dtr * ARCSEC, eps ) * ARCSEC / 15.0
141
- #eoe = eot.eq_of_equinox() / 15.0
142
- ##p eot.ml_Aries()
143
- #gmst = eot.ml_Aries() / 15.0 # make angle to time.
144
- ## eoe is ARCSEC so convert it to hours.
145
- #gast = gmst + eoe
146
-
147
-
148
-
149
- ##Mean Obliquity of Ecliptic degrees = #{eot.display_degrees(eps0)}
150
- #eot.mo_Earth()
151
- ##True Obliquity of Ecliptic degrees = #{eot.display_degrees(eps)}
152
- #eps = eot.to_Earth()
153
-
154
- #eoe = eot.eq_of_equinox() / 15.0
155
- #gmst = eot.ml_Aries() / 15.0 # make angle to time.
156
- #gast = gmst + eoe
157
- run = <<EOS
158
- #{now}
159
-
160
- #{now.to_time}
161
-
162
- The JD = #{eot.ajd = now.ajd.to_f}
163
-
164
- Mean Obliquity of Ecliptic = #{eot.degrees_to_s(eot.mo_Earth())}
165
-
166
- Delta epsilon in arc seconds = #{eot.delta_epsilon() * Eot::R2D * 3600.0}
167
-
168
- True Obliquity of Ecliptic degrees = #{eot.degrees_to_s(eot.to_Earth())}
169
-
170
- Delta psi in arc seconds = #{eot.delta_psi * Eot::R2D * 3600}
171
-
172
- Equation of equinox in seconds = Delta psi * cos epsilon = #{eot.eq_of_equinox() * Eot::R2D / 15.0 * 3600}
173
-
174
- Greenwich Mean Sidereal Time = #{eot.string_time(eot.ml_Aries() * Eot::R2D / 15.0)}
175
-
176
- Greenwich Apparent Sideral Time = #{eot.string_time(eot.ml_Aries() * Eot::R2D / 15.0 + eot.eq_of_equinox() * Eot::R2D / 15.0)}
177
-
178
- To compare results enter the date and time into http://www.celnav.de/longterm.htm
179
-
180
- You can use the methods in EOT instead of this example as this just shows how it works.
181
-
182
- EOS
183
-
184
- puts run
185
-
186
- # Helpful info
187
- =begin
188
- these values are in arc seconds
189
-
190
- Mean anomaly of the moon
191
- ma_moon = 485868.249036 + 1717915923.2178 * t + 31.8792 * t2 + 0.051635 * t3 - 0.00024470 * t4
192
-
193
- Mean anomaly of the sun
194
- ma_sun = 1287104.79305 + 129596581.0481 * t - 0.5532 * t2 + 0.000136 * t3 - 0.00001149 * t4
195
-
196
-
197
- Mean distance of the moon from the ascending node
198
- md_moon = 335779.526232 + 1739527262.8478 * t - 12.7512 * t2 - 0.001037 * t3 + 0.00000417 * t4
199
-
200
-
201
- Mean elongation of the moon
202
- me_moon = 1072260.70369 + 1602961601.2090 * t - 6.3706 * t2 + 0.006593 * t3 - 0.00003169 * t4
203
-
204
-
205
- Longitude of the ascending node of the moon
206
- omega = 450160.398036 - 6962890.5431 * t + 7.4722 * t2 + 0.007702 * t3 - 0.00005939 * t4
207
-
208
- =end
209
-
210
- =begin
211
-
212
- Manualy converted values from arc seconds to dergrees(not used here)
213
-
214
- ma_moon = 134.96340251 + 477198.8675605 * t + t2 / 112.92629677 + t3 / 69720.15106 - t4 / 14711892.112791
215
- ma_sun = 357.52910918 + 35999.0502911389 * t - t2 / 6507.592191 + t3 / 26470588.2353 - t4 / 313315926.89295
216
- md_moon = 93.27209062 + 483202.01745772 * t - t2 / 282.3264 - t3 / 3471552.555 + t4 / 863309352.5179856
217
- me_moon = 297.8501954694 + 445267.11144694 * t - t2 / 565.0959 + t3 / 546033.672 - t4 / 113600504.891
218
- omega = 125.04455501 - 1934.136261972 * t + t2 / 481.78582 + 0.007702 * t3 / 467411.062 - t4 / 60616265.3645
219
-
220
- =end
221
-
222
-
223
- =begin
224
-
225
- An example of usage for 'Circular_179.pdf' IAU 2000A Nutation Series
226
- The JavaScript from: view-source:http://www.celnav.de/longterm.htm
227
- //Nutation, obliquity of the ecliptic
228
- function Nutation()
229
- {
230
- //IAU 1980 nutation theory:
231
-
232
- //Mean anomaly of the moon
233
- var Mm = 134.962981389+198.867398056*TE+trunc(477000*TE)+0.008697222222*TE2+TE3/56250;
234
-
235
- //Mean anomaly of the sun
236
- var M = 357.527723333+359.05034*TE+trunc(35640*TE)-0.0001602777778*TE2-TE3/300000;
237
-
238
- //Mean distance of the moon from the ascending node
239
- var F = 93.271910277+82.017538055*TE+trunc(483120*TE)-0.0036825*TE2+TE3/327272.7273;
240
-
241
- //Mean elongation of the moon
242
- var D = 297.850363055+307.11148*TE+trunc(444960*TE)-0.001914166667*TE2+TE3/189473.6842;
243
-
244
- //Longitude of the ascending node of the moon
245
- var omega = 125.044522222-134.136260833*TE-trunc(1800*TE)+0.002070833333*TE2+TE3/450000;
246
-
247
- //Periodic terms for nutation
248
- var nut = new Array(106);
249
- nut[0] = " 0 0 0 0 1-171996-174.2 92025 8.9 ";
250
- nut[1] = " 0 0 2-2 2 -13187 -1.6 5736-3.1 ";
251
- nut[2] = " 0 0 2 0 2 -2274 -0.2 977-0.5 ";
252
- nut[3] = " 0 0 0 0 2 2062 0.2 -895 0.5 ";
253
- nut[4] = " 0-1 0 0 0 -1426 3.4 54-0.1 ";
254
- nut[5] = " 1 0 0 0 0 712 0.1 -7 0.0 ";
255
- nut[6] = " 0 1 2-2 2 -517 1.2 224-0.6 ";
256
- nut[7] = " 0 0 2 0 1 -386 -0.4 200 0.0 ";
257
- nut[8] = " 1 0 2 0 2 -301 0.0 129-0.1 ";
258
- nut[9] = " 0-1 2-2 2 217 -0.5 -95 0.3 ";
259
- nut[10] = "-1 0 0 2 0 158 0.0 -1 0.0 ";
260
- nut[11] = " 0 0 2-2 1 129 0.1 -70 0.0 ";
261
- nut[12] = "-1 0 2 0 2 123 0.0 -53 0.0 ";
262
- nut[13] = " 1 0 0 0 1 63 0.1 -33 0.0 ";
263
- nut[14] = " 0 0 0 2 0 63 0.0 -2 0.0 ";
264
- nut[15] = "-1 0 2 2 2 -59 0.0 26 0.0 ";
265
- nut[16] = "-1 0 0 0 1 -58 -0.1 32 0.0 ";
266
- nut[17] = " 1 0 2 0 1 -51 0.0 27 0.0 ";
267
- nut[18] = "-2 0 0 2 0 -48 0.0 1 0.0 ";
268
- nut[19] = "-2 0 2 0 1 46 0.0 -24 0.0 ";
269
- nut[20] = " 0 0 2 2 2 -38 0.0 16 0.0 ";
270
- nut[21] = " 2 0 2 0 2 -31 0.0 13 0.0 ";
271
- nut[22] = " 2 0 0 0 0 29 0.0 -1 0.0 ";
272
- nut[23] = " 1 0 2-2 2 29 0.0 -12 0.0 ";
273
- nut[24] = " 0 0 2 0 0 26 0.0 -1 0.0 ";
274
- nut[25] = " 0 0 2-2 0 -22 0.0 0 0.0 ";
275
- nut[26] = "-1 0 2 0 1 21 0.0 -10 0.0 ";
276
- nut[27] = " 0 2 0 0 0 17 -0.1 0 0.0 ";
277
- nut[28] = " 0 2 2-2 2 -16 0.1 7 0.0 ";
278
- nut[29] = "-1 0 0 2 1 16 0.0 -8 0.0 ";
279
- nut[30] = " 0 1 0 0 1 -15 0.0 9 0.0 ";
280
- nut[31] = " 1 0 0-2 1 -13 0.0 7 0.0 ";
281
- nut[32] = " 0-1 0 0 1 -12 0.0 6 0.0 ";
282
- nut[33] = " 2 0-2 0 0 11 0.0 0 0.0 ";
283
- nut[34] = "-1 0 2 2 1 -10 0.0 5 0.0 ";
284
- nut[35] = " 1 0 2 2 2 -8 0.0 3 0.0 ";
285
- nut[36] = " 0-1 2 0 2 -7 0.0 3 0.0 ";
286
- nut[37] = " 0 0 2 2 1 -7 0.0 3 0.0 ";
287
- nut[38] = " 1 1 0-2 0 -7 0.0 0 0.0 ";
288
- nut[39] = " 0 1 2 0 2 7 0.0 -3 0.0 ";
289
- nut[40] = "-2 0 0 2 1 -6 0.0 3 0.0 ";
290
- nut[41] = " 0 0 0 2 1 -6 0.0 3 0.0 ";
291
- nut[42] = " 2 0 2-2 2 6 0.0 -3 0.0 ";
292
- nut[43] = " 1 0 0 2 0 6 0.0 0 0.0 ";
293
- nut[44] = " 1 0 2-2 1 6 0.0 -3 0.0 ";
294
- nut[45] = " 0 0 0-2 1 -5 0.0 3 0.0 ";
295
- nut[46] = " 0-1 2-2 1 -5 0.0 3 0.0 ";
296
- nut[47] = " 2 0 2 0 1 -5 0.0 3 0.0 ";
297
- nut[48] = " 1-1 0 0 0 5 0.0 0 0.0 ";
298
- nut[49] = " 1 0 0-1 0 -4 0.0 0 0.0 ";
299
- nut[50] = " 0 0 0 1 0 -4 0.0 0 0.0 ";
300
- nut[51] = " 0 1 0-2 0 -4 0.0 0 0.0 ";
301
- nut[52] = " 1 0-2 0 0 4 0.0 0 0.0 ";
302
- nut[53] = " 2 0 0-2 1 4 0.0 -2 0.0 ";
303
- nut[54] = " 0 1 2-2 1 4 0.0 -2 0.0 ";
304
- nut[55] = " 1 1 0 0 0 -3 0.0 0 0.0 ";
305
- nut[56] = " 1-1 0-1 0 -3 0.0 0 0.0 ";
306
- nut[57] = "-1-1 2 2 2 -3 0.0 1 0.0 ";
307
- nut[58] = " 0-1 2 2 2 -3 0.0 1 0.0 ";
308
- nut[59] = " 1-1 2 0 2 -3 0.0 1 0.0 ";
309
- nut[60] = " 3 0 2 0 2 -3 0.0 1 0.0 ";
310
- nut[61] = "-2 0 2 0 2 -3 0.0 1 0.0 ";
311
- nut[62] = " 1 0 2 0 0 3 0.0 0 0.0 ";
312
- nut[63] = "-1 0 2 4 2 -2 0.0 1 0.0 ";
313
- nut[64] = " 1 0 0 0 2 -2 0.0 1 0.0 ";
314
- nut[65] = "-1 0 2-2 1 -2 0.0 1 0.0 ";
315
- nut[66] = " 0-2 2-2 1 -2 0.0 1 0.0 ";
316
- nut[67] = "-2 0 0 0 1 -2 0.0 1 0.0 ";
317
- nut[68] = " 2 0 0 0 1 2 0.0 -1 0.0 ";
318
- nut[69] = " 3 0 0 0 0 2 0.0 0 0.0 ";
319
- nut[70] = " 1 1 2 0 2 2 0.0 -1 0.0 ";
320
- nut[71] = " 0 0 2 1 2 2 0.0 -1 0.0 ";
321
- nut[72] = " 1 0 0 2 1 -1 0.0 0 0.0 ";
322
- nut[73] = " 1 0 2 2 1 -1 0.0 1 0.0 ";
323
- nut[74] = " 1 1 0-2 1 -1 0.0 0 0.0 ";
324
- nut[75] = " 0 1 0 2 0 -1 0.0 0 0.0 ";
325
- nut[76] = " 0 1 2-2 0 -1 0.0 0 0.0 ";
326
- nut[77] = " 0 1-2 2 0 -1 0.0 0 0.0 ";
327
- nut[78] = " 1 0-2 2 0 -1 0.0 0 0.0 ";
328
- nut[79] = " 1 0-2-2 0 -1 0.0 0 0.0 ";
329
- nut[80] = " 1 0 2-2 0 -1 0.0 0 0.0 ";
330
- nut[81] = " 1 0 0-4 0 -1 0.0 0 0.0 ";
331
- nut[82] = " 2 0 0-4 0 -1 0.0 0 0.0 ";
332
- nut[83] = " 0 0 2 4 2 -1 0.0 0 0.0 ";
333
- nut[84] = " 0 0 2-1 2 -1 0.0 0 0.0 ";
334
- nut[85] = "-2 0 2 4 2 -1 0.0 1 0.0 ";
335
- nut[86] = " 2 0 2 2 2 -1 0.0 0 0.0 ";
336
- nut[87] = " 0-1 2 0 1 -1 0.0 0 0.0 ";
337
- nut[88] = " 0 0-2 0 1 -1 0.0 0 0.0 ";
338
- nut[89] = " 0 0 4-2 2 1 0.0 0 0.0 ";
339
- nut[90] = " 0 1 0 0 2 1 0.0 0 0.0 ";
340
- nut[91] = " 1 1 2-2 2 1 0.0 -1 0.0 ";
341
- nut[92] = " 3 0 2-2 2 1 0.0 0 0.0 ";
342
- nut[93] = "-2 0 2 2 2 1 0.0 -1 0.0 ";
343
- nut[94] = "-1 0 0 0 2 1 0.0 -1 0.0 ";
344
- nut[95] = " 0 0-2 2 1 1 0.0 0 0.0 ";
345
- nut[96] = " 0 1 2 0 1 1 0.0 0 0.0 ";
346
- nut[97] = "-1 0 4 0 2 1 0.0 0 0.0 ";
347
- nut[98] = " 2 1 0-2 0 1 0.0 0 0.0 ";
348
- nut[99] = " 2 0 0 2 0 1 0.0 0 0.0 ";
349
- nut[100]= " 2 0 2-2 1 1 0.0 -1 0.0 ";
350
- nut[101]= " 2 0-2 0 1 1 0.0 0 0.0 ";
351
- nut[102]= " 1-1 0-2 0 1 0.0 0 0.0 ";
352
- nut[103]= "-1 0 0 1 1 1 0.0 0 0.0 ";
353
- nut[104]= "-1-1 0 2 1 1 0.0 0 0.0 ";
354
- nut[105]= " 0 1 0 1 0 1 0.0 0 0.0 ";
355
-
356
- //Reading periodic terms
357
- var fMm, fM, fF, fD, f_omega, dp=0, de=0;
358
-
359
- for (x=0; x<105; x++)
360
- {
361
- fMm = eval(nut[x].substring(0,2));
362
- fM = eval(nut[x].substring(2,4));
363
- fF = eval(nut[x].substring(4,6));
364
- fD = eval(nut[x].substring(6,8));
365
- f_omega = eval(nut[x].substring(8,10));
366
- dp += (eval(nut[x].substring(10,17))+TE*eval(nut[x].substring(17,23)))*sind(fD*D+fM*M+fMm*Mm+fF*F+f_omega*omega);
367
- de += (eval(nut[x].substring(23,29))+TE*eval(nut[x].substring(29,33)))*cosd(fD*D+fM*M+fMm*Mm+fF*F+f_omega*omega);
368
- }
369
-
370
- //Corrections (Herring, 1987)
371
- /*
372
- var corr = new Array(4);
373
- corr[0] = " 0 0 0 0 1-725 417 213 224 ";
374
- corr[1] = " 0 1 0 0 0 523 61 208 -24 ";
375
- corr[2] = " 0 0 2-2 2 102-118 -41 -47 ";
376
- corr[3] = " 0 0 2 0 2 -81 0 32 0 ";
377
-
378
- for (x=0; x<4; x++)
379
- {
380
- fMm = eval(corr[x].substring(0,2));
381
- fM = eval(corr[x].substring(2,4));
382
- fF = eval(corr[x].substring(4,6));
383
- fD = eval(corr[x].substring(6,8));
384
- f_omega = eval(corr[x].substring(8,10));
385
- dp += 0.1*(eval(corr[x].substring(10,14))*sind(fD*D+fM*M+fMm*Mm+fF*F+f_omega*omega)+eval(corr[x].substring(14,18))*cosd(fD*D+fM*M+fMm*Mm+fF*F+f_omega*omega));
386
- de += 0.1*(eval(corr[x].substring(18,22))*cosd(fD*D+fM*M+fMm*Mm+fF*F+f_omega*omega)+eval(corr[x].substring(22,26))*sind(fD*D+fM*M+fMm*Mm+fF*F+f_omega*omega));
387
- }
388
- */
389
-
390
- //Nutation in longitude
391
- delta_psi = dp/36000000;
392
-
393
- //Nutation in obliquity
394
- delta_eps = de/36000000;
395
-
396
- //Mean obliquity of the ecliptic
397
- eps0 = (84381.448-46.815*TE-0.00059*TE2+0.001813*TE3)/3600;
398
-
399
- //True obliquity of the ecliptic
400
- eps = eps0+delta_eps;
401
- }
402
-
403
- //Equation of the equinoxes
404
- EoE = 240*delta_psi*cosd(eps);
405
-
406
- =end
@@ -1,24 +0,0 @@
1
- # input_suntimes.rb
2
-
3
- begin
4
- require 'eot'
5
- rescue LoadError
6
- lib = File.expand_path('../../lib', __FILE__)
7
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
8
- require 'eot'
9
- end
10
-
11
- eot = Eot.new
12
-
13
- @date = Date.today.to_s
14
- @zone = -5
15
- puts @date
16
- eot.date = @date
17
- geo = GeoLatLng.new
18
- # note: you will need internet access to get the coordinates next
19
- geo.addr = "8000 South Michigan Ave., Chicago, IL"
20
- geo.get_coordinates_from_address
21
- eot.longitude = geo.lng.to_f
22
- eot.latitude = geo.lat.to_f
23
- puts "Sunrise #{eot.sunrise_dt().to_time}"
24
- puts "Sunset #{eot.sunset_dt().to_time}"
@@ -1,29 +0,0 @@
1
- # julian_day_formula.rb
2
-
3
- # 3) Dropping the fractional part of all results of all multiplications and divisions, let
4
- require 'date'
5
-
6
- def date_to_ajd date
7
- year = date.year
8
- month = date.month
9
-
10
- if month <= 2
11
- year = year -1
12
- month = month +12
13
- end
14
-
15
- day = date.day
16
-
17
- a = (year / 100).floor
18
- b = (a / 4).floor
19
- c = 2 - a + b
20
- e = (365.25 * (year + 4716)).floor
21
- f = (30.6001 * (month +1)).floor
22
- c + day + e + f - 1524.5
23
- end
24
-
25
- t = Time.now.utc
26
- date_string = "#{t.year}-#{t.month}-#{t.day}"
27
- date = Date.parse(date_string)
28
- puts t
29
- puts "Todays date is #{date} and the AJD is #{date_to_ajd date}"
@@ -1,12 +0,0 @@
1
- def date_to_jd date
2
-
3
- # 3) Dropping the fractional part of all results of all multiplications and divisions,
4
- # let
5
- a = year/100
6
- b = a/4
7
- c = 2-a+b
8
- e = 365.25 * (year + 4716)
9
- f = 30.6001 * (m +1)
10
- c + d + e + f - 1524.5
11
- end
12
-
@@ -1,21 +0,0 @@
1
- # my_time_conversion.rb
2
-
3
- # This method will convert hours decimal into a Time object and let you see H:M:S format
4
- def decimal_to_strf(time_in)
5
- t = Time.now
6
- year = t.year
7
- month = t.month
8
- day = t.day
9
- hours = Integer(time_in)
10
- decimal_minutes = (time_in - hours) * 60.0
11
- minutes = Integer(decimal_minutes)
12
- decimal_seconds = (decimal_minutes - minutes) * 60.0
13
- seconds = Integer(decimal_seconds)
14
- my_time = Time.new(year, month, day, hours, minutes, seconds, "-05:00")
15
- my_time.strftime("%H:%M:%S")
16
- end
17
-
18
- decimal_hours = 4.64
19
- puts
20
- puts "#{decimal_hours} = #{decimal_to_strf(decimal_hours)}"
21
- puts