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,51 +0,0 @@
1
- #require_relative 'celes_core'
2
- require 'celes'
3
-
4
- begin
5
- require 'eot'
6
- rescue LoadError
7
- lib = File.expand_path('../../lib', __FILE__)
8
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
9
- require 'eot'
10
- end
11
-
12
- eot = Eot.new
13
-
14
- # Celes.methods.sort.each {|m| p m }
15
-
16
- dt = DateTime.now.to_time.utc.to_datetime
17
- jd = Celes.cal2jd(dt.year, dt.month, dt.day)
18
-
19
- ajd = jd[0] + jd[1] + dt.day_fraction
20
-
21
- p eot.ajd = ajd
22
-
23
- p eot.delta_equinox()[0]
24
- p Celes.nut06a(ajd,0)[0]
25
-
26
- p eot.delta_equinox()[1]
27
- p Celes.nut06a(ajd,0)[1]
28
-
29
- p eot.delta_equinox()[2]
30
- p Celes.falp03(eot.ta)
31
-
32
- p eot.delta_equinox()[3]
33
- p Celes.faom03(eot.ta)
34
-
35
- require 'benchmark'
36
-
37
- n = 5_000
38
- Benchmark.bm do |x|
39
- #~ x.report("celes") { n.times { Celes.cal2jd(dt.year, dt.month, dt.day) } }
40
- #~ x.report("ruby") { n.times { DateTime.new(dt.year, dt.month, dt.day).jd } }
41
- x.report("celes") { n.times { Celes.nut06a(ajd,0)[0] }}
42
- x.report("celes") { n.times { Celes.nut06a(ajd,0)[1] }}
43
- x.report("celes") { n.times { Celes.falp03(eot.ta) }}
44
- x.report("celes") { n.times { Celes.faom03(eot.ta) }}
45
-
46
- x.report("ruby") { n.times { eot.delta_equinox()[0] }}
47
- x.report("ruby") { n.times { eot.delta_equinox()[1] }}
48
- x.report("ruby") { n.times { eot.delta_equinox()[2] }}
49
- x.report("ruby") { n.times { eot.delta_equinox()[3] }}
50
- end
51
-
@@ -1,55 +0,0 @@
1
- require 'benchmark'
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
- require 'eot'
12
-
13
- eot = Eot.new
14
- eot.ajd = DateTime.now.to_time.utc.to_datetime.ajd
15
- eot.ajd_to_datetime(eot.ajd)
16
-
17
- p eot.eccentricity_Earth()
18
- p eot.eoe(eot.ta)
19
-
20
- n = 500_000
21
- Benchmark.bm do |x|
22
- x.report("reot") { n.times {eot.eccentricity_Earth()} }
23
- x.report("ceot") { n.times {eot.eoe(eot.ta)} }
24
- end
25
- puts
26
-
27
- p eot.center() * Eot::R2D
28
- p eot.eqc(eot.ma, eot.ta) * Eot::R2D
29
-
30
- Benchmark.bm do |x|
31
- x.report("reot") {n.times {eot.center()}}
32
- x.report("ceot") {n.times {eot.eqc(eot.ma, eot.ta)}}
33
- end
34
- puts
35
-
36
- p eot.tl_Sun()
37
- p eot.tl(eot.ma, eot.ta)
38
-
39
- n = 500_000
40
- Benchmark.bm do |x|
41
- x.report("reot") { n.times {eot.tl_Sun()} }
42
- x.report("ceot") { n.times {eot.tl(eot.ma, eot.ta)} }
43
- end
44
- puts
45
-
46
- p eot.al_Sun()
47
- p eot.al(eot.ma, eot.ta, eot.omega())
48
-
49
- n = 500_000
50
- Benchmark.bm do |x|
51
- x.report("reot") { n.times {eot.al_Sun()} }
52
- x.report("ceot") { n.times {eot.al(eot.ma, eot.ta, eot.omega())} }
53
- end
54
- puts
55
-
@@ -1,32 +0,0 @@
1
- # test_poly_eval.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
- # From astro-algo gem
12
- # class Array
13
- # Evaluate polynomial using Horner's method.
14
- # Array consists of coefficients of a polynomial, the
15
- # coefficient of the highest order term first, the
16
- # constant coefficient last.
17
- # Returns evaluation of polynomial at +x+.
18
- #
19
- # Example: evaluate the polynomial x**2 - 0.5*x + 3.0 where x = 2.0
20
- # [1.0, -0.5, 3.0].poly_eval(2.0) # => 6.0
21
- # def poly_eval(x)
22
- # self.inject(0.0) {|p, a|
23
- # p*x + a}
24
- # end
25
- # end
26
-
27
- my_array = [1.0, -0.5, 3.0]
28
- my_array.inject(0.0) {|sum, n| p sum * 2.0 + n }
29
-
30
- ecc = [-0.0000001235, -0.000042037, 0.016708617]
31
- ta = 0.14
32
- ecc.inject(0.0) {|sum, n| p sum * ta + n }
@@ -1,29 +0,0 @@
1
- # eot_methods_list.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
- $DEBUG and set_trace_func proc { |event, file, line, id, binding, classname|
11
- printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname
12
- }
13
- eot = Eot.new
14
- # puts eot.public_methods(false).sort
15
- # puts eot.nil?
16
- loop do
17
- puts DateTime.now.to_time.utc.nsec.inspect
18
- puts DateTime.jd(DateTime.now.to_time.utc.to_datetime.ajd + 0.5).to_time.nsec.inspect
19
- sleep 0.7
20
- puts
21
- end
22
-
23
- # puts Astro.solar_longitude(date)
24
- # tjc = eot.time_julian_century( ajd)
25
- # puts eot.tl_Sun(tjc)
26
-
27
- # tjc = eot.time_julian_century( ajd + dt )
28
- # puts eot.tl_Sun(tjc)
29
-
@@ -1,53 +0,0 @@
1
- # a list of sunrise and sunset times for a year of dates.
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
- require 'safe_yaml'
11
- require 'time'
12
-
13
- eot = Eot.new
14
-
15
- # set your latitude and longitude first.
16
- eot.latitude = 41.9474
17
- eot.longitude = -88.74467
18
-
19
- # make some start and finish dates.
20
- start = "2014-1-1"
21
- finish = "2014-12-31"
22
-
23
- start_time = Time.utc( 2014, "jan", 1, 12, 0, 0 )
24
- finish_time = Time.utc( 2014, "dec", 31, 12, 0, 0 )
25
-
26
- start_jd = Date.parse(start).jd
27
- finish_jd = Date.parse(finish).jd
28
-
29
- fstr = "%b %d"
30
-
31
- @data, @group, @group_id = [], {}, 1
32
-
33
- (start_jd..finish_jd).each do |jd|
34
- # date = DateTime.jd(jd + 0.5).to_date
35
- eot.ajd = jd
36
- rise = eot.sunrise_dt().to_time.to_json
37
- trans = eot.local_noon_dt().to_time.to_json
38
- set = eot.sunset_dt().to_time.to_json
39
- @group = { "id" => @group_id,
40
- "rise" => rise,
41
- "noon" => trans,
42
- "sset" => set
43
- }
44
- @data << @group
45
- @group_id += 1
46
- end
47
-
48
- file_path = "rise_set_data.yml"
49
- File::open( file_path, "w" ) do |f|
50
- YAML.dump( @data, f )
51
- end
52
-
53
- puts "File rise_set_data.yml processed"
@@ -1,26 +0,0 @@
1
- # usage_example.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
- # find what the defaults are set to
13
- show = <<RAN
14
- ajd = #{eot.ajd}
15
- date = #{eot.date}
16
- jd = #{eot.jd}
17
- longitude = #{eot.longitude}
18
- latitude = #{eot.latitude}
19
- sunrise = #{eot.sunrise_dt}
20
- trnasit = #{eot.local_noon_dt}
21
- min eot = #{eot.time_eot}
22
- sunset = #{eot.sunset_dt}
23
- gasa = #{eot.tl_Aries}
24
- RAN
25
-
26
- puts show
@@ -1,222 +0,0 @@
1
- # use_angles.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
-
12
- file = <<DISPLAY
13
-
14
- This will explain how the equation of time is derived by showing each method that comprises the formula.
15
-
16
- eot = Eot.new
17
-
18
- Instance of Eot class eot = #{eot = Eot.new}
19
-
20
-
21
- Set the class attribute ajd for the deisired date ex : eot.ajd = Date.parse("yyyy, mm, dd").jd.to_f
22
-
23
- eot.ajd = Date.today.jd.to_f
24
-
25
- eot.ajd = #{eot.ajd = Date.today.jd.to_f}
26
-
27
- The class attribute ajd has been set to a nice whole number even though it is a Float class now.
28
-
29
- The Astronomical Julian Day Number is a half day less than Julian Day Number with the fractional day time included when we DateTime class.
30
-
31
- DateTime.now.day_fraction.to_f = #{DateTime.now.day_fraction.to_f}
32
-
33
- DateTime class has the method day_fraction and Date class does not.
34
-
35
- We used Date class which doesn't give us the UTC time of date. It yields your time zone date.
36
-
37
- Let's just prove this.
38
-
39
- Date.today.to_time.utc = #{Date.today.to_time.utc}
40
-
41
- It looks like that was your midnight in UTC time.
42
-
43
- Maybe we could get away with getting the ajd from that.
44
-
45
- Date.today.to_time.utc.to_date.ajd.to_f = #{Date.today.to_time.utc.to_date.ajd.to_f}
46
-
47
- No. That's a half day less than the Julian Day Number.
48
-
49
- So let's start over setting the adj correctly for UTC using the DateTime class.
50
-
51
- eot.ajd = DateTime.now.to_time.utc.to_datetime.ajd.to_f
52
-
53
- eot.ajd = #{eot.ajd = DateTime.now.to_time.utc.to_datetime.ajd.to_f}
54
-
55
-
56
- Because this gem is going to calculate the sunrise and sunset times it's okay to set the day for noon and is encouraged.
57
-
58
- So go ahead and set the ajd using the Date class and jd method as was first done.
59
-
60
- The class init.rb sets everything to defaults and one of them is today's datetime.jd
61
-
62
- But for right now we won't do that so we get current angles of the present time UTC.
63
-
64
-
65
-
66
- eot.ma is the solar Mean anomaly mu(M) and is called quite often hence the attribute.
67
-
68
- eot.ma was set using eot.ma_Sun() method.
69
-
70
- It is an angle with respect to perihelion of Earth orbit around Sun in an assumed circular orbit.
71
-
72
- M is calculated within the nutation.rb file under delta_equinox() method and returned as the third element of an array.
73
-
74
- eot.ma = #{eot.ma}
75
-
76
- eot.ma_Sun() = #{eot.ma_Sun()}
77
-
78
-
79
- angle one = eot.ma_Sun() - eot.ta_Sun()
80
-
81
- a1 = #{eot.ma_Sun() - eot.ta_Sun()} degrees
82
-
83
- a1 is a delta angle difference for mean and true anomalies in degrees.
84
-
85
- True anomaly (nu) is the actual angle with respect to perihelion in an eliptical orbit.
86
-
87
- It was calculated by using the equation of center formula which you may access also.
88
-
89
- eot.center() = #{eot.center()} degrees.
90
-
91
- nu = equation of center + M or mu or mean anomaly
92
-
93
- The delta is M - nu.
94
-
95
-
96
- The method inside the gem is called delta_orbit()
97
-
98
- eot.delta_orbit = #{eot.delta_orbit} degrees
99
-
100
- We could just change the sign of eot.center().
101
-
102
- In fact let's just do that now. a1 = - eot.center()
103
-
104
- - eot.center() = #{- eot.center()}
105
-
106
-
107
- The next delta is calculated as follows.
108
-
109
- lambda or apparent longitude of the Sun minus alpha or right ascension of the Sun.
110
-
111
- a2 = lambda - alpha
112
-
113
- lambda = mean longitude + equation of center
114
-
115
- eot.gml_Sun() + eot.center() = #{eot.gml_Sun() + eot.center()} or
116
-
117
- eot.tl_Sun = #{eot.tl_Sun}
118
-
119
- Lambda is the \"ecliptic coordinate system\" angle of the sun.
120
-
121
- Alpha is the Right Ascension of the sun in the celestial coordinate system.
122
-
123
- alpha = eot.ra_Sun()
124
-
125
- alpha = #{eot.ra_Sun()}
126
-
127
- lambda - alpha = #{eot.tl_Sun - eot.ra_Sun()}
128
-
129
- The method inside the gem is called delta_oblique.
130
-
131
- eot.delta_oblique() = #{eot.delta_oblique()}
132
-
133
-
134
- The sum of these two delta angles is the equation of time angle in degrees not time.
135
-
136
- eot.eot() = #{eot.eot()}
137
-
138
- That was for the time UTC now which was easy.
139
-
140
-
141
- Now using your longitude to compute your mean solar transit from longitude / 15.0
142
-
143
- my longitude is -88.74467 deg. so I'll set the longitude attribute in Eot class.
144
-
145
- eot.longitude = #{eot.longitude = -88.74467}
146
-
147
-
148
- So my mean solar transit UTC is 12.0 - my_longitude / 15.0
149
-
150
- my_mean_noon = #{12.0 - -88.74467 / 15.0} hr.
151
-
152
- Be sure to set everything for UTC noon before adding it to your longitude because we were doing angles for time now.
153
-
154
- eot.ajd = #{eot.ajd = Date.today.jd.to_f}
155
-
156
-
157
-
158
- Using the Eot class I may also compute it with eot.mean_local_noon_dt() method if I have the ajd set right.
159
-
160
- eot.mean_local_noon_dt() = #{eot.mean_local_noon_dt()}
161
-
162
- I'm showing what time mean noon for my_longitude normally is without the equation of time considered.
163
-
164
- This time is true only four days a year. Lets get the right one for today to be sure.
165
-
166
-
167
-
168
- We can add longitude plus equation of time as angles.
169
-
170
- eot.longitude + eot.eot() = #{eot.longitude} + #{eot.eot()}
171
-
172
- What's the time of solar transit here now?
173
-
174
- 12.0 - (eot.longitude + eot.eot()) / 15.0 = #{12.0 - (eot.longitude + eot.eot()) / 15.0}
175
-
176
- That looks about right.
177
-
178
-
179
-
180
- Let's make a time out of that by converting it to a fractional day.
181
-
182
- (12.0 - (eot.longitude + eot.eot()) / 15.0) / 24.0 = #{(12.0 - (eot.longitude + eot.eot()) / 15.0) / 24.0}
183
-
184
- We'll add that to the ajd then.
185
-
186
- ajd = Date.today.ajd.to_f
187
-
188
- ajd = #{Date.today.ajd.to_f}
189
-
190
- #{Date.today.ajd.to_f} + #{(12.0 - (eot.longitude + eot.eot()) / 15.0) / 24.0} = #{Date.today.ajd.to_f + (12.0 - (eot.longitude + eot.eot()) / 15.0) / 24.0}
191
-
192
-
193
- There is a method in Eot class to make that a DateTime object.
194
-
195
- eot.ajd_to_datetime(ajd + transit)
196
-
197
- #{eot.ajd_to_datetime(Date.today.ajd.to_f + (12.0 - (eot.longitude + eot.eot()) / 15.0) / 24.0)}
198
-
199
-
200
- Be sure to set your latitude attribute as well when you want to compute sunrise and sunset times for the days of interest.
201
-
202
- eot.latitude = my_latitude
203
-
204
-
205
- Your longitude and the GHA of the Sun will match at True Solar Transit time.
206
-
207
- Check it here http://douglasallen.github.io/planets/ just put in the correct time and date then hit calculate.
208
-
209
- Does GHA Sun = your longitude?
210
-
211
- It's off a little bit because that site uses a different formula that is commonly used in older programs.
212
-
213
- I get about 3 seconds difference in the EOT is all.
214
- DISPLAY
215
-
216
-
217
-
218
-
219
-
220
-
221
-
222
- puts file
data/lib/eot/displays.rb DELETED
@@ -1,216 +0,0 @@
1
- # displays.rb
2
-
3
- class Eot
4
-
5
- # From displays.rb
6
- # String formatter for d:m:s display
7
- def degrees_to_s( radians = 0.0 )
8
- radians.nil? ? radians = 0.0 : radians
9
- radians < 0 ? sign_string = "-" : sign_string = "+"
10
- absolute_degrees = radians.abs * R2D
11
- absolute_degrees_integer = Integer( absolute_degrees )
12
- absolute_decimal_minutes = 60.0 *
13
- (
14
- absolute_degrees -
15
- absolute_degrees_integer
16
- )
17
-
18
- absolute_minutes_integer = Integer( absolute_decimal_minutes )
19
-
20
- absolute_decimal_seconds = 60.0 *
21
- (
22
- absolute_decimal_minutes -
23
- absolute_minutes_integer
24
- )
25
-
26
- absolute_seconds_integer = Integer( absolute_decimal_seconds )
27
-
28
- absolute_milli_seconds_integer = Integer(1000.0 *
29
- (
30
- absolute_decimal_seconds -
31
- absolute_seconds_integer
32
- )
33
- )
34
- sign_string +
35
- "%03d" % absolute_degrees_integer +
36
- ":" +
37
- "%02d" % absolute_minutes_integer +
38
- ":" +
39
- "%02d" % absolute_seconds_integer +
40
- "." +
41
- "%3.3d" % absolute_milli_seconds_integer
42
- end
43
-
44
- # From displays.rb
45
- # String formatter for + and - time
46
- def show_minutes(min = 0.0)
47
- min.nil? ? min = 0.0 : min
48
- time = Time.utc(1, 1, 1, 0, 0, 0, 0.0)
49
- time = time + (min.abs * 60.0)
50
- if min < 0.0
51
- sign = "-"
52
- else
53
- sign = "+"
54
- end
55
- time.strftime("#{sign}%M:%S.%3N")
56
- end
57
-
58
- # From displays.rb
59
- # String for time now
60
- def show_now(now = now(Time.now.utc))
61
- show_minutes(now)
62
- end
63
-
64
- # From displays.rb
65
- # String format of apparent longitude
66
- def string_al_Sun()
67
- degrees_to_s( al_Sun() )
68
- end
69
- alias_method :apparent_longitude_string, :string_al_Sun
70
-
71
- # From displays.rb
72
- # String formatter for fraction of Julian day number
73
- def string_day_fraction_to_time( jpd_time = 0.0 )
74
- jpd_time.nil? ? jpd_time = 0.0 : jpd_time
75
- fraction = jpd_time + 0.5 - Integer( jpd_time )
76
- hours = Integer( fraction * DAY_HOURS )
77
- minutes = Integer(( fraction - hours / DAY_HOURS ) * DAY_MINUTES )
78
- seconds = Integer(( fraction - hours / 24.0 - minutes / DAY_MINUTES ) * DAY_SECONDS )
79
- "%02d" % hours +
80
- ":" +
81
- "%02d" % minutes +
82
- ":" +
83
- "%02d" % seconds
84
- end
85
- alias_method :julian_period_day_fraction_to_time, :string_day_fraction_to_time
86
-
87
- # From displays.rb
88
- # String format of declination
89
- def string_dec_Sun()
90
- degrees_to_s( dec_Sun() )
91
- end
92
- alias_method :declination_string, :string_dec_Sun
93
-
94
- # From displays.rb
95
- # String format for delta oblique
96
- def string_delta_oblique()
97
- show_minutes(delta_oblique())
98
- end
99
-
100
- # From displays.rb
101
- # String format for delta orbit
102
- def string_delta_orbit()
103
- show_minutes(delta_orbit())
104
- end
105
-
106
- # From displays.rb
107
- # String format for centre
108
- def string_eqc()
109
- degrees_to_s( center())
110
- end
111
-
112
- # From displays.rb
113
- # Equation of time output for minutes and seconds
114
- def string_eot()
115
- eot = time_eot()
116
- min_eot = eot
117
- if min_eot < 0.0
118
- sign = "-"
119
- else
120
- sign = "+"
121
- end
122
- eot = min_eot.abs
123
- minutes = Integer( eot )
124
- seconds = ( eot - minutes ) * 60.0
125
- decimal_seconds = ( seconds - Integer( seconds )) * 100.0
126
- min = "%02d" % minutes
127
- sec = "%02d" % seconds
128
- dec_sec = "%01d" % decimal_seconds
129
- sign << min << "m, " << sec << "." << dec_sec << "s"
130
- end
131
- alias_method :display_equation_of_time, :string_eot
132
-
133
- # From displays.rb
134
- # String format conversion of jd to date
135
- def string_jd_to_date( jd = DJ00 )
136
- jd = check_jd_zero( jd )
137
- Date.jd( jd ).to_s
138
- end
139
- alias_method :jd_to_date_string, :string_jd_to_date
140
-
141
- # From displays.rb
142
- # String format of mean anomaly
143
- def string_ma_Sun()
144
- degrees_to_s( @ma )
145
- end
146
- alias_method :mean_anomaly_string, :string_ma_Sun
147
-
148
- # From displays.rb
149
- # String format of right ascension
150
- def string_ra_Sun()
151
- degrees_to_s( ra_Sun() )
152
- end
153
- alias_method :right_ascension_string, :string_ra_Sun
154
-
155
- # From displays.rb
156
- # String format of true anomaly
157
- def string_ta_Sun( )
158
- degrees_to_s( ta_Sun() )
159
- end
160
- alias_method :true_anomaly_string, :string_ta_Sun
161
-
162
- # From displays.rb
163
- # String formatter for h:m:s display
164
- def string_time( dt = DT2000 )
165
- dt = check_t_zero( dt )
166
-
167
- if dt.class == DateTime
168
- hours = dt.hour
169
- minutes = dt.min
170
- seconds = dt.sec
171
- intsecs = Integer( seconds )
172
- decsecs = Integer(( seconds - intsecs ).round( 3 ) * 1000.0 )
173
- else
174
- decimal = dt % DAY_HOURS
175
- hours = Integer( decimal )
176
- mindecimal = 60.0 * ( decimal - hours )
177
- minutes = Integer( mindecimal )
178
- seconds = 60.0 * ( mindecimal - minutes )
179
- intsecs = Integer( seconds )
180
- decsecs = Integer(( seconds - intsecs ).round( 3 ) * 1000.0 )
181
- end
182
-
183
- "%02d" % hours +
184
- ":" +
185
- "%02d" % minutes +
186
- ":" +
187
- "%02d" % intsecs +
188
- "." +
189
- "%3.3d" % decsecs
190
- end
191
- alias_method :display_time_string, :string_time
192
-
193
- # From displays.rb
194
- # String format of true longitude
195
- def string_tl_Sun()
196
- degrees_to_s( tl_Sun() )
197
- end
198
- alias_method :true_longitude_string, :string_tl_Sun
199
-
200
- # From displays.rb
201
- # String format of true obliquity
202
- def string_to_Earth()
203
- degrees_to_s( to_Earth() )
204
- end
205
- alias_method :true_obliquity_string, :string_to_Earth
206
-
207
- end
208
-
209
- if __FILE__ == $PROGRAM_NAME
210
-
211
- spec = File.expand_path('../../../tests/minitest', __FILE__)
212
- $LOAD_PATH.unshift(spec) unless $LOAD_PATH.include?(spec)
213
- require 'displays_spec'
214
- require 'aliased_displays_spec'
215
-
216
- end
data/lib/eot/eot.so DELETED
Binary file