equationoftime 4.1.7 → 4.1.8
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 +8 -8
- data/.travis.yml +7 -0
- data/Gemfile +0 -1
- data/Manifest.txt +1 -0
- data/Rakefile +37 -9
- data/equationoftime.gemspec +12 -9
- data/examples/Equation_of_Time.png +0 -0
- data/examples/cal2jd.rb +10 -0
- data/examples/celes_formatters.rb +23 -0
- data/examples/eot_from_noon.rb +14 -0
- data/examples/eot_methods_list.rb +7 -0
- data/examples/my_lst.rb +11 -0
- data/examples/radians2degformated.rb +6 -0
- data/examples/t_sofa.rb +8229 -0
- data/examples/test_eot_c.rb +24 -0
- data/examples/use_addr.rb +20 -0
- data/examples/use_ajd.rb +40 -0
- data/ext/eot/ceot.c +3 -4
- data/ext/eot/eot.c +87 -43
- data/lib/eot/all.rb +11 -0
- data/lib/eot/angle_displays.rb +27 -13
- data/lib/eot/angles.rb +65 -7
- data/lib/eot/constants.rb +40 -3
- data/lib/eot/eot.so +0 -0
- data/lib/eot/times.rb +9 -1
- data/lib/eot/version.rb +1 -1
- data/test/eot/aliased_angles_spec.rb +293 -0
- data/test/eot/aliased_displays_spec.rb +127 -0
- data/test/eot/aliased_utilities_spec.rb +34 -0
- data/test/eot/angles_spec.rb +264 -0
- data/test/eot/constants_spec.rb +18 -0
- data/test/eot/displays_spec.rb +114 -0
- data/test/eot/geo_spec.rb +40 -0
- data/test/eot/init_spec.rb +45 -0
- data/test/eot/times_spec.rb +199 -0
- data/wiki.md +4 -3
- metadata +64 -29
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
lib = File.expand_path('../../lib', __FILE__)
|
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
+
|
|
4
|
+
require 'eot'
|
|
5
|
+
|
|
6
|
+
eot = Eot.new
|
|
7
|
+
|
|
8
|
+
p eot.ajd
|
|
9
|
+
p eot.ta # set on initializating using ajd
|
|
10
|
+
p eot.ma # set on initializating using ajd
|
|
11
|
+
# new date used
|
|
12
|
+
p ajd = DateTime.new(2000, 1, 1).jd
|
|
13
|
+
eot.ajd = ajd
|
|
14
|
+
eot.ma_ta_set # this sets the attributes
|
|
15
|
+
p ta = eot.ta # now these would be different
|
|
16
|
+
p ma = eot.ma # now these would be different
|
|
17
|
+
p ta_m = eot.eqc(ma, ta)
|
|
18
|
+
p om = eot.omega
|
|
19
|
+
p eot.al(ma, ta, om)
|
|
20
|
+
p eot.sun_dec(eot.al(ma, ta, om), eot.to_earth)
|
|
21
|
+
p eot.eoe(ta)
|
|
22
|
+
p eot.ml(ta)
|
|
23
|
+
p eot.era
|
|
24
|
+
p eot.tl_aries
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'eot'
|
|
2
|
+
eot = Eot.new
|
|
3
|
+
geo = GeoLatLng.new
|
|
4
|
+
heredoc = <<HD
|
|
5
|
+
The default address is '#{eot.addr}' as a string.
|
|
6
|
+
It is concantenated to the GeoLatLng base address
|
|
7
|
+
Create an instance of GeoLatLng with new method
|
|
8
|
+
ex: geo = GeoLatLng.new
|
|
9
|
+
examine the base address geo.base_json
|
|
10
|
+
#{geo.base_json}
|
|
11
|
+
This is used to lookup your coordinates using Google
|
|
12
|
+
maps. Use geo.set_coordinates.
|
|
13
|
+
#{geo.set_coordinates}
|
|
14
|
+
Just change the address to any desired location.
|
|
15
|
+
Use comma or space seperated terms.
|
|
16
|
+
ex: "huston, tx"
|
|
17
|
+
#{geo.addr = 'huston, tx'}
|
|
18
|
+
#{geo.set_coordinates}
|
|
19
|
+
HD
|
|
20
|
+
puts heredoc
|
data/examples/use_ajd.rb
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require 'eot'
|
|
2
|
+
eot = Eot.new
|
|
3
|
+
heredoc = <<HD
|
|
4
|
+
Setting the ajd sets a lot of other attributes.
|
|
5
|
+
All the angle calculations use this one setting.
|
|
6
|
+
ex: eot.ajd = 2451545.0
|
|
7
|
+
#{eot.ajd = 2_451_545.0}
|
|
8
|
+
You may get just about any value now from
|
|
9
|
+
various methods.
|
|
10
|
+
ex: eot.eot
|
|
11
|
+
#{eot.eot} radians
|
|
12
|
+
What day was that ajd?
|
|
13
|
+
eot.ajd_to_datetime(eot.ajd)
|
|
14
|
+
#{eot.ajd_to_datetime(eot.ajd)}
|
|
15
|
+
Sun apparent longitude.
|
|
16
|
+
eot.al_sun
|
|
17
|
+
#{eot.al_sun} radians
|
|
18
|
+
Try adding 80 days to the ajd
|
|
19
|
+
eot.ajd = 2451545.0 + 78
|
|
20
|
+
#{eot.ajd = 2_451_545.0 + 78}
|
|
21
|
+
#{eot.al_sun} radians
|
|
22
|
+
Almost a full circle in radians.
|
|
23
|
+
What day is that?
|
|
24
|
+
eot.ajd_to_datetime(eot.ajd)
|
|
25
|
+
#{eot.ajd_to_datetime(eot.ajd)}
|
|
26
|
+
That's near the Vernal Exquinox.
|
|
27
|
+
It nomally occurs 78 days after the Earth is
|
|
28
|
+
in perihelion of it's orbit around the Sun.
|
|
29
|
+
When does perihelion occur then?
|
|
30
|
+
A reasonable estimate is about the 3rd day of a new year.
|
|
31
|
+
eot.ajd = 2451545.0 + 2
|
|
32
|
+
#{eot.ajd = 2_451_545.0 + 2}
|
|
33
|
+
Now add the 78 days.
|
|
34
|
+
eot.ajd + 78
|
|
35
|
+
#{eot.ajd += 78}
|
|
36
|
+
#{eot.al_sun} radians
|
|
37
|
+
We completed the orbit plus a little extra.
|
|
38
|
+
It's just a rough estimate and is always changing.
|
|
39
|
+
HD
|
|
40
|
+
puts heredoc
|
data/ext/eot/ceot.c
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
#include "ceot.h"
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/* Mean geocentric longitude of the Sun */
|
|
4
4
|
double mlSun(double t)
|
|
5
5
|
{
|
|
6
6
|
double a;
|
|
7
|
-
|
|
8
|
-
/* Mean geocentric longitude of the Sun */
|
|
7
|
+
|
|
9
8
|
a = fmod( 280.4664567 +
|
|
10
9
|
t * ( 36000.76982779 +
|
|
11
10
|
t * ( 0.0003032028 +
|
|
@@ -16,11 +15,11 @@ double mlSun(double t)
|
|
|
16
15
|
return a;
|
|
17
16
|
}
|
|
18
17
|
|
|
18
|
+
/* Eccentricity of Earth orbit */
|
|
19
19
|
double eoe(double t)
|
|
20
20
|
{
|
|
21
21
|
double e;
|
|
22
22
|
|
|
23
|
-
/* Eccentricity of Earth orbit */
|
|
24
23
|
e = (0.016708617 + t * (-0.000042037 + t * -0.0000001235));
|
|
25
24
|
|
|
26
25
|
return e;
|
data/ext/eot/eot.c
CHANGED
|
@@ -7,96 +7,140 @@
|
|
|
7
7
|
|
|
8
8
|
ID id_status;
|
|
9
9
|
|
|
10
|
+
/*
|
|
11
|
+
Apparent longitude of the Sun C extension.
|
|
12
|
+
p1 = mean anomaly
|
|
13
|
+
p2 = time in julian centuries
|
|
14
|
+
p3 = angle of Omega
|
|
15
|
+
*/
|
|
16
|
+
VALUE func_al(VALUE klass, VALUE vma, VALUE vt, VALUE vo) {
|
|
17
|
+
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
18
|
+
return DBL2NUM(alSun(NUM2DBL(vma), NUM2DBL(vt), NUM2DBL(vo)));
|
|
19
|
+
}
|
|
20
|
+
/*
|
|
21
|
+
Cosine of the Zenith type C extension.
|
|
22
|
+
p1 = zenith angle sent by choice method
|
|
23
|
+
*/
|
|
24
|
+
VALUE func_cosZ(VALUE klass, VALUE vz) {
|
|
25
|
+
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
26
|
+
return DBL2NUM(cosZ(NUM2DBL(vz)));
|
|
27
|
+
}
|
|
28
|
+
/*
|
|
29
|
+
Cosine of Apparent Longitude Sun C extension.
|
|
30
|
+
p1 = Apparent Longitude Sun see al
|
|
31
|
+
*/
|
|
32
|
+
VALUE func_cos_al_sun(VALUE klass, VALUE vals) {
|
|
33
|
+
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
34
|
+
return DBL2NUM(cos_al_sun(NUM2DBL(vals)));
|
|
35
|
+
}
|
|
36
|
+
/*
|
|
37
|
+
Cosine of Solar Declination C extension
|
|
38
|
+
*/
|
|
39
|
+
VALUE func_cos_dec_sun(VALUE klass, VALUE vds) {
|
|
40
|
+
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
41
|
+
return DBL2NUM(cos_dec_sun(NUM2DBL(vds)));
|
|
42
|
+
}
|
|
43
|
+
/*
|
|
44
|
+
C extension
|
|
45
|
+
*/
|
|
10
46
|
VALUE func_ml(VALUE klass, VALUE vt) {
|
|
11
47
|
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
12
48
|
return DBL2NUM(mlSun(NUM2DBL(vt)));
|
|
13
49
|
}
|
|
14
|
-
|
|
50
|
+
/*
|
|
51
|
+
C extension
|
|
52
|
+
*/
|
|
15
53
|
VALUE func_eoe(VALUE klass, VALUE vt) {
|
|
16
54
|
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
17
55
|
return DBL2NUM(eoe(NUM2DBL(vt)));
|
|
18
56
|
}
|
|
19
|
-
|
|
57
|
+
/*
|
|
58
|
+
C extension
|
|
59
|
+
*/
|
|
20
60
|
VALUE func_eqc(VALUE klass, VALUE vma, VALUE vt) {
|
|
21
61
|
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
22
62
|
return DBL2NUM(eqc(NUM2DBL(vma), NUM2DBL(vt)));
|
|
23
63
|
}
|
|
24
|
-
|
|
64
|
+
/*
|
|
65
|
+
C extension
|
|
66
|
+
*/
|
|
25
67
|
VALUE func_tl(VALUE klass, VALUE vma, VALUE vt) {
|
|
26
68
|
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
27
69
|
return DBL2NUM(tlSun(NUM2DBL(vma), NUM2DBL(vt)));
|
|
28
70
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return DBL2NUM(alSun(NUM2DBL(vma), NUM2DBL(vt), NUM2DBL(vo)));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
VALUE func_cosZ(VALUE klass, VALUE vz) {
|
|
36
|
-
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
37
|
-
return DBL2NUM(cosZ(NUM2DBL(vz)));
|
|
38
|
-
}
|
|
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
|
-
|
|
71
|
+
/*
|
|
72
|
+
C extension
|
|
73
|
+
*/
|
|
45
74
|
VALUE func_cos_tl_sun(VALUE klass, VALUE vtls) {
|
|
46
75
|
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
47
76
|
return DBL2NUM(cos_al_sun(NUM2DBL(vtls)));
|
|
48
77
|
}
|
|
49
|
-
|
|
78
|
+
/*
|
|
79
|
+
C extension
|
|
80
|
+
*/
|
|
50
81
|
VALUE func_cos_to_earth(VALUE klass, VALUE vtoe) {
|
|
51
82
|
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
52
83
|
return DBL2NUM(cos_to_earth(NUM2DBL(vtoe)));
|
|
53
84
|
}
|
|
54
|
-
|
|
85
|
+
/*
|
|
86
|
+
C extension
|
|
87
|
+
*/
|
|
55
88
|
VALUE func_sin_al_sun(VALUE klass, VALUE vals) {
|
|
56
89
|
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
57
90
|
return DBL2NUM(sin_al_sun(NUM2DBL(vals)));
|
|
58
91
|
}
|
|
59
|
-
|
|
92
|
+
/*
|
|
93
|
+
C extension
|
|
94
|
+
*/
|
|
60
95
|
VALUE func_sin_tl_sun(VALUE klass, VALUE vtls) {
|
|
61
96
|
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
62
97
|
return DBL2NUM(sin_al_sun(NUM2DBL(vtls)));
|
|
63
98
|
}
|
|
64
|
-
|
|
99
|
+
/*
|
|
100
|
+
C extension
|
|
101
|
+
*/
|
|
65
102
|
VALUE func_sin_to_earth(VALUE klass, VALUE vtoe) {
|
|
66
103
|
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
67
104
|
return DBL2NUM(sin_to_earth(NUM2DBL(vtoe)));
|
|
68
105
|
}
|
|
69
|
-
|
|
106
|
+
/*
|
|
107
|
+
C extension
|
|
108
|
+
*/
|
|
70
109
|
VALUE func_sin_dec_sun(VALUE klass, VALUE vds) {
|
|
71
110
|
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
72
111
|
return DBL2NUM(sin_dec_sun(NUM2DBL(vds)));
|
|
73
112
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return DBL2NUM(cos_dec_sun(NUM2DBL(vds)));
|
|
78
|
-
}
|
|
79
|
-
|
|
113
|
+
/*
|
|
114
|
+
C extension
|
|
115
|
+
*/
|
|
80
116
|
VALUE func_sin_lat(VALUE klass, VALUE vlat) {
|
|
81
117
|
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
82
118
|
return DBL2NUM(sin_lat(NUM2DBL(vlat)));
|
|
83
119
|
}
|
|
84
|
-
|
|
120
|
+
/*
|
|
121
|
+
C extension
|
|
122
|
+
*/
|
|
85
123
|
VALUE func_cos_lat(VALUE klass, VALUE vlat) {
|
|
86
124
|
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
87
125
|
return DBL2NUM(cos_lat(NUM2DBL(vlat)));
|
|
88
126
|
}
|
|
89
|
-
|
|
127
|
+
/*
|
|
128
|
+
C extension
|
|
129
|
+
*/
|
|
90
130
|
VALUE func_sun(VALUE klass, VALUE vz, VALUE vds, VALUE vlat) {
|
|
91
131
|
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
92
132
|
return DBL2NUM(sun(NUM2DBL(vz), NUM2DBL(vds), NUM2DBL(vlat)));
|
|
93
133
|
}
|
|
94
|
-
|
|
134
|
+
/*
|
|
135
|
+
C extension
|
|
136
|
+
*/
|
|
95
137
|
VALUE func_sun_dec(VALUE klass, VALUE vals, VALUE vtoe) {
|
|
96
138
|
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
97
139
|
return DBL2NUM(sun_dec(NUM2DBL(vals), NUM2DBL(vtoe)));
|
|
98
140
|
}
|
|
99
|
-
|
|
141
|
+
/*
|
|
142
|
+
C extension
|
|
143
|
+
*/
|
|
100
144
|
VALUE func_sun_ra(VALUE klass, VALUE vy0, VALUE vcas) {
|
|
101
145
|
rb_ivar_set(klass, id_status, INT2FIX(0));
|
|
102
146
|
return DBL2NUM(raSun(NUM2DBL(vy0), NUM2DBL(vcas)));
|
|
@@ -108,24 +152,24 @@ Init_eot(void) {
|
|
|
108
152
|
|
|
109
153
|
VALUE cEot = rb_define_class("Eot", rb_cObject);
|
|
110
154
|
id_status = rb_intern("@status");
|
|
111
|
-
rb_define_method(cEot, "ml", func_ml, 1);
|
|
112
|
-
rb_define_method(cEot, "eoe", func_eoe, 1);
|
|
113
|
-
rb_define_method(cEot, "eqc", func_eqc, 2);
|
|
114
|
-
rb_define_method(cEot, "tl", func_tl, 2);
|
|
115
155
|
rb_define_method(cEot, "al", func_al, 3);
|
|
116
156
|
rb_define_method(cEot, "cosZ", func_cosZ, 1);
|
|
117
157
|
rb_define_method(cEot, "cos_al_sun", func_cos_al_sun, 1);
|
|
158
|
+
rb_define_method(cEot, "cos_dec_sun", func_cos_dec_sun, 1);
|
|
159
|
+
rb_define_method(cEot, "cos_lat", func_cos_lat, 1);
|
|
118
160
|
rb_define_method(cEot, "cos_tl_sun", func_cos_tl_sun, 1);
|
|
119
161
|
rb_define_method(cEot, "cos_to_earth", func_cos_to_earth, 1);
|
|
162
|
+
rb_define_method(cEot, "eoe", func_eoe, 1);
|
|
163
|
+
rb_define_method(cEot, "eqc", func_eqc, 2);
|
|
164
|
+
rb_define_method(cEot, "ml", func_ml, 1);
|
|
120
165
|
rb_define_method(cEot, "sin_al_sun", func_sin_al_sun, 1);
|
|
121
|
-
rb_define_method(cEot, "sin_tl_sun", func_sin_tl_sun, 1);
|
|
122
|
-
rb_define_method(cEot, "sin_to_earth", func_sin_to_earth, 1);
|
|
123
|
-
rb_define_method(cEot, "cos_dec_sun", func_cos_dec_sun, 1);
|
|
124
166
|
rb_define_method(cEot, "sin_dec_sun", func_sin_dec_sun, 1);
|
|
125
|
-
rb_define_method(cEot, "cos_lat", func_cos_lat, 1);
|
|
126
167
|
rb_define_method(cEot, "sin_lat", func_sin_lat, 1);
|
|
168
|
+
rb_define_method(cEot, "sin_tl_sun", func_sin_tl_sun, 1);
|
|
169
|
+
rb_define_method(cEot, "sin_to_earth", func_sin_to_earth, 1);
|
|
170
|
+
rb_define_method(cEot, "sun", func_sun, 3);
|
|
127
171
|
rb_define_method(cEot, "sun_dec", func_sun_dec, 2);
|
|
128
|
-
rb_define_method(cEot, "sun", func_sun, 3);
|
|
129
172
|
rb_define_method(cEot, "sun_ra", func_sun_ra, 2);
|
|
173
|
+
rb_define_method(cEot, "tl", func_tl, 2);
|
|
130
174
|
|
|
131
175
|
}
|
data/lib/eot/all.rb
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Eot is short for Equation of time.
|
|
2
|
+
# It is mainly used to find a true solar transit angle
|
|
3
|
+
# of the given longitude.
|
|
4
|
+
# Mean local noon in hours is (noon UTC) - (longitude / 15.0).
|
|
5
|
+
# True local noon is Mean - Eot in either time or angle.
|
|
6
|
+
class MainDoc < Object
|
|
7
|
+
end
|
|
8
|
+
# Celes gives you an undocumented Object class with rdoc generator.
|
|
9
|
+
# Use bundle exec rake rdocs if you don't care about C extensions documentation.
|
|
10
|
+
class Celes
|
|
11
|
+
end
|
data/lib/eot/angle_displays.rb
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
1
|
+
##
|
|
2
|
+
# class Eot file = angle_displays.rb:
|
|
3
|
+
# methods for display of angles.
|
|
4
|
+
|
|
3
5
|
class Eot
|
|
4
|
-
|
|
6
|
+
|
|
7
|
+
# From angle_displays.rb
|
|
8
|
+
|
|
5
9
|
# String formatter for d:m:s display
|
|
6
10
|
def degrees_to_s(radians = 0.0)
|
|
7
11
|
radians.nil? ? radians = 0.0 : radians
|
|
@@ -9,67 +13,77 @@ class Eot
|
|
|
9
13
|
f_string(s, idmsf[0], idmsf[1], idmsf[2], idmsf[3])
|
|
10
14
|
end
|
|
11
15
|
|
|
12
|
-
# From
|
|
16
|
+
# From angle_displays.rb
|
|
17
|
+
|
|
13
18
|
# String format of apparent longitude
|
|
14
19
|
def string_al_sun
|
|
15
20
|
degrees_to_s(al_sun)
|
|
16
21
|
end
|
|
17
22
|
alias_method :apparent_longitude_string, :string_al_sun
|
|
18
23
|
|
|
19
|
-
# From
|
|
24
|
+
# From angle_displays.rb
|
|
25
|
+
|
|
20
26
|
# String format of declination
|
|
21
27
|
def string_dec_sun
|
|
22
28
|
degrees_to_s(dec_sun)
|
|
23
29
|
end
|
|
24
30
|
alias_method :declination_string, :string_dec_sun
|
|
25
31
|
|
|
26
|
-
# From
|
|
32
|
+
# From angle_displays.rb
|
|
33
|
+
|
|
27
34
|
# String format for delta oblique
|
|
28
35
|
def string_delta_oblique
|
|
29
36
|
show_minutes(delta_oblique)
|
|
30
37
|
end
|
|
31
38
|
|
|
32
|
-
# From
|
|
39
|
+
# From angle_displays.rb
|
|
40
|
+
|
|
33
41
|
# String format for delta orbit
|
|
34
42
|
def string_delta_orbit
|
|
35
43
|
show_minutes(delta_orbit)
|
|
36
44
|
end
|
|
37
45
|
|
|
38
|
-
# From
|
|
46
|
+
# From angle_displays.rb
|
|
47
|
+
|
|
39
48
|
# String format for centre
|
|
40
49
|
def string_eqc
|
|
41
50
|
degrees_to_s(center)
|
|
42
51
|
end
|
|
43
52
|
|
|
44
|
-
# From
|
|
53
|
+
# From angle_displays.rb
|
|
54
|
+
|
|
45
55
|
# String format of mean anomaly
|
|
46
56
|
def string_ma_sun
|
|
47
57
|
degrees_to_s(@ma)
|
|
48
58
|
end
|
|
49
59
|
alias_method :mean_anomaly_string, :string_ma_sun
|
|
50
60
|
|
|
51
|
-
# From
|
|
61
|
+
# From angle_displays.rb
|
|
62
|
+
|
|
52
63
|
# String format of right ascension
|
|
53
64
|
def string_ra_sun
|
|
54
65
|
degrees_to_s(ra_sun)
|
|
55
66
|
end
|
|
56
67
|
alias_method :right_ascension_string, :string_ra_sun
|
|
57
68
|
|
|
58
|
-
# From
|
|
69
|
+
# From angle_displays.rb
|
|
70
|
+
|
|
59
71
|
# String format of true anomaly
|
|
60
72
|
def string_ta_sun
|
|
61
73
|
degrees_to_s(ta_sun)
|
|
62
74
|
end
|
|
63
75
|
alias_method :true_anomaly_string, :string_ta_sun
|
|
64
76
|
|
|
65
|
-
# From
|
|
77
|
+
# From angle_displays.rb
|
|
78
|
+
|
|
66
79
|
# String format of true longitude
|
|
67
80
|
def string_tl_sun
|
|
68
81
|
degrees_to_s(tl_sun)
|
|
69
82
|
end
|
|
70
83
|
alias_method :true_longitude_string, :string_tl_sun
|
|
71
84
|
|
|
72
|
-
# From
|
|
85
|
+
# From angle_displays.rb
|
|
86
|
+
|
|
73
87
|
# String format of true obliquity
|
|
74
88
|
def string_to_earth
|
|
75
89
|
degrees_to_s(to_earth)
|
data/lib/eot/angles.rb
CHANGED
|
@@ -1,66 +1,94 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
1
|
+
##
|
|
2
|
+
# class Eot file = angles.rb:
|
|
3
|
+
# methods for non delta angle calculations.
|
|
4
|
+
|
|
3
5
|
class Eot
|
|
6
|
+
|
|
7
|
+
##
|
|
4
8
|
# From angles.rb:
|
|
9
|
+
|
|
5
10
|
# Apparent solar longitude = true longitude - aberation
|
|
11
|
+
|
|
6
12
|
def al_sun
|
|
7
13
|
Celes.anp(al(@ma, @ta, omega))
|
|
8
14
|
end
|
|
9
15
|
alias_method :apparent_longitude, :al_sun
|
|
10
16
|
alias_method :alsun, :al_sun
|
|
11
17
|
|
|
18
|
+
##
|
|
12
19
|
# From angles.rb:
|
|
13
|
-
|
|
20
|
+
|
|
21
|
+
# equation of centre is
|
|
14
22
|
# added to mean anomaly to get true anomaly.
|
|
23
|
+
|
|
15
24
|
def center
|
|
16
25
|
eqc(@ma, @ta)
|
|
17
26
|
end
|
|
18
27
|
alias_method :equation_of_center, :center
|
|
19
28
|
|
|
29
|
+
##
|
|
20
30
|
# From angles.rb:
|
|
21
|
-
|
|
31
|
+
|
|
32
|
+
# solar declination
|
|
33
|
+
|
|
22
34
|
def dec_sun
|
|
23
35
|
sun_dec(al_sun, to_earth)
|
|
24
36
|
end
|
|
25
37
|
alias_method :declination, :dec_sun
|
|
26
38
|
|
|
39
|
+
##
|
|
27
40
|
# From angles.rb:
|
|
41
|
+
|
|
28
42
|
# eccentricity of elliptical Earth orbit around Sun
|
|
29
43
|
# Horners' calculation method
|
|
44
|
+
|
|
30
45
|
def eccentricity_earth
|
|
31
46
|
eoe(@ta)
|
|
32
47
|
end
|
|
33
48
|
alias_method :eccentricity_earth_orbit, :eccentricity_earth
|
|
34
49
|
|
|
50
|
+
##
|
|
35
51
|
# From angles.rb:
|
|
36
|
-
|
|
37
|
-
#
|
|
52
|
+
|
|
53
|
+
# equation of equinox is
|
|
54
|
+
# used for true longitude of Aries but
|
|
38
55
|
# Depricated by Celes.gst06a()
|
|
39
56
|
# compinents are still used
|
|
40
57
|
# see: #cosine_to_earth and #angle_delta_psi
|
|
58
|
+
|
|
41
59
|
def eq_of_equinox
|
|
42
60
|
Celes.ee06a(@ajd, 0.0)
|
|
43
61
|
end
|
|
44
62
|
|
|
63
|
+
|
|
64
|
+
##
|
|
45
65
|
# From angles.rb:
|
|
66
|
+
|
|
46
67
|
# Earth rotation angle (for comparison to tl_aries
|
|
47
68
|
# which uses gmst06)
|
|
69
|
+
|
|
48
70
|
def era
|
|
49
71
|
Celes.era00(@ajd, 0.0)
|
|
50
72
|
end
|
|
51
73
|
|
|
74
|
+
##
|
|
52
75
|
# From angles.rb:
|
|
76
|
+
|
|
53
77
|
# angle geometric mean longitude
|
|
54
78
|
# needed to get true longitude for low accuracy.
|
|
79
|
+
|
|
55
80
|
def gml_sun
|
|
56
81
|
ml(@ta)
|
|
57
82
|
end
|
|
58
83
|
alias_method :geometric_mean_longitude, :gml_sun
|
|
59
84
|
alias_method :ml_sun, :gml_sun
|
|
60
85
|
|
|
86
|
+
##
|
|
61
87
|
# From angles.rb:
|
|
88
|
+
|
|
62
89
|
# used by ha_sun method
|
|
63
90
|
# to select rise set and civil, nautical, astronomical twilights.
|
|
91
|
+
|
|
64
92
|
def choice(c)
|
|
65
93
|
case c
|
|
66
94
|
when 1
|
|
@@ -74,30 +102,39 @@ class Eot
|
|
|
74
102
|
end
|
|
75
103
|
end
|
|
76
104
|
|
|
105
|
+
##
|
|
77
106
|
# From angles.rb:
|
|
107
|
+
|
|
78
108
|
# horizon angle for provided geo coordinates
|
|
79
109
|
# used for angles from transit to horizons.
|
|
110
|
+
|
|
80
111
|
def ha_sun(c)
|
|
81
112
|
zenith = choice(c)
|
|
82
113
|
sun(zenith, dec_sun, @latitude)
|
|
83
114
|
end
|
|
84
115
|
alias_method :horizon_angle, :ha_sun
|
|
85
116
|
|
|
117
|
+
##
|
|
86
118
|
# From angles.rb:
|
|
119
|
+
|
|
87
120
|
# angle of Suns' mean anomaly
|
|
88
121
|
# calculated in nutation.rb via celes function
|
|
89
122
|
# sets ta attribute for the rest the methods needing it.
|
|
90
123
|
# used in equation of time
|
|
91
124
|
# and to get true anomaly true longitude via center equation
|
|
125
|
+
|
|
92
126
|
def ma_sun
|
|
93
127
|
@ta = (@ajd - DJ00) / DJC
|
|
94
128
|
@ma = Celes.falp03(@ta)
|
|
95
129
|
end
|
|
96
130
|
alias_method :mean_anomaly, :ma_sun
|
|
97
131
|
|
|
132
|
+
##
|
|
98
133
|
# From angles.rb:
|
|
134
|
+
|
|
99
135
|
# Mean equinox point where right ascension is measured from as zero hours.
|
|
100
136
|
# # see http://www.iausofa.org/publications/aas04.pdf
|
|
137
|
+
|
|
101
138
|
def ml_aries
|
|
102
139
|
dt = 67.184
|
|
103
140
|
tt = @ajd + dt / 86_400.0
|
|
@@ -105,25 +142,34 @@ class Eot
|
|
|
105
142
|
end
|
|
106
143
|
alias_method :mean_longitude_aries, :ml_aries
|
|
107
144
|
|
|
145
|
+
##
|
|
108
146
|
# From angles.rb:
|
|
147
|
+
|
|
109
148
|
# mean obliquity of Earth
|
|
149
|
+
|
|
110
150
|
def mo_earth
|
|
111
151
|
Celes.obl06(@ajd, 0)
|
|
112
152
|
end
|
|
113
153
|
alias_method :mean_obliquity_of_ecliptic, :mo_earth
|
|
114
154
|
alias_method :mean_obliquity, :mo_earth
|
|
115
155
|
|
|
156
|
+
##
|
|
116
157
|
# From angles.rb:
|
|
158
|
+
|
|
117
159
|
# omega is a component of nutation and used
|
|
118
160
|
# in apparent longitude
|
|
119
161
|
# omega is the longitude of the mean ascending node of the lunar orbit
|
|
120
162
|
# on the ecliptic plane measured from the mean equinox of date.
|
|
163
|
+
|
|
121
164
|
def omega
|
|
122
165
|
Celes.faom03(@ta)
|
|
123
166
|
end
|
|
124
167
|
|
|
168
|
+
##
|
|
125
169
|
# From angles.rb:
|
|
170
|
+
|
|
126
171
|
# solar right ascension
|
|
172
|
+
|
|
127
173
|
def ra_sun
|
|
128
174
|
y0 = sine_al_sun * cosine_to_earth
|
|
129
175
|
ra = sun_ra(y0, cosine_al_sun)
|
|
@@ -132,17 +178,23 @@ class Eot
|
|
|
132
178
|
end
|
|
133
179
|
alias_method :right_ascension, :ra_sun
|
|
134
180
|
|
|
181
|
+
##
|
|
135
182
|
# From angles.rb:
|
|
183
|
+
|
|
136
184
|
# angle true anomaly
|
|
137
185
|
# used in equation of time
|
|
186
|
+
|
|
138
187
|
def ta_sun
|
|
139
188
|
Celes.anp(@ma + eqc(@ma, @ta))
|
|
140
189
|
end
|
|
141
190
|
alias_method :true_anomaly, :ta_sun
|
|
142
191
|
|
|
192
|
+
##
|
|
143
193
|
# From angles.rb:
|
|
194
|
+
|
|
144
195
|
# true longitude of equinox 'first point of aries'
|
|
145
196
|
# considers nutation
|
|
197
|
+
|
|
146
198
|
def tl_aries
|
|
147
199
|
dt = 67.184
|
|
148
200
|
tt = @ajd + dt / 86_400.0
|
|
@@ -150,18 +202,24 @@ class Eot
|
|
|
150
202
|
end
|
|
151
203
|
alias_method :true_longitude_aries, :tl_aries
|
|
152
204
|
|
|
205
|
+
##
|
|
153
206
|
# From angles.rb:
|
|
207
|
+
|
|
154
208
|
# angle of true longitude sun
|
|
155
209
|
# used in equation of time
|
|
210
|
+
|
|
156
211
|
def tl_sun
|
|
157
212
|
tl(@ma, @ta)
|
|
158
213
|
end
|
|
159
214
|
alias_method :true_longitude, :tl_sun
|
|
160
215
|
alias_method :ecliptic_longitude, :tl_sun
|
|
161
216
|
alias_method :lambda, :tl_sun
|
|
162
|
-
|
|
217
|
+
|
|
218
|
+
##
|
|
163
219
|
# From angles.rb:
|
|
220
|
+
|
|
164
221
|
# true obliquity considers nutation
|
|
222
|
+
|
|
165
223
|
def to_earth
|
|
166
224
|
mo_earth + angle_delta_epsilon
|
|
167
225
|
end
|