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/times.rb
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
# times.rb
|
2
|
+
#
|
3
|
+
|
4
|
+
class Eot
|
5
|
+
|
6
|
+
# From times.rb:<br>
|
7
|
+
# Pass in an AJD number
|
8
|
+
# Returns a DateTime object
|
9
|
+
def ajd_to_datetime(ajd)
|
10
|
+
DateTime.jd(ajd + 0.5)
|
11
|
+
end
|
12
|
+
|
13
|
+
# From times.rb:<br>
|
14
|
+
# Uses @ajd attribute
|
15
|
+
# Returns EOT as an AJD Julian number
|
16
|
+
def eot_jd
|
17
|
+
time_eot() / DAY_MINUTES
|
18
|
+
end
|
19
|
+
|
20
|
+
# From times.rb:<br>
|
21
|
+
# Uses @ajd and @longitude attributes
|
22
|
+
# Returns DateTime object of local mean noon or solar transit
|
23
|
+
def mean_local_noon_dt()
|
24
|
+
ajd_to_datetime(@ajd - @longitude / 360.0)
|
25
|
+
end
|
26
|
+
|
27
|
+
# From times.rb:<br>
|
28
|
+
# Uses changed @ajd attribute
|
29
|
+
# Returns EOT (equation of time) now in decimal minutes time
|
30
|
+
def now()
|
31
|
+
@ajd = DateTime.now.to_time.utc.to_datetime.ajd
|
32
|
+
time_eot()
|
33
|
+
end
|
34
|
+
|
35
|
+
# From times.rb:<br>
|
36
|
+
# Uses @ajd attribute
|
37
|
+
# Returns a DateTime object of local sunrise
|
38
|
+
def sunrise_dt()
|
39
|
+
eot_jd()
|
40
|
+
eot_dt = ajd_to_datetime(eot_jd())
|
41
|
+
local_noon_dt = ajd_to_datetime(mean_local_noon_dt() - eot_dt)
|
42
|
+
tjca = time_julian_century( local_noon_dt.ajd )
|
43
|
+
lha_dt = ajd_to_datetime(ha_Sun( tjca ) / 360.0)
|
44
|
+
ajd_to_datetime(local_noon_dt - lha_dt)
|
45
|
+
end
|
46
|
+
|
47
|
+
# From times.rb:<br>
|
48
|
+
# Uses @ajd attribute
|
49
|
+
# Returns Sunrise as a Julian number
|
50
|
+
def sunrise_jd()
|
51
|
+
sunrise_dt.ajd.to_f
|
52
|
+
end
|
53
|
+
|
54
|
+
# From times.rb:<br>
|
55
|
+
# Uses @ajd attribute
|
56
|
+
# Returns a DateTime object of local sunset
|
57
|
+
def sunset_dt()
|
58
|
+
eot_dt = ajd_to_datetime(eot_jd())
|
59
|
+
local_noon_dt = ajd_to_datetime(mean_local_noon_dt() - eot_dt)
|
60
|
+
tjca = time_julian_century( local_noon_dt.ajd )
|
61
|
+
lha_dt = ajd_to_datetime(-ha_Sun( tjca ) / 360.0)
|
62
|
+
ajd_to_datetime(local_noon_dt - lha_dt)
|
63
|
+
end
|
64
|
+
|
65
|
+
# From times.rb:<br>
|
66
|
+
# Uses @ajd attribute
|
67
|
+
# Returns Sunset as a Julian number
|
68
|
+
def sunset_jd()
|
69
|
+
sunset_dt.ajd.to_f
|
70
|
+
end
|
71
|
+
|
72
|
+
# From times.rb:<br>
|
73
|
+
# Uses @ajd attribute
|
74
|
+
# Returns Oblique component of EOT in decimal minutes time
|
75
|
+
def time_delta_oblique()
|
76
|
+
ta = time_julian_century(@ajd)
|
77
|
+
@ma = ma_Sun()
|
78
|
+
(tl_Sun( ta ) -
|
79
|
+
ra_Sun( ta )) * SM
|
80
|
+
end
|
81
|
+
|
82
|
+
# From times.rb:<br>
|
83
|
+
# Uses @ajd attribute
|
84
|
+
# Returns Orbit component of EOT in decimal minutes time
|
85
|
+
def time_delta_orbit()
|
86
|
+
ta = time_julian_century(@ajd)
|
87
|
+
@ma = ma_Sun()
|
88
|
+
(@ma - ta_Sun( ta )) * SM
|
89
|
+
end
|
90
|
+
|
91
|
+
# From times.rb:<br>
|
92
|
+
# Uses @ajd attribute
|
93
|
+
# Returns EOT as a float for decimal minutes time
|
94
|
+
def time_eot()
|
95
|
+
eot() * SM
|
96
|
+
end
|
97
|
+
|
98
|
+
# From times.rb:<br>
|
99
|
+
# All calculations with ( ta ) based on this.
|
100
|
+
# Julian Century Time is a fractional century
|
101
|
+
# Julian Day Number J2000 is subtracted
|
102
|
+
# Returns an array of fractional century powers
|
103
|
+
def time_julian_century( dt = DT2000 )
|
104
|
+
dt = check_t_zero( dt )
|
105
|
+
dt.class == DateTime ? jd = dt.ajd : jd = dt
|
106
|
+
|
107
|
+
t1 = ( jd - J2000 ) / DJC
|
108
|
+
t2 = t1 * t1
|
109
|
+
t3 = t1 * t2
|
110
|
+
t4 = t2 * t2
|
111
|
+
t5 = t2 * t3
|
112
|
+
t6 = t3 * t3
|
113
|
+
t7 = t3 * t4
|
114
|
+
t8 = t4 * t4
|
115
|
+
t9 = t4 * t5
|
116
|
+
t10 = t5 * t5
|
117
|
+
[ t1, t2, t3, t4, t5, t6, t7, t8, t9, t10 ]
|
118
|
+
end
|
119
|
+
alias_method :time_julian_centurey, :time_julian_century
|
120
|
+
|
121
|
+
end
|
122
|
+
|
123
|
+
if __FILE__ == $PROGRAM_NAME
|
124
|
+
|
125
|
+
spec = File.expand_path('../../../tests/minitest', __FILE__)
|
126
|
+
$LOAD_PATH.unshift(spec) unless $LOAD_PATH.include?(spec)
|
127
|
+
require 'times_spec'
|
128
|
+
require 'aliased_times_spec'
|
129
|
+
|
130
|
+
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
# utilities.rb
|
2
|
+
|
3
|
+
require 'bigdecimal'
|
4
|
+
|
5
|
+
class Eot
|
6
|
+
|
7
|
+
# From utilities.rb:<br>
|
8
|
+
# if you want to use BigDecimal math
|
9
|
+
def bd( var = 0.0 )
|
10
|
+
var.nil? ? var = 0.0 : var
|
11
|
+
BigDecimal( var.to_s ) * 1.0
|
12
|
+
end
|
13
|
+
|
14
|
+
# From utilities.rb:<br>
|
15
|
+
# A check for default D2000
|
16
|
+
# sets default when arg is nil
|
17
|
+
def check_date_nil( d = D2000 )
|
18
|
+
d.nil? ? d = D2000 : d
|
19
|
+
end
|
20
|
+
|
21
|
+
# From utilities.rb:<br>
|
22
|
+
# A check for default D2000
|
23
|
+
# sets default when arg is zero
|
24
|
+
def check_date_zero( d = D2000 )
|
25
|
+
d == 0 ? d = D2000 : d = check_date_nil( d )
|
26
|
+
end
|
27
|
+
|
28
|
+
# From utilities.rb:<br>
|
29
|
+
# A check for default J2000
|
30
|
+
# sets default when arg is nil
|
31
|
+
def check_jd_nil( jd = J2000 )
|
32
|
+
jd.nil? ? jd = J2000 : jd
|
33
|
+
end
|
34
|
+
|
35
|
+
# From utilities.rb:<br>
|
36
|
+
# A check for default J2000
|
37
|
+
# sets default when arg is zero
|
38
|
+
def check_jd_zero( jd = J2000 )
|
39
|
+
jd == 0 ? jd = J2000 : jd = check_jd_nil( jd )
|
40
|
+
end
|
41
|
+
|
42
|
+
# From utilities.rb:<br>
|
43
|
+
# A check for default A2000
|
44
|
+
# sets default when arg is nil
|
45
|
+
def check_jct_nil( ta = A2000 )
|
46
|
+
ta.nil? ? ta = A2000 : ta
|
47
|
+
end
|
48
|
+
|
49
|
+
# From utilities.rb:<br>
|
50
|
+
# A check for default A2000
|
51
|
+
# sets default when arg is zero
|
52
|
+
def check_jct_zero( ta = A2000 )
|
53
|
+
ta == 0 ? ta = A2000 : ta = check_jct_nil( ta )
|
54
|
+
end
|
55
|
+
|
56
|
+
# From utilities.rb:<br>
|
57
|
+
# A check for default DT2000
|
58
|
+
# sets default when arg is nil
|
59
|
+
def check_t_nil( dt = DT2000 )
|
60
|
+
dt.nil? ? dt = DT2000 : dt
|
61
|
+
end
|
62
|
+
|
63
|
+
# From utilities.rb:<br>
|
64
|
+
# A check for default DT2000
|
65
|
+
# sets default when arg is zero
|
66
|
+
def check_t_zero( dt = DT2000 )
|
67
|
+
dt == 0 ? dt = DT2000 : dt = check_t_nil( dt )
|
68
|
+
end
|
69
|
+
|
70
|
+
# From utilities.rb:<br>
|
71
|
+
# Trig function for cosine of degrees
|
72
|
+
# used in the nutation table calculations
|
73
|
+
def cosd( x = 0.0 )
|
74
|
+
x.nil? ? x = 0.0 : x
|
75
|
+
cos( DTR * x )
|
76
|
+
end
|
77
|
+
|
78
|
+
# From utilities.rb:<br>
|
79
|
+
# degrees to radians conversion
|
80
|
+
# aliased by degrees_to_radians
|
81
|
+
def deg_to_rad( degrees = 0.0 )
|
82
|
+
degrees.nil? ? degrees = 0.0 : degrees
|
83
|
+
degrees * PI / 180.0
|
84
|
+
end
|
85
|
+
alias_method :degrees_to_radians, :deg_to_rad
|
86
|
+
|
87
|
+
# From utilities.rb:<br>
|
88
|
+
# Keeps large angles in range of 360.0
|
89
|
+
# aliased by truncate
|
90
|
+
def mod_360( x = 0.0 )
|
91
|
+
x.nil? ? x = 0.0 : x
|
92
|
+
360.0 * ( x / 360.0 - Integer( x / 360.0 ) )
|
93
|
+
end
|
94
|
+
alias_method :truncate, :mod_360
|
95
|
+
|
96
|
+
# From utilities.rb:<br>
|
97
|
+
# radians to degrees conversion
|
98
|
+
# aliased by radians_to_degrees
|
99
|
+
def rad_to_deg( radians = 0.0 )
|
100
|
+
radians.nil? ? radians = 0.0 : radians
|
101
|
+
radians * 180.0 / PI
|
102
|
+
end
|
103
|
+
alias_method :radians_to_degrees,:rad_to_deg
|
104
|
+
|
105
|
+
# From utilities.rb:<br>
|
106
|
+
# Trig function for sine of degrees
|
107
|
+
# used in the nutation table calculations
|
108
|
+
def sind( x = 0.0 )
|
109
|
+
x.nil? ? x = 0.0 : x
|
110
|
+
sin( DTR * x )
|
111
|
+
end
|
112
|
+
|
113
|
+
# From utilities.rb:<br>
|
114
|
+
# arc seconds to degree conversion
|
115
|
+
def to_deg( arc_secs = 0.0 )
|
116
|
+
arc_secs.nil? ? arc_secs = 0.0 : arc_secs
|
117
|
+
arc_secs / ARCSEC
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
121
|
+
|
122
|
+
if __FILE__ == $PROGRAM_NAME
|
123
|
+
|
124
|
+
spec = File.expand_path('../../../tests/minitest', __FILE__)
|
125
|
+
$LOAD_PATH.unshift(spec) unless $LOAD_PATH.include?(spec)
|
126
|
+
require 'utilities_spec'
|
127
|
+
require 'aliased_utilities_spec'
|
128
|
+
|
129
|
+
end
|
data/lib/eot/version.rb
ADDED
data/lib/eot.rb
ADDED
@@ -0,0 +1,287 @@
|
|
1
|
+
# aliased_angles_spec.rb
|
2
|
+
#
|
3
|
+
# uncomment below for minitest
|
4
|
+
gem 'minitest'
|
5
|
+
require 'minitest/autorun'
|
6
|
+
# require_relative '../spec_config'
|
7
|
+
lib = File.expand_path('../../../lib', __FILE__)
|
8
|
+
# puts "Loading gem from #{lib}/eot.rb"
|
9
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
10
|
+
require 'eot'
|
11
|
+
|
12
|
+
Eot_aliased_angles = Eot.new
|
13
|
+
|
14
|
+
|
15
|
+
describe 'EOT aliased_angles default, nil, 0' do
|
16
|
+
|
17
|
+
# set ma attribute first as it gets tested anyway but a lot of methods
|
18
|
+
# now rely on @ma so we don't have to keep calling it unless we change
|
19
|
+
# @ajd attribute.
|
20
|
+
|
21
|
+
before(:each) do
|
22
|
+
@ajd = 2456885.0
|
23
|
+
Eot_aliased_angles.ajd = @ajd
|
24
|
+
Eot_aliased_angles.mean_anomaly()
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'expected 2456885.0 for Eot_aliased_angles.ajd'do
|
28
|
+
assert_equal 2456885.0, Eot_aliased_angles.ajd
|
29
|
+
assert_equal 220.63461047326172, Eot_aliased_angles.ma
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'expected 279.2295199333757 returned by Eot_aliased_angles.apparent_longitude()? ' do
|
33
|
+
assert_equal 279.2295199333757, Eot_aliased_angles.apparent_longitude()
|
34
|
+
assert_equal 279.2295199333757, Eot_aliased_angles.apparent_longitude(nil)
|
35
|
+
assert_equal 279.2295199333757, Eot_aliased_angles.apparent_longitude(0)
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'expected 0.16038975882741865 returned by Eot_aliased_angles.cosine_apparent_longitude()? ' do
|
39
|
+
assert_equal 0.16038975882741865, Eot_aliased_angles.cosine_apparent_longitude()
|
40
|
+
assert_equal 0.16038975882741865, Eot_aliased_angles.cosine_apparent_longitude(nil)
|
41
|
+
assert_equal 0.16038975882741865, Eot_aliased_angles.cosine_apparent_longitude(0)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'expected 0.16055519782509398 returned by Eot_aliased_angles.cosine_true_longitude()? ' do
|
45
|
+
assert_equal 0.16055519782509398, Eot_aliased_angles.cosine_true_longitude()
|
46
|
+
assert_equal 0.16055519782509398, Eot_aliased_angles.cosine_true_longitude(nil)
|
47
|
+
assert_equal 0.16055519782509398, Eot_aliased_angles.cosine_true_longitude(0)
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'expected 0.9174932093012645 returned by Eot_aliased_angles.cosine_true_obliquity()? ' do
|
51
|
+
assert_equal 0.9174932093012645, Eot_aliased_angles.cosine_true_obliquity()
|
52
|
+
assert_equal 0.9174932093012645, Eot_aliased_angles.cosine_true_obliquity(nil)
|
53
|
+
assert_equal 0.9174932093012645, Eot_aliased_angles.cosine_true_obliquity(0)
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'expected -23.116504240687046 returned by Eot_aliased_angles.declination()? ' do
|
57
|
+
assert_equal -23.116504240687046, Eot_aliased_angles.declination()
|
58
|
+
assert_equal -23.116504240687046, Eot_aliased_angles.declination(nil)
|
59
|
+
assert_equal -23.116504240687046, Eot_aliased_angles.declination(0)
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'expected -0.8041525701173668 returned by Eot_aliased_angles.delta_t_ecliptic()? ' do
|
63
|
+
assert_equal -0.8041525701173668, Eot_aliased_angles.delta_t_ecliptic()
|
64
|
+
assert_equal -0.8041525701173668, Eot_aliased_angles.delta_t_ecliptic(nil)
|
65
|
+
assert_equal -0.8041525701173668, Eot_aliased_angles.delta_t_ecliptic(0)
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'expected 1.2273333530652906 returned by Eot_aliased_angles.delta_t_elliptic()? ' do
|
69
|
+
assert_equal 1.2273333530652906, Eot_aliased_angles.delta_t_elliptic()
|
70
|
+
assert_equal 1.2273333530652906, Eot_aliased_angles.delta_t_elliptic(nil)
|
71
|
+
assert_equal 1.2273333530652906, Eot_aliased_angles.delta_t_elliptic(0)
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'expected 0.016708617 returned by Eot_aliased_angles.eccentricity_earth_orbit()? ' do
|
75
|
+
assert_equal 0.016708617, Eot_aliased_angles.eccentricity_earth_orbit()
|
76
|
+
assert_equal 0.016708617, Eot_aliased_angles.eccentricity_earth_orbit(nil)
|
77
|
+
assert_equal 0.016708617, Eot_aliased_angles.eccentricity_earth_orbit(0)
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'expected -1.227333353065282returned by Eot_aliased_angles.equation_of_center()? ' do
|
81
|
+
assert_equal -1.227333353065282, Eot_aliased_angles.equation_of_center()
|
82
|
+
assert_equal -1.227333353065282, Eot_aliased_angles.equation_of_center(nil)
|
83
|
+
assert_equal -1.227333353065282, Eot_aliased_angles.equation_of_center(0)
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'expected 280.4664567 returned by Eot_aliased_angles.geometric_mean_longitude()? ' do
|
87
|
+
assert_equal 280.4664567, Eot_aliased_angles.geometric_mean_longitude()
|
88
|
+
assert_equal 280.4664567, Eot_aliased_angles.geometric_mean_longitude(nil)
|
89
|
+
assert_equal 280.4664567, Eot_aliased_angles.geometric_mean_longitude(0)
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'expected 90.9060538240478 returned by Eot_aliased_angles.horizon_angle()? ' do
|
93
|
+
assert_equal 90.9060538240478, Eot_aliased_angles.horizon_angle()
|
94
|
+
assert_equal 90.9060538240478, Eot_aliased_angles.horizon_angle(nil)
|
95
|
+
assert_equal 90.9060538240478, Eot_aliased_angles.horizon_angle(0)
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'expected 220.63461047326172 returned by Eot_aliased_angles.mean_anomaly()? ' do
|
99
|
+
assert_equal 220.63461047326172, Eot_aliased_angles.mean_anomaly()
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'expected 280.460622404583 returned by Eot_aliased_angles.mean_longitude_aries()? ' do
|
103
|
+
assert_equal 280.460622404583, Eot_aliased_angles.mean_longitude_aries()
|
104
|
+
assert_equal 280.460622404583, Eot_aliased_angles.mean_longitude_aries(nil)
|
105
|
+
assert_equal 280.460622404583, Eot_aliased_angles.mean_longitude_aries(0)
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'expected 23.439279444444445 returned by Eot_aliased_angles.mean_obliquity()? ' do
|
109
|
+
assert_equal 23.439279444444445, Eot_aliased_angles.mean_obliquity()
|
110
|
+
assert_equal 23.439279444444445, Eot_aliased_angles.mean_obliquity(nil)
|
111
|
+
assert_equal 23.439279444444445, Eot_aliased_angles.mean_obliquity(0)
|
112
|
+
end
|
113
|
+
|
114
|
+
it 'expected 23.439279444444445 returned by Eot_aliased_angles.mean_obliquity_of_ecliptic()? ' do
|
115
|
+
assert_equal 23.439279444444445, Eot_aliased_angles.mean_obliquity_of_ecliptic()
|
116
|
+
assert_equal 23.439279444444445, Eot_aliased_angles.mean_obliquity_of_ecliptic(nil)
|
117
|
+
assert_equal 23.439279444444445, Eot_aliased_angles.mean_obliquity_of_ecliptic(0)
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'expected 23.43768541308359, returned by Eot_aliased_angles.obliquity_correction()? ' do
|
121
|
+
assert_equal 23.43768541308359, Eot_aliased_angles.obliquity_correction()
|
122
|
+
assert_equal 23.43768541308359, Eot_aliased_angles.obliquity_correction(nil)
|
123
|
+
assert_equal 23.43768541308359, Eot_aliased_angles.obliquity_correction(0)
|
124
|
+
end
|
125
|
+
|
126
|
+
it 'expected 280.0432759170521 returned by Eot_aliased_angles.right_ascension()? ' do
|
127
|
+
assert_equal 280.0432759170521, Eot_aliased_angles.right_ascension()
|
128
|
+
assert_equal 280.0432759170521, Eot_aliased_angles.right_ascension(nil)
|
129
|
+
assert_equal 280.0432759170521, Eot_aliased_angles.right_ascension(0)
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'expected -0.9870537600674456 returned by Eot_aliased_angles.sine_apparent_longitude()? ' do
|
133
|
+
assert_equal -0.9870537600674456, Eot_aliased_angles.sine_apparent_longitude()
|
134
|
+
assert_equal -0.9870537600674456, Eot_aliased_angles.sine_apparent_longitude(nil)
|
135
|
+
assert_equal -0.9870537600674456, Eot_aliased_angles.sine_apparent_longitude(0)
|
136
|
+
end
|
137
|
+
|
138
|
+
it 'expected -0.9870268630849643 returned by Eot_aliased_angles.sine_true_longitude()? ' do
|
139
|
+
assert_equal -0.9870268630849643, Eot_aliased_angles.sine_true_longitude()
|
140
|
+
assert_equal -0.9870268630849643, Eot_aliased_angles.sine_true_longitude(nil)
|
141
|
+
assert_equal -0.9870268630849643, Eot_aliased_angles.sine_true_longitude(0)
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'expected 219.40727712019643 returned by Eot_aliased_angles.true_anomaly()? ' do
|
145
|
+
assert_equal 219.40727712019643, Eot_aliased_angles.true_anomaly()
|
146
|
+
assert_equal 219.40727712019643, Eot_aliased_angles.true_anomaly(nil)
|
147
|
+
assert_equal 219.40727712019643, Eot_aliased_angles.true_anomaly(0)
|
148
|
+
end
|
149
|
+
|
150
|
+
it 'expected 279.2391233469347 returned by Eot_aliased_angles.true_longitude()? ' do
|
151
|
+
assert_equal 279.2391233469347, Eot_aliased_angles.true_longitude()
|
152
|
+
assert_equal 279.2391233469347, Eot_aliased_angles.true_longitude(nil)
|
153
|
+
assert_equal 279.2391233469347, Eot_aliased_angles.true_longitude(0)
|
154
|
+
end
|
155
|
+
|
156
|
+
it 'expected 280.45708542258194 returned by Eot_aliased_angles.true_longitude_aries()? ' do
|
157
|
+
assert_equal 280.45708542258194, Eot_aliased_angles.true_longitude_aries()
|
158
|
+
assert_equal 280.45708542258194, Eot_aliased_angles.true_longitude_aries(nil)
|
159
|
+
assert_equal 280.45708542258194, Eot_aliased_angles.true_longitude_aries(0)
|
160
|
+
end
|
161
|
+
|
162
|
+
it 'expected 23.43768541308359 returned by Eot_aliased_angles.true_obliquity()? ' do
|
163
|
+
assert_equal 23.43768541308359, Eot_aliased_angles.true_obliquity()
|
164
|
+
assert_equal 23.43768541308359, Eot_aliased_angles.true_obliquity(nil)
|
165
|
+
assert_equal 23.43768541308359, Eot_aliased_angles.true_obliquity(0)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
describe 'EOT angles tjc array for jd 2455055.5 a non default value' do
|
170
|
+
|
171
|
+
# set ma attribute first as it gets tested anyway but a lot of methods
|
172
|
+
# now rely on @ma so we don't have to keep calling it unless we change
|
173
|
+
# @ajd attribute
|
174
|
+
before(:each) do
|
175
|
+
@ajd = 2455055.0
|
176
|
+
Eot_aliased_angles.ajd = @ajd
|
177
|
+
@dt = Eot_aliased_angles.ajd_to_datetime(@ajd)
|
178
|
+
Eot_aliased_angles.date = @dt
|
179
|
+
Eot_aliased_angles.ma_Sun
|
180
|
+
@ta = Eot_aliased_angles.time_julian_century(@ajd)
|
181
|
+
end
|
182
|
+
|
183
|
+
it 'expected 2455055.0, returned by Eot_aliased_angles.' do
|
184
|
+
assert_equal 2455055.0, Eot_aliased_angles.ajd
|
185
|
+
end
|
186
|
+
|
187
|
+
it 'expected "2009-08-11T12:00:00+00:00", returned by Eot_aliased_angles.date.to_s' do
|
188
|
+
assert_equal "2009-08-11T12:00:00+00:00", Eot_aliased_angles.date.to_s
|
189
|
+
end
|
190
|
+
|
191
|
+
it 'expected 216.98609672514223, returned by Eot_aliased_angles.' do
|
192
|
+
assert_equal 216.98609672514223, Eot_aliased_angles.ma
|
193
|
+
end
|
194
|
+
|
195
|
+
it 'expected Eot_aliased_angles.ma returned by Eot_angles.mean_anomaly()' do
|
196
|
+
assert_equal Eot_aliased_angles.ma, Eot_aliased_angles.mean_anomaly()
|
197
|
+
end
|
198
|
+
|
199
|
+
it 'expected 138.95453031575755 returned by Eot_aliased_angles.apparent_longitude(@ta)? ' do
|
200
|
+
assert_equal 138.95453031575755, Eot_aliased_angles.apparent_longitude(@ta)
|
201
|
+
end
|
202
|
+
|
203
|
+
it 'expected -0.7541886969973313 returned by Eot_aliased_angles.cosine_apparent_longitude(@ta)? ' do
|
204
|
+
assert_equal -0.7541886969973313, Eot_aliased_angles.cosine_apparent_longitude(@ta)
|
205
|
+
end
|
206
|
+
|
207
|
+
it 'expected -0.7542060769934986 returned by Eot_aliased_angles.cosine_true_longitude(@ta)? ' do
|
208
|
+
assert_equal -0.7542060769934986, Eot_aliased_angles.cosine_true_longitude(@ta)
|
209
|
+
end
|
210
|
+
|
211
|
+
it 'expected 0.9174818406562965 returned by Eot_aliased_angles.cosine_true_obliquity(@ta)? ' do
|
212
|
+
assert_equal 0.9174818406562965, Eot_aliased_angles.cosine_true_obliquity(@ta)
|
213
|
+
end
|
214
|
+
|
215
|
+
it 'expected 15.141502782959178 returned by Eot_aliased_angles.declination(@ta)? ' do
|
216
|
+
assert_equal 15.141502782959178, Eot_aliased_angles.declination(@ta)
|
217
|
+
end
|
218
|
+
|
219
|
+
it 'expected -2.42490431188628 returned by Eot_aliased_angles.delta_t_ecliptic(@ta)? ' do
|
220
|
+
assert_equal -2.42490431188628, Eot_aliased_angles.delta_t_ecliptic(@ta)
|
221
|
+
end
|
222
|
+
|
223
|
+
it 'expected 1.1326466587538278 returned by Eot_aliased_angles.delta_t_elliptic(@ta)? ' do
|
224
|
+
assert_equal 1.1326466587538278, Eot_aliased_angles.delta_t_elliptic(@ta)
|
225
|
+
end
|
226
|
+
|
227
|
+
it 'expected 0.016704576164208475 returned by Eot_aliased_angles.eccentricity_earth_orbit(@ta)? ' do
|
228
|
+
assert_equal 0.016704576164208475, Eot_aliased_angles.eccentricity_earth_orbit(@ta)
|
229
|
+
end
|
230
|
+
|
231
|
+
it 'expected -1.1326466587538162 returned by Eot_aliased_angles.equation_of_center(@ta)? ' do
|
232
|
+
assert_equal -1.1326466587538162, Eot_aliased_angles.equation_of_center(@ta)
|
233
|
+
end
|
234
|
+
|
235
|
+
it 'expected 140.08869346549056 returned by Eot_aliased_angles.geometric_mean_longitude(@ta)? ' do
|
236
|
+
assert_equal 140.08869346549056, Eot_aliased_angles.geometric_mean_longitude(@ta)
|
237
|
+
end
|
238
|
+
|
239
|
+
it 'expected 90.86327177163999 returned by Eot_aliased_angles.horizon_angle(@ta)? ' do
|
240
|
+
assert_equal 90.86327177163999, Eot_aliased_angles.horizon_angle(@ta)
|
241
|
+
end
|
242
|
+
|
243
|
+
it 'expected 216.98609672514223 returned by Eot_aliased_angles.mean_anomaly()? ' do
|
244
|
+
assert_equal 216.98609672514223, Eot_aliased_angles.mean_anomaly()
|
245
|
+
end
|
246
|
+
|
247
|
+
it 'expected 140.08287431273857 returned by Eot_aliased_angles.mean_longitude_aries(@ta)? ' do
|
248
|
+
assert_equal 140.08287431273857, Eot_aliased_angles.mean_longitude_aries(@ta)
|
249
|
+
end
|
250
|
+
|
251
|
+
it 'expected 23.43802918164109 returned by Eot_aliased_angles.mean_obliquity(@ta)? ' do
|
252
|
+
assert_equal 23.43802918164109, Eot_aliased_angles.mean_obliquity(@ta)
|
253
|
+
end
|
254
|
+
|
255
|
+
it 'expected 23.439323003379247 returned by Eot_aliased_angles.obliquity_correction(@ta)? ' do
|
256
|
+
assert_equal 23.439323003379247, Eot_aliased_angles.obliquity_correction(@ta)
|
257
|
+
end
|
258
|
+
|
259
|
+
it 'expected 141.38095111862302 returned by Eot_aliased_angles.right_ascension(@ta)? ' do
|
260
|
+
assert_equal 141.38095111862302, Eot_aliased_angles.right_ascension(@ta)
|
261
|
+
end
|
262
|
+
|
263
|
+
it 'expected 0.6566577566141039 returned by Eot_aliased_angles.sine_apparent_longitude(@ta)? ' do
|
264
|
+
assert_equal 0.6566577566141039, Eot_aliased_angles.sine_apparent_longitude(@ta)
|
265
|
+
end
|
266
|
+
|
267
|
+
it 'expected 0.6566377946981706 returned by Eot_aliased_angles.sine_true_longitude(@ta)? ' do
|
268
|
+
assert_equal 0.6566377946981706, Eot_aliased_angles.sine_true_longitude(@ta)
|
269
|
+
end
|
270
|
+
|
271
|
+
it 'expected 215.8534500663884 returned by Eot_aliased_angles.true_anomaly(@ta)? ' do
|
272
|
+
assert_equal 215.8534500663884, Eot_aliased_angles.true_anomaly(@ta)
|
273
|
+
end
|
274
|
+
|
275
|
+
it 'expected 138.95604680673674 returned by Eot_aliased_angles.true_longitude(@ta)? ' do
|
276
|
+
assert_equal 138.95604680673674, Eot_aliased_angles.true_longitude(@ta)
|
277
|
+
end
|
278
|
+
|
279
|
+
it 'expected 140.08689002538767 returned by Eot_aliased_angles.true_longitude_aries(@ta)? ' do
|
280
|
+
assert_equal 140.08689002538767, Eot_aliased_angles.true_longitude_aries(@ta)
|
281
|
+
end
|
282
|
+
|
283
|
+
it 'expected 23.439323003379247 returned by Eot_aliased_angles.true_obliquity(@ta)? ' do
|
284
|
+
assert_equal 23.439323003379247, Eot_aliased_angles.true_obliquity(@ta)
|
285
|
+
end
|
286
|
+
|
287
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# aliased_displays_spec.rb
|
2
|
+
#
|
3
|
+
# uncomment below for minitest
|
4
|
+
gem 'minitest'
|
5
|
+
require 'minitest/autorun'
|
6
|
+
# require_relative '../spec_config'
|
7
|
+
lib = File.expand_path('../../../lib', __FILE__)
|
8
|
+
# puts "Loading gem from #{lib}/eot.rb"
|
9
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
10
|
+
require 'eot'
|
11
|
+
|
12
|
+
Eot_aliased_displays = Eot.new
|
13
|
+
|
14
|
+
describe 'assert_equal Eot aliased_displays default, nil' do
|
15
|
+
|
16
|
+
# set ma attribute first as it gets tested anyway but a lot of methods
|
17
|
+
# now rely on @ma so we don't have to keep calling it unless we change
|
18
|
+
# @ajd attribute.
|
19
|
+
|
20
|
+
before(:each) do
|
21
|
+
@ajd = 2456885.0
|
22
|
+
Eot_aliased_displays.ajd = @ajd
|
23
|
+
Eot_aliased_displays.mean_anomaly()
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'expected 2456885.0 for Eot_aliased_displays.ajd' do
|
27
|
+
assert_equal 2456885.0, Eot_aliased_displays.ajd
|
28
|
+
assert_equal 220.63461047326172, Eot_aliased_displays.ma
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'expected "+279:13:46.271" returned by Eot_aliased_displays.apparent_longitude_string()? ' do
|
32
|
+
assert_equal "+279:13:46.271", Eot_aliased_displays.apparent_longitude_string()
|
33
|
+
assert_equal "+279:13:46.271", Eot_aliased_displays.apparent_longitude_string(nil)
|
34
|
+
assert_equal "+279:13:46.271", Eot_aliased_displays.apparent_longitude_string(0)
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'expected "-023:06:59.415" returned by Eot_aliased_displays.declination_string()? ' do
|
38
|
+
assert_equal "-023:06:59.415", Eot_aliased_displays.declination_string()
|
39
|
+
assert_equal "-023:06:59.415", Eot_aliased_displays.declination_string(nil)
|
40
|
+
assert_equal "-023:06:59.415", Eot_aliased_displays.declination_string(0)
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'expected "-04m, 28.9s" returned by Eot_aliased_displays.display_equation_of_time()? ' do
|
44
|
+
assert_equal "-04m, 28.9s", Eot_aliased_displays.display_equation_of_time()
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'expected "12:00:00.000" returned by Eot_aliased_displays.display_time_string()? ' do
|
48
|
+
assert_equal "12:00:00.000", Eot_aliased_displays.display_time_string()
|
49
|
+
assert_equal "12:00:00.000", Eot_aliased_displays.display_time_string(nil)
|
50
|
+
assert_equal "12:00:00.000", Eot_aliased_displays.display_time_string(0)
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'expected "2000-01-01" returned by Eot_aliased_displays.jd_to_date_string()? ' do
|
54
|
+
assert_equal "2000-01-01", Eot_aliased_displays.jd_to_date_string()
|
55
|
+
assert_equal "2000-01-01", Eot_aliased_displays.jd_to_date_string(nil)
|
56
|
+
assert_equal "2000-01-01", Eot_aliased_displays.jd_to_date_string(0)
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'expected "12:00:00" returned by Eot_aliased_displays.julian_period_day_fraction_to_time()? ' do
|
60
|
+
assert_equal "12:00:00", Eot_aliased_displays.julian_period_day_fraction_to_time()
|
61
|
+
assert_equal "12:00:00", Eot_aliased_displays.julian_period_day_fraction_to_time(nil)
|
62
|
+
assert_equal "12:00:00", Eot_aliased_displays.julian_period_day_fraction_to_time(0)
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'expected "+220:38:04.597" returned by Eot_aliased_displays.mean_anomaly_string()? ' do
|
66
|
+
assert_equal "+220:38:04.597", Eot_aliased_displays.mean_anomaly_string()
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'expected "+280:02:35.793" returned by Eot_aliased_displays.right_ascension_string()? ' do
|
70
|
+
assert_equal "+280:02:35.793", Eot_aliased_displays.right_ascension_string()
|
71
|
+
assert_equal "+280:02:35.793", Eot_aliased_displays.right_ascension_string(nil)
|
72
|
+
assert_equal "+280:02:35.793", Eot_aliased_displays.right_ascension_string(0)
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'expected "+219:24:26.197" returned by Eot_aliased_displays.true_anomaly_string()? ' do
|
76
|
+
assert_equal "+219:24:26.197", Eot_aliased_displays.true_anomaly_string()
|
77
|
+
assert_equal "+219:24:26.197", Eot_aliased_displays.true_anomaly_string(nil)
|
78
|
+
assert_equal "+219:24:26.197", Eot_aliased_displays.true_anomaly_string(0)
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'expected "+279:14:20.844" returned by Eot_aliased_displays.true_longitude_string()? ' do
|
82
|
+
assert_equal "+279:14:20.844", Eot_aliased_displays.true_longitude_string()
|
83
|
+
assert_equal "+279:14:20.844", Eot_aliased_displays.true_longitude_string(nil)
|
84
|
+
assert_equal "+279:14:20.844", Eot_aliased_displays.true_longitude_string(0)
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'expected "+023:26:15.667" returned by Eot_aliased_displays.true_obliquity_string()? ' do
|
88
|
+
assert_equal "+023:26:15.667", Eot_aliased_displays.true_obliquity_string()
|
89
|
+
assert_equal "+023:26:15.667", Eot_aliased_displays.true_obliquity_string(nil)
|
90
|
+
assert_equal "+023:26:15.667", Eot_aliased_displays.true_obliquity_string(0)
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
describe 'Eot aliased displays explicit values' do
|
96
|
+
|
97
|
+
it 'expected "16:40:40.800" returned by Eot_aliased_displays.display_time_string(16.6780)? ' do
|
98
|
+
assert_equal "16:40:40.800", Eot_aliased_displays.display_time_string(16.6780)
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'expected "17:59:16.800" returned by Eot_aliased_displays.display_time_string(17988)? ' do
|
102
|
+
Eot_aliased_displays.date = Date.today.to_s
|
103
|
+
assert_equal "17:59:16.800", Eot_aliased_displays.display_time_string(17.988)
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|