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/examples/ptime.rb DELETED
@@ -1,162 +0,0 @@
1
- require 'date'
2
- require 'bigdecimal'
3
- include Math
4
-
5
-
6
- def degrees_to_radians(degrees)
7
- bd(degrees * PI / 180.0)
8
- end
9
-
10
- def radians_to_degrees(radians)
11
- bd(radians * 180.0 / PI)
12
- end
13
-
14
- # Truncate large angles
15
- def truncate(x)
16
- bd(360.0 * ( x / 360.0 - Integer( x / 360.0)))
17
- end
18
-
19
- def bd(var)
20
- BigDecimal(var.to_s).round(16)# * 1.0
21
- end
22
-
23
- def calc_time_julian_century(t)
24
- # Julian Day Number j(2000) subtracted
25
- (t - 2451545.0)/36525.0
26
- # Time in fractional centurey
27
- end
28
-
29
- def calc_eccentricity_earth_orbit(t)
30
- 0.016708617 - t * (0.000042037 + 0.0000001235 * t)#unitless
31
- #~ puts "EccentricityEarthOrbit = #{eccentricity}"
32
- end
33
-
34
- def mean_anomaly(t)
35
- (357.527723333 + truncate(35640.0 * t) \
36
- + t * (359.05034 - t * (0.0001602777778 \
37
- + t / 300000.0))) % 360.0
38
- #~ t2 = t **2
39
- #~ t3 = t **3
40
- #~ t4 = t **4
41
- #~ @mean_anomaly = 1287104.79305 + 129596581.0481 * t - 0.5532 * t2 + 0.000136 * t3 - 0.00001149 * t4
42
- #~ @mean_anomaly = 357.527723333 + 359.05034 * t + trunc(35640.0 * t) - 0.0001602777778 * t2 - t3/300000.0
43
- #~ @mean_anomaly = 357.52910 + t * 35999.05034 - t2 * 0.0001559 - t3 * 0.00000048
44
- #~ puts "GeomMeanAnomalySun = #{mean_anomaly%360}"
45
- #~ return mean_anomaly % 360 # in degrees
46
- end
47
-
48
- def calc_geom_mean_long_sun(t)
49
- #~ //Mean longitude of the sun
50
- t2 = t * t
51
- t3 = t2 * t
52
- t4 = t3 * t
53
- t5 = t4 * t
54
- truncate(280.4664567 + t * 36000.76982779 \
55
- + t2 * 0.0003032028 + t3/49931.0 \
56
- - t4/15299.0 - t5/1988000.0)
57
- end
58
-
59
- def sun_eq_of_center(t)
60
- #t2 = t **2
61
- mean_anomaly = mean_anomaly(t)
62
- #~ puts "GeomMeanAnomalySun = #{m}"
63
- marad = degrees_to_radians(mean_anomaly)
64
- sinmarad = sin(marad)
65
- eccentricity = calc_eccentricity_earth_orbit(t)
66
- sin2marad = sin(2.0 * marad)
67
- sin3marad = sin(3.0 * marad)
68
- sinmarad * (1.914602 - t * (0.004817 + 0.000014 * t))\
69
- + sin2marad * (0.019993 - 0.000101 * t)\
70
- + sin3marad * 0.000289
71
- end
72
-
73
- def true_anomaly(t)
74
- mean_anomaly = mean_anomaly(t)
75
- eqc = sun_eq_of_center(t)
76
- bd(mean_anomaly + eqc) * 1.0
77
- end
78
-
79
- def calc_sun_true_long(t)
80
- mean_lon = calc_geom_mean_long_sun(t)
81
- eqc = sun_eq_of_center(t)
82
- mean_lon + eqc - 0.01397 * (Time.now.year - 2000)
83
- end
84
-
85
- def mean_obliquity_of_ecliptic(t)
86
- bd(23.4392911111 - t * (0.0130041666667 + t * (1.63888888889e-07 - (5.03611111111e-07 * t)))) * 1.0
87
- end
88
-
89
- def omega(t)
90
- bd(125.04455501 - truncate(1800.0 * t) \
91
- - t * (134.136261972 \
92
- - t * (0.00207561111111 \
93
- + t * (2.13944444444e-06 \
94
- - t * 1.64972222222e-08 \
95
- )))) * 1.0
96
- bd(125.04455501 - truncate(1800.0 * t) \
97
- - t * 134.136261972 \
98
- + t * t * 0.00207561111111 \
99
- + t * t * t * 2.13944444444e-06 \
100
- - t * t * t * t * 1.64972222222e-08 \
101
- ) * 1.0
102
- end
103
-
104
- def obliquity_correction(t)
105
- eps0 = mean_obliquity_of_ecliptic(t)
106
- omega = omega(t)
107
- delta_eps = bd(0.00256 * cos(degrees_to_radians(omega)))
108
- bd(eps0 + delta_eps)
109
- end
110
-
111
- def sun_right_ascension(t)
112
- lambda = calc_sun_true_long(t)
113
- epsilon = obliquity_correction(t)
114
- y0 = bd(sin(degrees_to_radians(lambda)))
115
- x0 = bd(cos(degrees_to_radians(lambda)))
116
- y0 = bd(y0 * cos(degrees_to_radians(epsilon)))
117
- bd(radians_to_degrees(atan2(-y0, -x0)) + 180.0) * 1.0
118
- end
119
-
120
- def mean_long_aries(t)
121
- d = bd(t * 36525.0)
122
- bd(truncate(280.46061666 + d * 360.98564736629\
123
- + t * (t * 0.000387933\
124
- - t * (t / 38710000.0)))) * 1.0
125
- end
126
-
127
- pdate = Date.new(2014, 1, 3)
128
- pd = pdate.ajd * 1.0
129
- #puts pd
130
- daysecs = 2 * 84600.0
131
-
132
- for seconds in 1..daysecs
133
- #puts seconds / 84600.0
134
- jdt = calc_time_julian_century(pd + seconds / 84600.0)
135
- mas = bd(mean_anomaly(jdt)).round(3) * 1.0
136
- #puts mas
137
- tas = bd(true_anomaly(jdt)).round(3) * 1.0
138
- #puts tas
139
- if (mas + tas) == 720
140
- d = pd + seconds / 84600.0
141
- #puts d
142
- pt = jdt % 1.0
143
- break
144
- #~ else
145
- #~ d = 0
146
- #~ pt = 0
147
- end
148
- end
149
-
150
- #~ puts d
151
- #~ puts pt
152
- puts "2014 perihelion occurred at #{d}"
153
- tls = calc_sun_true_long(pt)
154
- puts "lambda perihelion = #{tls}"
155
- sra = sun_right_ascension(pt)
156
- puts "Right ascesion = #{sra}"
157
- ma = mean_long_aries(pt)
158
- puts "GHA Aries = #{ma}"
159
-
160
-
161
-
162
-
data/examples/suntimes.rb DELETED
@@ -1,30 +0,0 @@
1
- # 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
- # Change these for your geo location
13
- @latitude = 41.9474 # + in Northern Hemishere, - in Southern Hemisphere
14
- @longitude = -88.74467 # + East of zulu time zone, - West of zulu time zone
15
- @zone = -5 # Time offset for zone.
16
-
17
-
18
- eot.longitude= @longitude
19
- eot.latitude= @latitude
20
- puts
21
- @date = Date.today
22
- # get the times for a few more days.
23
- for i in 0..10
24
-
25
- eot.ajd = (@date.jd + i)
26
-
27
- puts "Sunrise #{(eot.sunrise_dt().to_time).strftime("%c")}"
28
- puts "Sunset #{(eot.sunset_dt().to_time).strftime("%c")}"
29
- puts
30
- end
@@ -1,50 +0,0 @@
1
- # suntimes_test.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
- # Change these for your geographic location Ex: of mine.
14
- # Note the two coordinate parameters must be passed as floats.
15
- # All parameters may be passed at any time.
16
- # eot.date = @date
17
- # eot.longitude = @longitude
18
- # eot.latitude = @latitude
19
- @latitude = 0.0 # sign in Northern Hemishere is none, - (minus)for Southern Hemisphere
20
- @longitude = 0.0 # East of UTC is none, - (minus)West of UTC
21
- @date = "2000-01-01"
22
- eot.jd = Date.parse(@date).jd
23
-
24
- print "Enter your longitude in decimal format Ex: -125.099 \n"
25
-
26
- lng = gets
27
-
28
- lng.nil? ? eot.longitude = @longitude : eot.longitude = lng.chomp.to_f
29
-
30
- puts "Your longitude is #{eot.longitude}"
31
-
32
- print "Enter your latitude in decimal format Ex: 39.3339 \n"
33
-
34
- lat = gets
35
-
36
- lat.nil? ? eot.latitude = @latitude : eot.latitude = lat.chomp.to_f
37
-
38
- puts "Your latitude is #{eot.latitude}"
39
-
40
- print "Enter the date you want to compute sun times for Ex: yyyy-mm-dd \n"
41
-
42
- date = gets
43
-
44
- date.nil? ? eot.date = @date : eot.date = date.chomp.to_f
45
-
46
- puts "The date is #{eot.date}"
47
-
48
- puts "Sunrise #{eot.sunrise_dt.to_time}"
49
- puts "Sunset #{eot.sunset_dt.to_time}"
50
-