equationoftime 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.rspec +1 -0
- data/Gemfile +4 -0
- data/LICENSE.md +22 -0
- data/LICENSE.txt +22 -0
- data/README.md +80 -0
- data/README2.txt +70 -0
- data/Rakefile +80 -0
- data/doc/GeoLatLng.html +770 -0
- data/doc/_index.html +123 -0
- data/doc/class_list.html +54 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +179 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +179 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +178 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +611 -0
- data/doc/top-level-namespace.html +112 -0
- data/equationoftime.gemspec +35 -0
- data/examples/Equation_of_Time.jpg +0 -0
- data/examples/analemma_data_generator.rb +53 -0
- data/examples/check_date_type.rb +57 -0
- data/examples/compare_geoc_long_ra.rb +31 -0
- data/examples/data_table.rb +26 -0
- data/examples/earth_rotation.rb +13 -0
- data/examples/eot_methods_list.rb +16 -0
- data/examples/eot_plot.r +57 -0
- data/examples/eot_suntimes.rb +140 -0
- data/examples/equation_of_time.py +186 -0
- data/examples/figure_1.jpg +0 -0
- data/examples/file_converter.rb +31 -0
- data/examples/from_readme.rb +10 -0
- data/examples/geo_locator.rb +12 -0
- data/examples/getjd.rb +45 -0
- data/examples/input_suntimes.rb +21 -0
- data/examples/julian_day_formula.rb +29 -0
- data/examples/julian_day_formula.txt +12 -0
- data/examples/my_time_conversion.rb +21 -0
- data/examples/nutation_series.txt +678 -0
- data/examples/nutation_series.yaml +14239 -0
- data/examples/nutation_table5_3a.txt +682 -0
- data/examples/nutation_table5_3a.yaml +9532 -0
- data/examples/ptime.rb +162 -0
- data/examples/read_nutation_data.rb +399 -0
- data/examples/suntimes.rb +28 -0
- data/examples/suntimes_test.rb +47 -0
- data/examples/test_poly_eval.rb +38 -0
- data/examples/time_scales.rb +29 -0
- data/examples/usage_example.rb +13 -0
- data/examples/use_angles.rb +155 -0
- data/lib/eot/angles.rb +337 -0
- data/lib/eot/constants.rb +168 -0
- data/lib/eot/displays.rb +213 -0
- data/lib/eot/geo_lat_lng_smt.rb +80 -0
- data/lib/eot/init.rb +93 -0
- data/lib/eot/nutation.rb +70 -0
- data/lib/eot/nutation_table5_3a.yaml +9532 -0
- data/lib/eot/times.rb +130 -0
- data/lib/eot/utilities.rb +129 -0
- data/lib/eot/version.rb +6 -0
- data/lib/eot.rb +11 -0
- data/tests/minitest/aliased_angles_spec.rb +287 -0
- data/tests/minitest/aliased_displays_spec.rb +106 -0
- data/tests/minitest/aliased_times_spec.rb +36 -0
- data/tests/minitest/aliased_utilities_spec.rb +49 -0
- data/tests/minitest/angles_spec.rb +313 -0
- data/tests/minitest/constants_spec.rb +27 -0
- data/tests/minitest/delta_epsilon_spec.rb +35 -0
- data/tests/minitest/displays_spec.rb +111 -0
- data/tests/minitest/geo_spec.rb +36 -0
- data/tests/minitest/init_spec.rb +32 -0
- data/tests/minitest/nutation_spec.rb +33 -0
- data/tests/minitest/times_spec.rb +137 -0
- data/tests/minitest/utilities_spec.rb +121 -0
- data/tests/spec_config.rb +3 -0
- data/wiki.md +46 -0
- data/wiki2.md +4 -0
- metadata +240 -0
data/lib/eot/displays.rb
ADDED
@@ -0,0 +1,213 @@
|
|
1
|
+
# displays.rb
|
2
|
+
|
3
|
+
class Eot
|
4
|
+
|
5
|
+
# From displays.rb<br>
|
6
|
+
# String formatter for d:m:s display
|
7
|
+
def degrees_to_s( degrees = 0.0 )
|
8
|
+
degrees.nil? ? degrees = 0.0 : degrees
|
9
|
+
degrees < 0 ? sign_string = "-" : sign_string = "+"
|
10
|
+
absolute_degrees = degrees.abs
|
11
|
+
absolute_degrees_integer = Integer( absolute_degrees )
|
12
|
+
absolute_decimal_minutes = 60.0 *
|
13
|
+
(
|
14
|
+
absolute_degrees -
|
15
|
+
absolute_degrees_integer
|
16
|
+
)
|
17
|
+
absolute_minutes_integer = Integer( absolute_decimal_minutes )
|
18
|
+
absolute_decimal_seconds = bd( 60.0 *
|
19
|
+
(
|
20
|
+
absolute_decimal_minutes -
|
21
|
+
absolute_minutes_integer
|
22
|
+
)
|
23
|
+
)
|
24
|
+
absolute_seconds_integer = Integer( absolute_decimal_seconds )
|
25
|
+
absolute_milli_seconds_integer = Integer(1000.0 *
|
26
|
+
(
|
27
|
+
absolute_decimal_seconds -
|
28
|
+
absolute_seconds_integer
|
29
|
+
)
|
30
|
+
)
|
31
|
+
sign_string +
|
32
|
+
"%03d" % absolute_degrees_integer +
|
33
|
+
":" +
|
34
|
+
"%02d" % absolute_minutes_integer +
|
35
|
+
":" +
|
36
|
+
"%02d" % absolute_seconds_integer +
|
37
|
+
"." +
|
38
|
+
"%3.3d" % absolute_milli_seconds_integer
|
39
|
+
end
|
40
|
+
|
41
|
+
# From displays.rb<br>
|
42
|
+
# String formatter for + and - time
|
43
|
+
def show_minutes(min = 0.0)
|
44
|
+
min.nil? ? min = 0.0 : min
|
45
|
+
time = Time.utc(1, 1, 1, 0, 0, 0, 0.0)
|
46
|
+
time = time + (min.abs * 60.0)
|
47
|
+
if min < 0.0
|
48
|
+
sign = "-"
|
49
|
+
else
|
50
|
+
sign = "+"
|
51
|
+
end
|
52
|
+
time.strftime("#{sign}%M:%S.%3N")
|
53
|
+
end
|
54
|
+
|
55
|
+
# From displays.rb<br>
|
56
|
+
# String for time now
|
57
|
+
def show_now(now = now(Time.now.utc))
|
58
|
+
show_minutes(now)
|
59
|
+
end
|
60
|
+
|
61
|
+
# From displays.rb<br>
|
62
|
+
# String format of apparent longitude
|
63
|
+
def string_al_Sun( ta = A2000 )
|
64
|
+
degrees_to_s( al_Sun( ta ) )
|
65
|
+
end
|
66
|
+
alias_method :apparent_longitude_string, :string_al_Sun
|
67
|
+
|
68
|
+
# From displays.rb<br>
|
69
|
+
# String formatter for fraction of Julian day number
|
70
|
+
def string_day_fraction_to_time( jpd_time = 0.0 )
|
71
|
+
jpd_time.nil? ? jpd_time = 0.0 : jpd_time
|
72
|
+
fraction = jpd_time + 0.5 - Integer( jpd_time )
|
73
|
+
hours = Integer( fraction * DAY_HOURS )
|
74
|
+
minutes = Integer(( fraction - hours / DAY_HOURS ) * DAY_MINUTES )
|
75
|
+
seconds = Integer(( fraction - hours / 24.0 - minutes / DAY_MINUTES ) * DAY_SECONDS )
|
76
|
+
"%02d" % hours +
|
77
|
+
":" +
|
78
|
+
"%02d" % minutes +
|
79
|
+
":" +
|
80
|
+
"%02d" % seconds
|
81
|
+
end
|
82
|
+
alias_method :julian_period_day_fraction_to_time, :string_day_fraction_to_time
|
83
|
+
|
84
|
+
# From displays.rb<br>
|
85
|
+
# String format of declination
|
86
|
+
def string_dec_Sun( ta = A2000 )
|
87
|
+
degrees_to_s( dec_Sun( ta ) )
|
88
|
+
end
|
89
|
+
alias_method :declination_string, :string_dec_Sun
|
90
|
+
|
91
|
+
# From displays.rb<br>
|
92
|
+
# String format for delta oblique
|
93
|
+
def string_delta_oblique( ta = A2000 )
|
94
|
+
show_minutes(delta_oblique( ta ))
|
95
|
+
end
|
96
|
+
|
97
|
+
# From displays.rb<br>
|
98
|
+
# String format for delta orbit
|
99
|
+
def string_delta_orbit( ta = A2000 )
|
100
|
+
show_minutes(delta_orbit( ta ))
|
101
|
+
end
|
102
|
+
|
103
|
+
# From displays.rb<br>
|
104
|
+
# String format for centre
|
105
|
+
def string_eqc( ta = A2000 )
|
106
|
+
degrees_to_s( center( ta ))
|
107
|
+
end
|
108
|
+
|
109
|
+
# From displays.rb<br>
|
110
|
+
# Equation of time output for minutes and seconds
|
111
|
+
def string_eot()
|
112
|
+
eot = time_eot()
|
113
|
+
min_eot = eot
|
114
|
+
if min_eot < 0.0
|
115
|
+
sign = "-"
|
116
|
+
else
|
117
|
+
sign = "+"
|
118
|
+
end
|
119
|
+
eot = min_eot.abs
|
120
|
+
minutes = Integer( eot )
|
121
|
+
seconds = ( eot - minutes ) * 60.0
|
122
|
+
decimal_seconds = ( seconds - Integer( seconds )) * 100.0
|
123
|
+
min = "%02d" % minutes
|
124
|
+
sec = "%02d" % seconds
|
125
|
+
dec_sec = "%01d" % decimal_seconds
|
126
|
+
sign << min << "m, " << sec << "." << dec_sec << "s"
|
127
|
+
end
|
128
|
+
alias_method :display_equation_of_time, :string_eot
|
129
|
+
|
130
|
+
# From displays.rb<br>
|
131
|
+
# String format conversion of jd to date
|
132
|
+
def string_jd_to_date( jd = J2000 )
|
133
|
+
jd = check_jd_zero( jd )
|
134
|
+
Date.jd( jd ).to_s
|
135
|
+
end
|
136
|
+
alias_method :jd_to_date_string, :string_jd_to_date
|
137
|
+
|
138
|
+
# From displays.rb<br>
|
139
|
+
# String format of mean anomaly
|
140
|
+
def string_ma_Sun()
|
141
|
+
degrees_to_s( @ma )
|
142
|
+
end
|
143
|
+
alias_method :mean_anomaly_string, :string_ma_Sun
|
144
|
+
|
145
|
+
# From displays.rb<br>
|
146
|
+
# String format of right ascension
|
147
|
+
def string_ra_Sun( ta = A2000 )
|
148
|
+
degrees_to_s( ra_Sun( ta ) )
|
149
|
+
end
|
150
|
+
alias_method :right_ascension_string, :string_ra_Sun
|
151
|
+
|
152
|
+
# From displays.rb<br>
|
153
|
+
# String format of true anomaly
|
154
|
+
def string_ta_Sun( ta = A2000 )
|
155
|
+
degrees_to_s( ta_Sun( ta ) )
|
156
|
+
end
|
157
|
+
alias_method :true_anomaly_string, :string_ta_Sun
|
158
|
+
|
159
|
+
# From displays.rb<br>
|
160
|
+
# String formatter for h:m:s display
|
161
|
+
def string_time( dt = DT2000 )
|
162
|
+
dt = check_t_zero( dt )
|
163
|
+
|
164
|
+
if dt.class == DateTime
|
165
|
+
hours = dt.hour
|
166
|
+
minutes = dt.min
|
167
|
+
seconds = dt.sec
|
168
|
+
intsecs = Integer( seconds )
|
169
|
+
decsecs = Integer(( seconds - intsecs ).round( 3 ) * 1000.0 )
|
170
|
+
else
|
171
|
+
decimal = dt % DAY_HOURS
|
172
|
+
hours = Integer( decimal )
|
173
|
+
mindecimal = bd( 60.0 * ( decimal - hours )) * 1.0
|
174
|
+
minutes = Integer( mindecimal )
|
175
|
+
seconds = bd( 60.0 * ( mindecimal - minutes )) * 1.0
|
176
|
+
intsecs = Integer( seconds )
|
177
|
+
decsecs = Integer(( seconds - intsecs ).round( 3 ) * 1000.0 )
|
178
|
+
end
|
179
|
+
|
180
|
+
"%02d" % hours +
|
181
|
+
":" +
|
182
|
+
"%02d" % minutes +
|
183
|
+
":" +
|
184
|
+
"%02d" % intsecs +
|
185
|
+
"." +
|
186
|
+
"%3.3d" % decsecs
|
187
|
+
end
|
188
|
+
alias_method :display_time_string, :string_time
|
189
|
+
|
190
|
+
# From displays.rb<br>
|
191
|
+
# String format of true longitude
|
192
|
+
def string_tl_Sun( ta = A2000 )
|
193
|
+
degrees_to_s( tl_Sun( ta ) )
|
194
|
+
end
|
195
|
+
alias_method :true_longitude_string, :string_tl_Sun
|
196
|
+
|
197
|
+
# From displays.rb<br>
|
198
|
+
# String format of true obliquity
|
199
|
+
def string_to_Earth( ta = A2000 )
|
200
|
+
degrees_to_s( to_Earth( ta ) )
|
201
|
+
end
|
202
|
+
alias_method :true_obliquity_string, :string_to_Earth
|
203
|
+
|
204
|
+
end
|
205
|
+
|
206
|
+
if __FILE__ == $PROGRAM_NAME
|
207
|
+
|
208
|
+
spec = File.expand_path('../../../tests/minitest', __FILE__)
|
209
|
+
$LOAD_PATH.unshift(spec) unless $LOAD_PATH.include?(spec)
|
210
|
+
require 'displays_spec'
|
211
|
+
require 'aliased_displays_spec'
|
212
|
+
|
213
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# geo_lat_lng_smt.rb
|
2
|
+
|
3
|
+
require 'multi_xml'
|
4
|
+
require 'rest-client'
|
5
|
+
|
6
|
+
# class for location lookup
|
7
|
+
# in geo_lat_lng_smt.rb
|
8
|
+
class GeoLatLng
|
9
|
+
|
10
|
+
# Base address for Google maps api
|
11
|
+
attr_reader :base
|
12
|
+
|
13
|
+
# Default US set to PARCS
|
14
|
+
attr_reader :default_us
|
15
|
+
|
16
|
+
# Default International set to GMT Museum
|
17
|
+
attr_reader :default_int
|
18
|
+
|
19
|
+
# Address entered
|
20
|
+
attr_accessor :addr
|
21
|
+
|
22
|
+
# Latitude returned
|
23
|
+
attr_accessor :lat
|
24
|
+
|
25
|
+
# Longitude returned
|
26
|
+
attr_accessor :lng
|
27
|
+
|
28
|
+
# Base Google URL
|
29
|
+
attr_reader :base
|
30
|
+
|
31
|
+
# Instance variables
|
32
|
+
def initialize
|
33
|
+
|
34
|
+
@base = "http://maps.googleapis.com/maps/api/geocode/xml?sensor=false&address="
|
35
|
+
@default_us = "3333 Coyote Hill Road, Palo Alto, CA, 94304, USA"#do you copy? :D
|
36
|
+
@default_int = "Blackheath Ave, London SE10 8XJ, UK"
|
37
|
+
@lat = 0.0
|
38
|
+
@lng = 0.0
|
39
|
+
MultiXml.parser = :rexml#:libxml#:ox # :nokogiri
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
# set address
|
44
|
+
def addr=(addr = @default_int)
|
45
|
+
@addr = addr
|
46
|
+
end
|
47
|
+
|
48
|
+
# coordinates lookup
|
49
|
+
def get_coordinates_from_address
|
50
|
+
res = RestClient.get(
|
51
|
+
URI.encode(
|
52
|
+
"#{ @base }#{ @addr }"
|
53
|
+
)
|
54
|
+
)
|
55
|
+
parsed_res = MultiXml.parse( res )
|
56
|
+
result = parsed_res[ "GeocodeResponse" ][ "result" ]
|
57
|
+
status = parsed_res[ "GeocodeResponse" ][ "status" ]
|
58
|
+
if status != "OK"
|
59
|
+
@default
|
60
|
+
else
|
61
|
+
if result.count != 4
|
62
|
+
@default
|
63
|
+
else
|
64
|
+
@lat = parsed_res[ "GeocodeResponse" ][ "result" ][ "geometry" ][ "location" ][ "lat" ]
|
65
|
+
@lng = parsed_res[ "GeocodeResponse" ][ "result" ][ "geometry" ][ "location" ][ "lng" ]
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
if __FILE__ == $PROGRAM_NAME
|
74
|
+
|
75
|
+
spec = File.expand_path('../../../tests/minitest', __FILE__)
|
76
|
+
$LOAD_PATH.unshift(spec) unless $LOAD_PATH.include?(spec)
|
77
|
+
require 'geo_spec'
|
78
|
+
|
79
|
+
end
|
80
|
+
|
data/lib/eot/init.rb
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
# init.rb
|
2
|
+
|
3
|
+
class Eot
|
4
|
+
|
5
|
+
# From init.rb:<br>
|
6
|
+
# Astronomical Julian Day Number is an instance of Date class.
|
7
|
+
# When new Equation of Time class is initialized @ajd = jd = today DateTime.jd
|
8
|
+
# Used for getting the equation of time now if it is set for that. There is
|
9
|
+
# always a slight delay in the computation though.
|
10
|
+
attr_accessor :ajd
|
11
|
+
|
12
|
+
# From init.rb:<br>
|
13
|
+
# Nutation Data is an instance of Array class.
|
14
|
+
# @data = nutation_table5_3a.yaml
|
15
|
+
# YAML File loaded when new Eot class is initialized.
|
16
|
+
attr_reader :data
|
17
|
+
|
18
|
+
# From init.rb:<br>
|
19
|
+
# @date is an instance of Date class.
|
20
|
+
# When new Eot class is initialized @date = today
|
21
|
+
attr_accessor :date
|
22
|
+
|
23
|
+
# From init.rb:<br>
|
24
|
+
# Julian Day Number is an instance of Date class.
|
25
|
+
# When new Eot class is initialized @jd = jd today
|
26
|
+
attr_accessor :jd
|
27
|
+
|
28
|
+
# From init.rb:<br>
|
29
|
+
# Latitude input is an instance of Float class.
|
30
|
+
# When new Eot class is initialized @latitude = 0.0
|
31
|
+
# May use GeoLatLng class to set it also but is commented out or will fail if no
|
32
|
+
# internet connection is present.
|
33
|
+
attr_accessor :latitude
|
34
|
+
|
35
|
+
# From init.rb:<br>
|
36
|
+
# Longitude input is an instance of Float class.
|
37
|
+
# When new Eot class is initialized @longitude = 0.0
|
38
|
+
# May use GeoLatLng class to set it also but is commented out or will fail if no
|
39
|
+
# internet connection is present.
|
40
|
+
attr_accessor :longitude
|
41
|
+
|
42
|
+
# From init.rb:<br>
|
43
|
+
# Mean Anomaly gets called a lot so attribute accessor saves time
|
44
|
+
attr_accessor :ma
|
45
|
+
|
46
|
+
# From init.rb:<br>
|
47
|
+
# address used for GeoLatLng.addr when used.(commented out)
|
48
|
+
attr_accessor :addr
|
49
|
+
|
50
|
+
|
51
|
+
# From init.rb:<br>
|
52
|
+
# Initialize loads nutation data with safe_yaml and is frozen, atrributes are set.
|
53
|
+
# You may use GeoLatLng to set up @latitude and @longitude but you need to have
|
54
|
+
# internet so that is commented out for now.
|
55
|
+
def initialize(addr=nil)
|
56
|
+
|
57
|
+
file_path = File.expand_path( File.dirname( __FILE__ ) + "/nutation_table5_3a.yaml" )
|
58
|
+
@data = YAML::load( File.open( file_path, 'r'), :safe => true ).freeze
|
59
|
+
|
60
|
+
@ajd.nil? ? @ajd = DateTime.now.to_time.utc.to_datetime.jd.to_f : @ajd = self.ajd
|
61
|
+
@date.nil? ? @date = DateTime.now.to_time.utc.to_date : @date = self.date
|
62
|
+
@jd.nil? ? @jd = DateTime.now.to_time.utc.to_datetime.jd.to_f : @jd = self.jd
|
63
|
+
@latitude.nil? ? @latitude = 0.0 : @latitude = self.latitude
|
64
|
+
@longitude.nil? ? @longitude = 0.0 : @longitude = self.longitude
|
65
|
+
@ma.nil? ? @ma = ma_Sun() : @ma
|
66
|
+
|
67
|
+
#geo = GeoLatLng.new
|
68
|
+
@addr = addr
|
69
|
+
#addr.nil? ? geo.addr=(geo.default_int) : geo.addr=addr
|
70
|
+
# uncomment below if you have internet connection
|
71
|
+
#geo.get_coordinates_from_address
|
72
|
+
#@latitude = geo.lat.to_f
|
73
|
+
#@longitude = geo.lng.to_f
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
# we can run some tests from inside this file.
|
80
|
+
if __FILE__ == $PROGRAM_NAME
|
81
|
+
|
82
|
+
lib = File.expand_path('../../../lib', __FILE__)
|
83
|
+
puts "Loading gem from #{lib}/eot.rb"
|
84
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
85
|
+
require 'eot'
|
86
|
+
e = Eot.new
|
87
|
+
p e.date
|
88
|
+
|
89
|
+
spec = File.expand_path('../../../tests/minitest', __FILE__)
|
90
|
+
$LOAD_PATH.unshift(spec) unless $LOAD_PATH.include?(spec)
|
91
|
+
require 'init_spec'
|
92
|
+
|
93
|
+
end
|
data/lib/eot/nutation.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# nutation.rb
|
2
|
+
|
3
|
+
require 'mutex_m'
|
4
|
+
|
5
|
+
class Eot
|
6
|
+
|
7
|
+
# From nutation.rb<br>
|
8
|
+
# nutation data terms are used here.
|
9
|
+
# arc seconds are used for these terms
|
10
|
+
# see http://aa.usno.navy.mil/publications/docs/Circular_179.pdf page 46 (5.19)
|
11
|
+
def delta_equinox( ta = A2000 )
|
12
|
+
ta = check_jct_zero( ta )
|
13
|
+
|
14
|
+
ma_moon = [-0.00024470, 0.051635, 31.8792, 1717915923.2178, 485868.249036].inject(0.0) {|p, a| p * ta[0] + a}
|
15
|
+
|
16
|
+
ma_sun = [-0.00001149, 0.000136, -0.5532, 129596581.0481, 1287104.79305].inject(0.0) {|p, a| p * ta[0] + a}
|
17
|
+
|
18
|
+
md_moon = [0.00000417, -0.001037, -12.7512, 1739527262.8478, 335779.526232].inject(0.0) {|p, a| p * ta[0] + a}
|
19
|
+
|
20
|
+
me_moon = [-0.00003169, 0.006593, -6.3706, 1602961601.2090, 1072260.70369].inject(0.0) {|p, a| p * ta[0] + a}
|
21
|
+
|
22
|
+
omega = [-0.00005939, 0.007702, 7.4722, -6962890.5431, 450160.398036].inject(0.0) {|p, a| p * ta[0] + a}
|
23
|
+
|
24
|
+
# declare and clear these two variables for the sigma loop
|
25
|
+
delta_psi, delta_eps = 0, 0
|
26
|
+
|
27
|
+
lines = data.size - 1
|
28
|
+
for i in 0..lines
|
29
|
+
fma_sun = data[i][0].to_i
|
30
|
+
fma_moon = data[i][1].to_i
|
31
|
+
fmd_moon = data[i][2].to_i
|
32
|
+
fme_moon = data[i][3].to_i
|
33
|
+
fomega = data[i][4].to_i
|
34
|
+
|
35
|
+
sine = sind(fma_moon * ma_moon +
|
36
|
+
fma_sun * ma_sun +
|
37
|
+
fmd_moon * md_moon +
|
38
|
+
fme_moon * me_moon +
|
39
|
+
fomega * omega)
|
40
|
+
|
41
|
+
cosine = cosd(fma_moon * ma_moon +
|
42
|
+
fma_sun * ma_sun +
|
43
|
+
fmd_moon * md_moon +
|
44
|
+
fme_moon * me_moon +
|
45
|
+
fomega * omega)
|
46
|
+
|
47
|
+
delta_psi += (data[i][6].to_f +
|
48
|
+
data[i][7].to_f * ta[0]) * sine +
|
49
|
+
data[i][10].to_f * cosine
|
50
|
+
|
51
|
+
delta_eps += (data[i][8].to_f +
|
52
|
+
data[i][9].to_f * ta[0]) * cosine +
|
53
|
+
data[i][12].to_f * sine
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
delta_eps = to_deg( delta_eps ) / 1000.0
|
58
|
+
delta_psi = to_deg( delta_psi ) / 1000.0
|
59
|
+
|
60
|
+
[ delta_eps, delta_psi, ma_sun, omega, ma_moon, md_moon, me_moon]
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
if __FILE__ == $PROGRAM_NAME
|
65
|
+
|
66
|
+
spec = File.expand_path('../../../tests/minitest', __FILE__)
|
67
|
+
$LOAD_PATH.unshift(spec) unless $LOAD_PATH.include?(spec)
|
68
|
+
require 'nutation_spec'
|
69
|
+
|
70
|
+
end
|