equationoftime 4.1.4 → 4.1.5
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/Gemfile +3 -3
- data/Gemfile.lock +17 -6
- data/Manifest.txt +1 -1
- data/README.rdoc +18 -2
- data/Rakefile +2 -2
- data/equationoftime.gemspec +1 -1
- data/examples/my_lst.rb +2 -2
- data/ext/eot/ceot.c +123 -21
- data/ext/eot/ceot.h +11 -1
- data/ext/eot/eot.c +60 -0
- data/lib/eot/angles.rb +2 -2
- data/lib/eot/constants.rb +4 -4
- data/lib/eot/init.rb +2 -2
- data/lib/eot/times.rb +2 -2
- data/lib/eot/{trigometric.rb → trigonometric.rb} +6 -6
- data/lib/eot/version.rb +1 -1
- data/lib/eot.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3548bdc8e0b497b9d4db22274c1cba9c31f2705f
|
|
4
|
+
data.tar.gz: 7a7045370ba55b1f21c143514a52d1ba4b7a928a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cb8d7bbd702b98551b247b0574e9cf3ec1cc08f209f9ffc0d65f07a5dad6ec69bbc4ccfe6c746870d1f9959fd1cb316180f4834e09b628710e6d1ebb00c91953
|
|
7
|
+
data.tar.gz: 67c10e32092d3cbb9441c0052580eb58a573199ddcafeac4bf05ed185366a8273eb2c11f69366c411488f5f5fbb09d78a502ad1f7c623b2b337ff7027bff8039
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/Gemfile
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
source 'https://rubygems.org'
|
|
2
2
|
ruby '2.1.2'
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
gemspec
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
group :development do
|
|
7
|
-
gem '
|
|
7
|
+
gem 'rubocop'
|
|
8
8
|
gem 'hoe'
|
|
9
9
|
gem 'rake'
|
|
10
10
|
gem 'rake-compiler', '~> 0.9.3'
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
equationoftime (4.1.
|
|
4
|
+
equationoftime (4.1.5)
|
|
5
5
|
addressable (~> 2.3.6)
|
|
6
6
|
celes (~> 0.0.1)
|
|
7
7
|
rest-client
|
|
@@ -11,6 +11,9 @@ GEM
|
|
|
11
11
|
specs:
|
|
12
12
|
ZenTest (4.10.1)
|
|
13
13
|
addressable (2.3.6)
|
|
14
|
+
ast (2.0.0)
|
|
15
|
+
astrolabe (1.3.0)
|
|
16
|
+
parser (>= 2.2.0.pre.3, < 3.0)
|
|
14
17
|
celes (0.0.1)
|
|
15
18
|
celluloid (0.16.0)
|
|
16
19
|
timers (~> 4.0.0)
|
|
@@ -40,11 +43,15 @@ GEM
|
|
|
40
43
|
mime-types (2.3)
|
|
41
44
|
minitest (5.4.1)
|
|
42
45
|
netrc (0.7.7)
|
|
46
|
+
parser (2.2.0.pre.4)
|
|
47
|
+
ast (>= 1.1, < 3.0)
|
|
48
|
+
slop (~> 3.4, >= 3.4.5)
|
|
49
|
+
powerpack (0.0.9)
|
|
43
50
|
pry (0.10.1)
|
|
44
51
|
coderay (~> 1.1.0)
|
|
45
52
|
method_source (~> 0.8.1)
|
|
46
53
|
slop (~> 3.4)
|
|
47
|
-
|
|
54
|
+
rainbow (2.0.0)
|
|
48
55
|
rake (10.3.2)
|
|
49
56
|
rake-compiler (0.9.3)
|
|
50
57
|
rake
|
|
@@ -56,8 +63,6 @@ GEM
|
|
|
56
63
|
rest-client (1.7.2)
|
|
57
64
|
mime-types (>= 1.16, < 3.0)
|
|
58
65
|
netrc (~> 0.7)
|
|
59
|
-
robocop (0.1.1)
|
|
60
|
-
rack
|
|
61
66
|
rspec (3.1.0)
|
|
62
67
|
rspec-core (~> 3.1.0)
|
|
63
68
|
rspec-expectations (~> 3.1.0)
|
|
@@ -70,6 +75,13 @@ GEM
|
|
|
70
75
|
rspec-mocks (3.1.0)
|
|
71
76
|
rspec-support (~> 3.1.0)
|
|
72
77
|
rspec-support (3.1.0)
|
|
78
|
+
rubocop (0.26.1)
|
|
79
|
+
astrolabe (~> 1.3)
|
|
80
|
+
parser (>= 2.2.0.pre.4, < 3.0)
|
|
81
|
+
powerpack (~> 0.0.6)
|
|
82
|
+
rainbow (>= 1.99.1, < 3.0)
|
|
83
|
+
ruby-progressbar (~> 1.4)
|
|
84
|
+
ruby-progressbar (1.6.0)
|
|
73
85
|
slop (3.6.0)
|
|
74
86
|
thor (0.19.1)
|
|
75
87
|
timers (4.0.1)
|
|
@@ -81,7 +93,6 @@ PLATFORMS
|
|
|
81
93
|
|
|
82
94
|
DEPENDENCIES
|
|
83
95
|
ZenTest
|
|
84
|
-
addressable
|
|
85
96
|
bundler (~> 1.7)
|
|
86
97
|
equationoftime!
|
|
87
98
|
guard
|
|
@@ -91,6 +102,6 @@ DEPENDENCIES
|
|
|
91
102
|
rake
|
|
92
103
|
rake-compiler (~> 0.9.3)
|
|
93
104
|
rdoc
|
|
94
|
-
robocop
|
|
95
105
|
rspec
|
|
106
|
+
rubocop
|
|
96
107
|
yard
|
data/Manifest.txt
CHANGED
data/README.rdoc
CHANGED
|
@@ -20,8 +20,20 @@ Lots of examples to play with for learning about Eot.
|
|
|
20
20
|
$ irb --simple-prompt
|
|
21
21
|
|
|
22
22
|
require 'eot'
|
|
23
|
-
eot = Eot.new
|
|
24
|
-
eot.string_eot
|
|
23
|
+
eot = Eot.new
|
|
24
|
+
eot.string_eot # todays eot
|
|
25
|
+
eot.addr # what is the location
|
|
26
|
+
eot.addr = "huston, tx" #changed location
|
|
27
|
+
geo = GeoLatLng.new
|
|
28
|
+
geo.addr = eot.addr # set new location
|
|
29
|
+
geo.set_coordinates # set new coordinates
|
|
30
|
+
eot.sunrise_jd # todays sunrise as a jd
|
|
31
|
+
eot.sunset_jd # todays sunset as a jd
|
|
32
|
+
eot.sunrise_dt # todays sunrise as DateTime
|
|
33
|
+
eot.sunset_dt # todays sunset as a DateTime
|
|
34
|
+
eot.ajd += 1 # tommorrow times can be read
|
|
35
|
+
eot.ajd = 2451545 # ajd set to 2001-01-01 12:00
|
|
36
|
+
|
|
25
37
|
|
|
26
38
|
== REQUIREMENTS:
|
|
27
39
|
|
|
@@ -37,6 +49,10 @@ After checking out the source, run:
|
|
|
37
49
|
|
|
38
50
|
$ rake newb
|
|
39
51
|
|
|
52
|
+
Or use patch to install as gem
|
|
53
|
+
|
|
54
|
+
$ gem install eot
|
|
55
|
+
|
|
40
56
|
This task will install any missing dependencies, run the tests/specs,
|
|
41
57
|
and generate the RDoc.
|
|
42
58
|
|
data/Rakefile
CHANGED
|
@@ -7,11 +7,11 @@ require 'rake/testtask'
|
|
|
7
7
|
require 'rdoc/task'
|
|
8
8
|
require 'rspec/core/rake_task'
|
|
9
9
|
require 'yard'
|
|
10
|
-
# rake release VERSION=4.1.
|
|
10
|
+
# rake release VERSION=4.1.5
|
|
11
11
|
Hoe.spec 'equationoftime' do
|
|
12
12
|
developer('Douglas Allen', 'kb9agt@gmail.com')
|
|
13
13
|
license('MIT')
|
|
14
|
-
self.version = '4.1.
|
|
14
|
+
self.version = '4.1.5'
|
|
15
15
|
self.readme_file = 'README.rdoc'
|
|
16
16
|
self.history_file = 'CHANGELOG.rdoc'
|
|
17
17
|
self.extra_rdoc_files = FileList['*.rdoc']
|
data/equationoftime.gemspec
CHANGED
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
|
12
12
|
spec.email = ['kb9agt@gmail.com']
|
|
13
13
|
spec.summary = 'Equation of Time calculates time of solar transition.'
|
|
14
14
|
spec.description = 'Calculate Sunrise and Sunset. Uses native C wrappers.
|
|
15
|
-
|
|
15
|
+
Use the patch "gem install eot" to install it.'
|
|
16
16
|
# spec.homepage = "http://equationoftime.herokuapp.com"
|
|
17
17
|
spec.homepage = 'https://github.com/DouglasAllen/equationoftime'
|
|
18
18
|
spec.license = 'MIT'
|
data/examples/my_lst.rb
CHANGED
|
@@ -4,6 +4,6 @@ puts 'My Local Apparent Sidereal Time'
|
|
|
4
4
|
loop do
|
|
5
5
|
eot.ajd = DateTime.now.to_time.utc.to_datetime.ajd
|
|
6
6
|
puts "LST = #{ eot.string_time(((eot.tl_aries * Eot::R2D) + -88.75) / 15.0) }"
|
|
7
|
-
|
|
8
|
-
sleep
|
|
7
|
+
# the number is syncing my machine. machine may vary in this.
|
|
8
|
+
sleep 0.99613381875
|
|
9
9
|
end
|
data/ext/eot/ceot.c
CHANGED
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
double mlSun(double t)
|
|
5
|
-
{
|
|
5
|
+
{
|
|
6
6
|
double a;
|
|
7
7
|
|
|
8
8
|
/* Mean geocentric longitude of the Sun */
|
|
9
9
|
a = fmod( 280.4664567 +
|
|
10
10
|
t * ( 36000.76982779 +
|
|
11
11
|
t * ( 0.0003032028 +
|
|
12
|
-
t * ( 1.0/499310.0 +
|
|
13
|
-
t * ( 1.0/-152990.0 +
|
|
14
|
-
t * (1.0/-19880000.0 ) ) ) ) ), 360.0 ) * 0.017453292519943295769236907684886;
|
|
15
|
-
|
|
12
|
+
t * ( 1.0/499310.0 +
|
|
13
|
+
t * ( 1.0/-152990.0 +
|
|
14
|
+
t * (1.0/-19880000.0 ) ) ) ) ), 360.0 ) * 0.017453292519943295769236907684886;
|
|
15
|
+
|
|
16
16
|
return a;
|
|
17
|
-
}
|
|
17
|
+
}
|
|
18
18
|
|
|
19
19
|
double eoe(double t)
|
|
20
20
|
{
|
|
@@ -27,9 +27,9 @@ double eoe(double t)
|
|
|
27
27
|
|
|
28
28
|
return e;
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
double eqc(double ma, double t)
|
|
32
|
-
{
|
|
30
|
+
|
|
31
|
+
double eqc(double ma, double t)
|
|
32
|
+
{
|
|
33
33
|
double a1, a2, a3, a4, a5, s1, s2, s3, s4, s5, e;
|
|
34
34
|
e = eoe(t);
|
|
35
35
|
s1 = sin( 1.0 * ma );
|
|
@@ -41,14 +41,14 @@ double eqc(double ma, double t)
|
|
|
41
41
|
a2 = s2 * 5.0/4.0;
|
|
42
42
|
a3 = s3 * 13.0/12.0 - s1 * 1.0/4.0;
|
|
43
43
|
a4 = s4 * 103.0/96.0 - s2 * 11.0/24.0;
|
|
44
|
-
a5 = s5 * 1097.0/960.0 + s1 * 5.0/96.0 - s3 * 43.0/64.0;
|
|
45
|
-
/* Equation of Center */
|
|
46
|
-
//a = s1 * (e * 2.0 - e3 * 1.0/4.0 + e5 * 5.0/96.0) +
|
|
47
|
-
// s2 * (e2 * 5.0/4.0 - 0.0 - e4 * 11.0/24.0) +
|
|
48
|
-
// s3 * (e3 * 13.0/12.0 - 0.0 - e5 * 43.0/64.0) +
|
|
49
|
-
// s4 * e4 * 103.0/96.0 +
|
|
50
|
-
// s5 * e5 * 1097.0/960.0;
|
|
51
|
-
return e * (a1 + e * (a2 + e * (a3 + e * (a4 + e * a5))));
|
|
44
|
+
a5 = s5 * 1097.0/960.0 + s1 * 5.0/96.0 - s3 * 43.0/64.0;
|
|
45
|
+
/* Equation of Center */
|
|
46
|
+
//a = s1 * (e * 2.0 - e3 * 1.0/4.0 + e5 * 5.0/96.0) +
|
|
47
|
+
// s2 * (e2 * 5.0/4.0 - 0.0 - e4 * 11.0/24.0) +
|
|
48
|
+
// s3 * (e3 * 13.0/12.0 - 0.0 - e5 * 43.0/64.0) +
|
|
49
|
+
// s4 * e4 * 103.0/96.0 +
|
|
50
|
+
// s5 * e5 * 1097.0/960.0;
|
|
51
|
+
return e * (a1 + e * (a2 + e * (a3 + e * (a4 + e * a5))));
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
double tlSun(double ma, double t)
|
|
@@ -75,9 +75,111 @@ double alSun(double ma, double t, double o)
|
|
|
75
75
|
double cosZ(double zenith)
|
|
76
76
|
{
|
|
77
77
|
|
|
78
|
-
double
|
|
78
|
+
double ca;
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
ca = cos(zenith * 0.017453292519943295769236907684886);
|
|
81
81
|
|
|
82
|
-
return
|
|
83
|
-
}
|
|
82
|
+
return ca;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
double cos_al_sun(double al_sun)
|
|
86
|
+
{
|
|
87
|
+
|
|
88
|
+
double ca;
|
|
89
|
+
|
|
90
|
+
ca = cos(al_sun);
|
|
91
|
+
|
|
92
|
+
return ca;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
double cos_dec_sun(double dec_sun)
|
|
96
|
+
{
|
|
97
|
+
|
|
98
|
+
double ca;
|
|
99
|
+
|
|
100
|
+
ca = cos(dec_sun);
|
|
101
|
+
|
|
102
|
+
return ca;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
double cos_lat(double lat)
|
|
106
|
+
{
|
|
107
|
+
|
|
108
|
+
double ca;
|
|
109
|
+
|
|
110
|
+
ca = cos(lat);
|
|
111
|
+
|
|
112
|
+
return ca;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
double cos_tl_sun(double tl_sun)
|
|
116
|
+
{
|
|
117
|
+
|
|
118
|
+
double ca;
|
|
119
|
+
|
|
120
|
+
ca = cos(tl_sun);
|
|
121
|
+
|
|
122
|
+
return ca;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
double cos_to_earth(double to_earth)
|
|
126
|
+
{
|
|
127
|
+
|
|
128
|
+
double ca;
|
|
129
|
+
|
|
130
|
+
ca = cos(to_earth);
|
|
131
|
+
|
|
132
|
+
return ca;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
double sin_al_sun(double al_sun)
|
|
136
|
+
{
|
|
137
|
+
|
|
138
|
+
double sa;
|
|
139
|
+
|
|
140
|
+
sa = sin(al_sun);
|
|
141
|
+
|
|
142
|
+
return sa;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
double sin_dec_sun(double dec_sun)
|
|
146
|
+
{
|
|
147
|
+
|
|
148
|
+
double sa;
|
|
149
|
+
|
|
150
|
+
sa = sin(dec_sun);
|
|
151
|
+
|
|
152
|
+
return sa;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
double sin_lat(double lat)
|
|
156
|
+
{
|
|
157
|
+
|
|
158
|
+
double sa;
|
|
159
|
+
|
|
160
|
+
sa = sin(lat);
|
|
161
|
+
|
|
162
|
+
return sa;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
double sin_tl_sun(double tl_sun)
|
|
166
|
+
{
|
|
167
|
+
|
|
168
|
+
double sa;
|
|
169
|
+
|
|
170
|
+
sa = sin(tl_sun);
|
|
171
|
+
|
|
172
|
+
return sa;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
double sin_to_earth(double to_earth)
|
|
176
|
+
{
|
|
177
|
+
|
|
178
|
+
double sa;
|
|
179
|
+
|
|
180
|
+
sa = sin(to_earth);
|
|
181
|
+
|
|
182
|
+
return sa;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
|
data/ext/eot/ceot.h
CHANGED
|
@@ -5,4 +5,14 @@ double eoe(double t);
|
|
|
5
5
|
double eqc(double ma, double t);
|
|
6
6
|
double tlSun(double ma, double t);
|
|
7
7
|
double alSun(double ma, double t, double o);
|
|
8
|
-
double cosZ(double zenith);
|
|
8
|
+
double cosZ(double zenith);
|
|
9
|
+
double cos_al_sun(double al_sun);
|
|
10
|
+
double cos_tl_sun(double tl_sun);
|
|
11
|
+
double cos_to_earth(double to_earth);
|
|
12
|
+
double sin_al_sun(double al_sun);
|
|
13
|
+
double sin_tl_sun(double tl_sun);
|
|
14
|
+
double sin_to_earth(double to_earth);
|
|
15
|
+
double sin_dec_sun(double dec_sun);
|
|
16
|
+
double cos_dec_sun(double dec_sun);
|
|
17
|
+
double sin_lat(double lat);
|
|
18
|
+
double cos_lat(double lat);
|
data/ext/eot/eot.c
CHANGED
|
@@ -37,6 +37,56 @@ VALUE func_cosZ(VALUE klass, VALUE vz) {
|
|
|
37
37
|
return DBL2NUM(cosZ(NUM2DBL(vz)));
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
VALUE func_cos_al_sun(VALUE klass, VALUE vals) {
|
|
41
|
+
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
42
|
+
return DBL2NUM(cos_al_sun(NUM2DBL(vals)));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
VALUE func_cos_tl_sun(VALUE klass, VALUE vtls) {
|
|
46
|
+
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
47
|
+
return DBL2NUM(cos_al_sun(NUM2DBL(vtls)));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
VALUE func_cos_to_earth(VALUE klass, VALUE vtoe) {
|
|
51
|
+
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
52
|
+
return DBL2NUM(cos_to_earth(NUM2DBL(vtoe)));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
VALUE func_sin_al_sun(VALUE klass, VALUE vals) {
|
|
56
|
+
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
57
|
+
return DBL2NUM(sin_al_sun(NUM2DBL(vals)));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
VALUE func_sin_tl_sun(VALUE klass, VALUE vtls) {
|
|
61
|
+
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
62
|
+
return DBL2NUM(sin_al_sun(NUM2DBL(vtls)));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
VALUE func_sin_to_earth(VALUE klass, VALUE vtoe) {
|
|
66
|
+
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
67
|
+
return DBL2NUM(sin_to_earth(NUM2DBL(vtoe)));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
VALUE func_sin_dec_sun(VALUE klass, VALUE vds) {
|
|
71
|
+
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
72
|
+
return DBL2NUM(sin_dec_sun(NUM2DBL(vds)));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
VALUE func_cos_dec_sun(VALUE klass, VALUE vds) {
|
|
76
|
+
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
77
|
+
return DBL2NUM(cos_dec_sun(NUM2DBL(vds)));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
VALUE func_sin_lat(VALUE klass, VALUE vlat) {
|
|
81
|
+
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
82
|
+
return DBL2NUM(sin_lat(NUM2DBL(vlat)));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
VALUE func_cos_lat(VALUE klass, VALUE vlat) {
|
|
86
|
+
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
87
|
+
return DBL2NUM(cos_lat(NUM2DBL(vlat)));
|
|
88
|
+
}
|
|
89
|
+
|
|
40
90
|
VALUE cEot;
|
|
41
91
|
void
|
|
42
92
|
Init_eot(void) {
|
|
@@ -49,4 +99,14 @@ Init_eot(void) {
|
|
|
49
99
|
rb_define_method(cEot, "tl", func_tl, 2);
|
|
50
100
|
rb_define_method(cEot, "al", func_al, 3);
|
|
51
101
|
rb_define_method(cEot, "cosZ", func_cosZ, 1);
|
|
102
|
+
rb_define_method(cEot, "cos_al_sun", func_cos_al_sun, 1);
|
|
103
|
+
rb_define_method(cEot, "cos_tl_sun", func_cos_tl_sun, 1);
|
|
104
|
+
rb_define_method(cEot, "cos_to_earth", func_cos_to_earth, 1);
|
|
105
|
+
rb_define_method(cEot, "sin_al_sun", func_sin_al_sun, 1);
|
|
106
|
+
rb_define_method(cEot, "sin_tl_sun", func_sin_tl_sun, 1);
|
|
107
|
+
rb_define_method(cEot, "sin_to_earth", func_sin_to_earth, 1);
|
|
108
|
+
rb_define_method(cEot, "cos_dec_sun", func_cos_dec_sun, 1);
|
|
109
|
+
rb_define_method(cEot, "sin_dec_sun", func_sin_dec_sun, 1);
|
|
110
|
+
rb_define_method(cEot, "cos_lat", func_cos_lat, 1);
|
|
111
|
+
rb_define_method(cEot, "sin_lat", func_sin_lat, 1);
|
|
52
112
|
}
|
data/lib/eot/angles.rb
CHANGED
|
@@ -56,8 +56,8 @@ class Eot
|
|
|
56
56
|
# used for angles from transit to horizons
|
|
57
57
|
def ha_sun
|
|
58
58
|
zenith = 90.8333 # use other zeniths here for non commercial
|
|
59
|
-
top = cosZ(zenith) -
|
|
60
|
-
bottom =
|
|
59
|
+
top = cosZ(zenith) - sin_dec_sun(dec_sun) * sin_lat(@latitude * D2R)
|
|
60
|
+
bottom = cos_dec_sun(dec_sun) * cos_lat(@latitude * D2R)
|
|
61
61
|
t_cosine = top / bottom
|
|
62
62
|
t_cosine > 1.0 || t_cosine < -1.0 ? cos = 1.0 : cos = t_cosine
|
|
63
63
|
acos(cos)
|
data/lib/eot/constants.rb
CHANGED
|
@@ -121,14 +121,14 @@ class Eot
|
|
|
121
121
|
|
|
122
122
|
# Julian Date of Modified Julian Date zero
|
|
123
123
|
# 1858, 11, 17, 0.0 midnight start of calendar reform = 2400000.5
|
|
124
|
-
# MJD0 = 2400000.5
|
|
125
|
-
|
|
126
|
-
# 2Pi from Math module = Math::PI * 2.0
|
|
127
|
-
# P2 = PI * 2.0
|
|
124
|
+
# MJD0 = 2400000.5
|
|
128
125
|
|
|
129
126
|
# from desktop calculator PI = 3.1415926535897932384626433832795
|
|
130
127
|
PI = 3.1415926535897932384626433832795
|
|
131
128
|
|
|
129
|
+
# 2Pi from Math module = Math::PI * 2.0
|
|
130
|
+
P2 = PI * 2.0
|
|
131
|
+
|
|
132
132
|
# from desktop calculator R2D = 57.295779513082320876798154814105
|
|
133
133
|
R2D = 57.295779513082320876798154814105
|
|
134
134
|
|
data/lib/eot/init.rb
CHANGED
|
@@ -9,9 +9,10 @@ class Eot
|
|
|
9
9
|
# ajd or jd. Use ajd for time now and jd for suntimes. Initially
|
|
10
10
|
# @ajd = DateTime.now.to_time.utc.to_datetime.jd.to_f
|
|
11
11
|
attr_reader :ajd
|
|
12
|
+
|
|
12
13
|
def ajd=(ajd)
|
|
13
14
|
@ajd = ajd
|
|
14
|
-
@ta = ((
|
|
15
|
+
@ta = ((ajd - DJ00) / DJC).to_f
|
|
15
16
|
@ma = Celes.falp03(@ta)
|
|
16
17
|
end
|
|
17
18
|
|
|
@@ -52,7 +53,6 @@ class Eot
|
|
|
52
53
|
# Initialize to set attributes
|
|
53
54
|
# You may use GeoLatLng to set up @latitude and @longitude
|
|
54
55
|
def initialize
|
|
55
|
-
require_relative 'geo_lat_lng_smt'
|
|
56
56
|
@geo = GeoLatLng.new
|
|
57
57
|
@addr = @geo.default_int
|
|
58
58
|
@geo.addr = @addr
|
data/lib/eot/times.rb
CHANGED
|
@@ -48,7 +48,7 @@ class Eot
|
|
|
48
48
|
# Uses @ajd attribute
|
|
49
49
|
# Returns Sunrise as a Julian Day Number
|
|
50
50
|
def sunrise_jd
|
|
51
|
-
local_noon_dt.ajd - ha_sun
|
|
51
|
+
local_noon_dt.ajd - ha_sun / P2
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
# From times.rb:
|
|
@@ -62,7 +62,7 @@ class Eot
|
|
|
62
62
|
# Uses @ajd attribute
|
|
63
63
|
# Returns Sunset as a Julian Day Number
|
|
64
64
|
def sunset_jd
|
|
65
|
-
local_noon_dt.ajd + ha_sun
|
|
65
|
+
local_noon_dt.ajd + ha_sun / P2
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
# From times.rb:
|
|
@@ -5,7 +5,7 @@ class Eot
|
|
|
5
5
|
# cosine apparent longitude
|
|
6
6
|
# could be useful when dividing
|
|
7
7
|
def cosine_al_sun
|
|
8
|
-
|
|
8
|
+
cos_al_sun(al(@ma, @ta, Celes.faom03(@ta)))
|
|
9
9
|
end
|
|
10
10
|
alias_method :cosine_apparent_longitude, :cosine_al_sun
|
|
11
11
|
alias_method :cosalsun, :cosine_al_sun
|
|
@@ -14,7 +14,7 @@ class Eot
|
|
|
14
14
|
# cosine true longitude
|
|
15
15
|
# used in solar right ascension
|
|
16
16
|
def cosine_tl_sun
|
|
17
|
-
|
|
17
|
+
cos_tl_sun(tl(@ma, @ta))
|
|
18
18
|
end
|
|
19
19
|
alias_method :cosine_true_longitude, :cosine_tl_sun
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ class Eot
|
|
|
22
22
|
# cosine true obliquity
|
|
23
23
|
# used in solar right ascension and equation of equinox
|
|
24
24
|
def cosine_to_earth
|
|
25
|
-
|
|
25
|
+
cos_to_earth(Celes.nut06a(@ajd, 0)[1] + Celes.obl06(@ajd, 0))
|
|
26
26
|
end
|
|
27
27
|
alias_method :cosine_true_obliquity, :cosine_to_earth
|
|
28
28
|
|
|
@@ -30,7 +30,7 @@ class Eot
|
|
|
30
30
|
# sine apparent longitude
|
|
31
31
|
# used in solar declination
|
|
32
32
|
def sine_al_sun
|
|
33
|
-
|
|
33
|
+
sin_al_sun(al(@ma, @ta, Celes.faom03(@ta)))
|
|
34
34
|
end
|
|
35
35
|
alias_method :sine_apparent_longitude, :sine_al_sun
|
|
36
36
|
|
|
@@ -38,7 +38,7 @@ class Eot
|
|
|
38
38
|
# sine true longitude
|
|
39
39
|
# used in solar right ascension
|
|
40
40
|
def sine_tl_sun
|
|
41
|
-
|
|
41
|
+
sin_tl_sun(tl(@ma, @ta))
|
|
42
42
|
end
|
|
43
43
|
alias_method :sine_true_longitude, :sine_tl_sun
|
|
44
44
|
|
|
@@ -46,6 +46,6 @@ class Eot
|
|
|
46
46
|
# sine true obliquity angle of Earth
|
|
47
47
|
# used in solar declination
|
|
48
48
|
def sine_to_earth
|
|
49
|
-
|
|
49
|
+
sin_to_earth(Celes.nut06a(@ajd, 0)[1] + Celes.obl06(@ajd, 0))
|
|
50
50
|
end
|
|
51
51
|
end
|
data/lib/eot/version.rb
CHANGED
data/lib/eot.rb
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: equationoftime
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.1.
|
|
4
|
+
version: 4.1.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Douglas Allen
|
|
@@ -131,7 +131,7 @@ files:
|
|
|
131
131
|
- lib/eot/init.rb
|
|
132
132
|
- lib/eot/time_displays.rb
|
|
133
133
|
- lib/eot/times.rb
|
|
134
|
-
- lib/eot/
|
|
134
|
+
- lib/eot/trigonometric.rb
|
|
135
135
|
- lib/eot/utilities.rb
|
|
136
136
|
- lib/eot/version.rb
|
|
137
137
|
- test/eot/aliased_angles_spec.rb
|
metadata.gz.sig
CHANGED
|
Binary file
|