equationoftime 3.0.0 → 4.0.0
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
- data/.buildpath +5 -0
- data/.project +17 -0
- data/.rvmrc +1 -0
- data/.settings/org.eclipse.ltk.core.refactoring.prefs +2 -0
- data/Makefile +238 -0
- data/Rakefile +40 -3
- data/analemma_data.yml +2925 -0
- data/equationoftime.gemspec +6 -3
- data/examples/analemma_data_generator.rb +12 -12
- data/examples/celes_parts/.RUBYARCHDIR.time +0 -0
- data/examples/celes_parts/.cproject +56 -0
- data/examples/celes_parts/.project +78 -0
- data/examples/celes_parts/a2af.c +120 -0
- data/examples/celes_parts/a2tf.c +116 -0
- data/examples/celes_parts/af2a.c +107 -0
- data/examples/celes_parts/anp.c +82 -0
- data/examples/celes_parts/anpm.c +82 -0
- data/examples/celes_parts/bi00.c +116 -0
- data/examples/celes_parts/bp00.c +173 -0
- data/examples/celes_parts/bp06.c +136 -0
- data/examples/celes_parts/bpn2xy.c +100 -0
- data/examples/celes_parts/c2i00a.c +139 -0
- data/examples/celes_parts/c2i00b.c +139 -0
- data/examples/celes_parts/c2i06a.c +136 -0
- data/examples/celes_parts/c2ibpn.c +142 -0
- data/examples/celes_parts/c2ixy.c +131 -0
- data/examples/celes_parts/c2ixys.c +123 -0
- data/examples/celes_parts/c2s.c +96 -0
- data/examples/celes_parts/c2t00a.c +154 -0
- data/examples/celes_parts/c2t00b.c +150 -0
- data/examples/celes_parts/c2t06a.c +152 -0
- data/examples/celes_parts/c2tcio.c +122 -0
- data/examples/celes_parts/c2teqx.c +122 -0
- data/examples/celes_parts/c2tpe.c +167 -0
- data/examples/celes_parts/c2txy.c +159 -0
- data/examples/celes_parts/cal2jd.c +139 -0
- data/examples/celes_parts/celes_core.c +2522 -0
- data/examples/celes_parts/cp.c +80 -0
- data/examples/celes_parts/cpv.c +82 -0
- data/examples/celes_parts/cr.c +83 -0
- data/examples/celes_parts/d2dtf.c +206 -0
- data/examples/celes_parts/d2tf.c +160 -0
- data/examples/celes_parts/dat.c +289 -0
- data/examples/celes_parts/depend +25 -0
- data/examples/celes_parts/dtdb.c +1213 -0
- data/examples/celes_parts/dtf2d.c +196 -0
- data/examples/celes_parts/ee00.c +128 -0
- data/examples/celes_parts/ee00a.c +135 -0
- data/examples/celes_parts/ee00b.c +141 -0
- data/examples/celes_parts/ee06a.c +122 -0
- data/examples/celes_parts/eect00.c +282 -0
- data/examples/celes_parts/eform.c +147 -0
- data/examples/celes_parts/eo06a.c +131 -0
- data/examples/celes_parts/eors.c +108 -0
- data/examples/celes_parts/epb.c +96 -0
- data/examples/celes_parts/epb2jd.c +91 -0
- data/examples/celes_parts/epj.c +93 -0
- data/examples/celes_parts/epj2jd.c +91 -0
- data/examples/celes_parts/epv00.c +2589 -0
- data/examples/celes_parts/eqeq94.c +131 -0
- data/examples/celes_parts/era00.c +136 -0
- data/examples/celes_parts/extconf.rb +4 -0
- data/examples/celes_parts/fad03.c +103 -0
- data/examples/celes_parts/fae03.c +102 -0
- data/examples/celes_parts/faf03.c +106 -0
- data/examples/celes_parts/faju03.c +102 -0
- data/examples/celes_parts/fal03.c +103 -0
- data/examples/celes_parts/falp03.c +103 -0
- data/examples/celes_parts/fama03.c +102 -0
- data/examples/celes_parts/fame03.c +102 -0
- data/examples/celes_parts/fane03.c +99 -0
- data/examples/celes_parts/faom03.c +104 -0
- data/examples/celes_parts/fapa03.c +103 -0
- data/examples/celes_parts/fasa03.c +102 -0
- data/examples/celes_parts/faur03.c +99 -0
- data/examples/celes_parts/fave03.c +102 -0
- data/examples/celes_parts/fk52h.c +143 -0
- data/examples/celes_parts/fk5hip.c +126 -0
- data/examples/celes_parts/fk5hz.c +160 -0
- data/examples/celes_parts/fw2m.c +134 -0
- data/examples/celes_parts/fw2xy.c +120 -0
- data/examples/celes_parts/gc2gd.c +134 -0
- data/examples/celes_parts/gc2gde.c +200 -0
- data/examples/celes_parts/gd2gc.c +134 -0
- data/examples/celes_parts/gd2gce.c +138 -0
- data/examples/celes_parts/gmst00.c +145 -0
- data/examples/celes_parts/gmst06.c +136 -0
- data/examples/celes_parts/gmst82.c +151 -0
- data/examples/celes_parts/gst00a.c +138 -0
- data/examples/celes_parts/gst00b.c +146 -0
- data/examples/celes_parts/gst06.c +140 -0
- data/examples/celes_parts/gst06a.c +131 -0
- data/examples/celes_parts/gst94.c +131 -0
- data/examples/celes_parts/h2fk5.c +148 -0
- data/examples/celes_parts/hfk5z.c +175 -0
- data/examples/celes_parts/ir.c +83 -0
- data/examples/celes_parts/jd2cal.c +155 -0
- data/examples/celes_parts/jdcalf.c +161 -0
- data/examples/celes_parts/num00a.c +121 -0
- data/examples/celes_parts/num00b.c +121 -0
- data/examples/celes_parts/num06a.c +125 -0
- data/examples/celes_parts/numat.c +109 -0
- data/examples/celes_parts/nut00a.c +2047 -0
- data/examples/celes_parts/nut00b.c +372 -0
- data/examples/celes_parts/nut06a.c +153 -0
- data/examples/celes_parts/nut80.c +325 -0
- data/examples/celes_parts/nutm80.c +117 -0
- data/examples/celes_parts/obl06.c +118 -0
- data/examples/celes_parts/obl80.c +118 -0
- data/examples/celes_parts/p06e.c +321 -0
- data/examples/celes_parts/p2pv.c +83 -0
- data/examples/celes_parts/p2s.c +91 -0
- data/examples/celes_parts/pap.c +139 -0
- data/examples/celes_parts/pas.c +96 -0
- data/examples/celes_parts/pb06.c +144 -0
- data/examples/celes_parts/pdp.c +84 -0
- data/examples/celes_parts/pfw06.c +165 -0
- data/examples/celes_parts/plan94.c +514 -0
- data/examples/celes_parts/pm.c +83 -0
- data/examples/celes_parts/pmat00.c +118 -0
- data/examples/celes_parts/pmat06.c +122 -0
- data/examples/celes_parts/pmat76.c +141 -0
- data/examples/celes_parts/pmp.c +85 -0
- data/examples/celes_parts/pn.c +109 -0
- data/examples/celes_parts/pn00.c +177 -0
- data/examples/celes_parts/pn00a.c +162 -0
- data/examples/celes_parts/pn00b.c +162 -0
- data/examples/celes_parts/pn06.c +187 -0
- data/examples/celes_parts/pn06a.c +152 -0
- data/examples/celes_parts/pnm00a.c +121 -0
- data/examples/celes_parts/pnm00b.c +121 -0
- data/examples/celes_parts/pnm06a.c +124 -0
- data/examples/celes_parts/pnm80.c +126 -0
- data/examples/celes_parts/pom00.c +115 -0
- data/examples/celes_parts/ppp.c +85 -0
- data/examples/celes_parts/ppsp.c +94 -0
- data/examples/celes_parts/pr00.c +142 -0
- data/examples/celes_parts/prec76.c +148 -0
- data/examples/celes_parts/pv2p.c +81 -0
- data/examples/celes_parts/pv2s.c +144 -0
- data/examples/celes_parts/pvdpv.c +102 -0
- data/examples/celes_parts/pvm.c +86 -0
- data/examples/celes_parts/pvmpv.c +87 -0
- data/examples/celes_parts/pvppv.c +87 -0
- data/examples/celes_parts/pvstar.c +207 -0
- data/examples/celes_parts/pvu.c +93 -0
- data/examples/celes_parts/pvup.c +88 -0
- data/examples/celes_parts/pvxpv.c +107 -0
- data/examples/celes_parts/pxp.c +94 -0
- data/examples/celes_parts/rm2v.c +111 -0
- data/examples/celes_parts/rv2m.c +118 -0
- data/examples/celes_parts/rx.c +110 -0
- data/examples/celes_parts/rxp.c +99 -0
- data/examples/celes_parts/rxpv.c +86 -0
- data/examples/celes_parts/rxr.c +99 -0
- data/examples/celes_parts/ry.c +110 -0
- data/examples/celes_parts/rz.c +110 -0
- data/examples/celes_parts/s00.c +371 -0
- data/examples/celes_parts/s00a.c +143 -0
- data/examples/celes_parts/s00b.c +143 -0
- data/examples/celes_parts/s06.c +368 -0
- data/examples/celes_parts/s06a.c +145 -0
- data/examples/celes_parts/s2c.c +85 -0
- data/examples/celes_parts/s2p.c +88 -0
- data/examples/celes_parts/s2pv.c +103 -0
- data/examples/celes_parts/s2xpv.c +87 -0
- data/examples/celes_parts/sepp.c +105 -0
- data/examples/celes_parts/seps.c +93 -0
- data/examples/celes_parts/sofa.h +379 -0
- data/examples/celes_parts/sofam.h +155 -0
- data/examples/celes_parts/sp00.c +118 -0
- data/examples/celes_parts/starpm.c +205 -0
- data/examples/celes_parts/starpv.c +264 -0
- data/examples/celes_parts/sxp.c +84 -0
- data/examples/celes_parts/sxpv.c +85 -0
- data/examples/celes_parts/taitt.c +110 -0
- data/examples/celes_parts/taiut1.c +112 -0
- data/examples/celes_parts/taiutc.c +182 -0
- data/examples/celes_parts/tcbtdb.c +132 -0
- data/examples/celes_parts/tcgtt.c +109 -0
- data/examples/celes_parts/tdbtcb.c +137 -0
- data/examples/celes_parts/tdbtt.c +122 -0
- data/examples/celes_parts/test_celes.rb +48 -0
- data/examples/celes_parts/tf2a.c +107 -0
- data/examples/celes_parts/tf2d.c +107 -0
- data/examples/celes_parts/tr.c +93 -0
- data/examples/celes_parts/trxp.c +93 -0
- data/examples/celes_parts/trxpv.c +93 -0
- data/examples/celes_parts/tttai.c +110 -0
- data/examples/celes_parts/tttcg.c +112 -0
- data/examples/celes_parts/tttdb.c +121 -0
- data/examples/celes_parts/ttut1.c +110 -0
- data/examples/celes_parts/ut1tai.c +111 -0
- data/examples/celes_parts/ut1tt.c +110 -0
- data/examples/celes_parts/ut1utc.c +193 -0
- data/examples/celes_parts/utctai.c +163 -0
- data/examples/celes_parts/utcut1.c +151 -0
- data/examples/celes_parts/xy06.c +2758 -0
- data/examples/celes_parts/xys00a.c +133 -0
- data/examples/celes_parts/xys00b.c +133 -0
- data/examples/celes_parts/xys06a.c +133 -0
- data/examples/celes_parts/zp.c +77 -0
- data/examples/celes_parts/zpv.c +79 -0
- data/examples/celes_parts/zr.c +83 -0
- data/examples/check_date_type.rb +2 -4
- data/examples/compare_geoc_long_ra.rb +19 -11
- data/examples/data_table_for_astro_dog.rb +40 -0
- data/examples/earth_rotation.rb +28 -3
- data/examples/eot.c +15 -0
- data/examples/eot.h +2 -0
- data/examples/eot_methods_list.rb +30 -3
- data/examples/eot_suntimes.rb +99 -95
- data/examples/extconf.rb +2 -0
- data/examples/{read_nutation_data.rb → gmst_gast_non_sofa.rb} +103 -98
- data/examples/nutation_table5_3a.yaml +1658 -1658
- data/examples/rbeot.c +24 -0
- data/examples/test_eot.rb +17 -0
- data/examples/test_poly_eval.rb +6 -17
- data/examples/time_scales.rb +4 -7
- data/examples/times_year.rb +50 -0
- data/examples/usage_example.rb +15 -5
- data/examples/use_angles.rb +151 -87
- data/lib/eot/angles.rb +130 -177
- data/lib/eot/constants.rb +41 -44
- data/lib/eot/displays.rb +40 -37
- data/lib/eot/geo_lat_lng_smt.rb +7 -6
- data/lib/eot/init.rb +62 -39
- data/lib/eot/nutation.rb +53 -45
- data/lib/eot/times.rb +32 -41
- data/lib/eot/utilities.rb +11 -90
- data/lib/eot/version.rb +3 -2
- data/rise_set_data.yml +1461 -0
- data/run_tests_eclipse.rb +1 -0
- data/tests/minitest/aliased_angles_spec.rb +119 -165
- data/tests/minitest/aliased_displays_spec.rb +41 -39
- data/tests/minitest/aliased_utilities_spec.rb +11 -22
- data/tests/minitest/angles_spec.rb +134 -181
- data/tests/minitest/constants_spec.rb +4 -10
- data/tests/minitest/delta_epsilon_spec.rb +13 -16
- data/tests/minitest/displays_spec.rb +39 -37
- data/tests/minitest/geo_spec.rb +15 -11
- data/tests/minitest/init_spec.rb +30 -16
- data/tests/minitest/nutation_spec.rb +19 -13
- data/tests/minitest/times_spec.rb +77 -75
- data/tests/minitest/utilities_spec.rb +10 -94
- data/wiki.md +7 -9
- metadata +218 -26
- data/examples/data_table.rb +0 -26
- data/lib/eot/nutation_table5_3a.yaml +0 -9532
- data/tests/minitest/aliased_times_spec.rb +0 -36
data/lib/eot/constants.rb
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
# constants.rb
|
|
2
|
+
|
|
2
3
|
require 'date'
|
|
3
4
|
|
|
4
5
|
class Eot
|
|
5
|
-
|
|
6
|
-
include Math
|
|
7
6
|
|
|
8
7
|
# Array result for time_julian_century default = [0.0, 0.0, 0.0, 0.0, 0.0]
|
|
9
|
-
A2000 = [0.0, 0.0, 0.0, 0.0, 0.0]
|
|
8
|
+
# A2000 = [0.0, 0.0, 0.0, 0.0, 0.0]
|
|
10
9
|
|
|
11
10
|
# Arc seconds in a degree = 3_600.0
|
|
12
11
|
ARCSEC = 3_600.0
|
|
@@ -15,25 +14,25 @@ class Eot
|
|
|
15
14
|
ASD = 3_600.0
|
|
16
15
|
|
|
17
16
|
# Arc seconds in an hour = 240.0
|
|
18
|
-
ASH = 240.0
|
|
17
|
+
# ASH = 240.0
|
|
19
18
|
|
|
20
19
|
# Light time for 1 au (s) = 499.004782
|
|
21
|
-
AULT = 499.004782
|
|
20
|
+
# AULT = 499.004782
|
|
22
21
|
|
|
23
22
|
# Speed of light (m/s) = 299792458.0
|
|
24
|
-
CMPS = 299792458.0
|
|
23
|
+
# CMPS = 299792458.0
|
|
25
24
|
|
|
26
25
|
# Default date string = "2000-01-01"
|
|
27
|
-
D2000 = "2000-01-01"
|
|
26
|
+
# D2000 = "2000-01-01"
|
|
28
27
|
|
|
29
28
|
# 2Pi = 6.283185307179586476925287
|
|
30
|
-
D2PI = 6.283185307179586476925287
|
|
29
|
+
# D2PI = 6.283185307179586476925287
|
|
31
30
|
|
|
32
|
-
#
|
|
33
|
-
DAS2R = 4.
|
|
31
|
+
# from desktop calculator DAS2R = 4.8481368110953599358991410235795e-6
|
|
32
|
+
DAS2R = 4.8481368110953599358991410235795e-6
|
|
34
33
|
|
|
35
34
|
# Astronomical unit (m) = 149597870e3
|
|
36
|
-
DAU = 149597870e3
|
|
35
|
+
# DAU = 149597870e3
|
|
37
36
|
|
|
38
37
|
# Hours in a day = 24.0
|
|
39
38
|
DAY_HOURS = 24.0
|
|
@@ -51,10 +50,10 @@ class Eot
|
|
|
51
50
|
DAY_USECS = 86_400_000_000.0
|
|
52
51
|
|
|
53
52
|
# Speed of light (AU per day) = DAYSEC / AULT
|
|
54
|
-
DC = DAYSEC / AULT
|
|
53
|
+
# DC = DAYSEC / AULT
|
|
55
54
|
|
|
56
|
-
#
|
|
57
|
-
|
|
55
|
+
# from desktop calculator D2R = 0.017453292519943295769236907684886
|
|
56
|
+
D2R = 0.017453292519943295769236907684886
|
|
58
57
|
|
|
59
58
|
# dint(A) - truncate to nearest whole number towards zero (double)
|
|
60
59
|
# dint(A) = ((A)<0.0?ceil(A):floor(A))
|
|
@@ -73,51 +72,46 @@ class Eot
|
|
|
73
72
|
DJC = 36525.0
|
|
74
73
|
|
|
75
74
|
# Days per Julian millennium = 365250.0
|
|
76
|
-
DJM = 365250.0
|
|
75
|
+
# DJM = 365250.0
|
|
77
76
|
|
|
78
77
|
# Julian Date of Modified Julian Date zero
|
|
79
78
|
# 1858, 11, 17, 0.0 midnight start of calendar reform = 2400000.5
|
|
80
79
|
# Removed from Julian Date to get Modified Julian Date
|
|
81
|
-
DJM0 = 2400000.5
|
|
80
|
+
# DJM0 = 2400000.5
|
|
82
81
|
|
|
83
82
|
# Reference epoch (J2000.0), Modified Julian Date = 51544.5
|
|
84
|
-
DJM00 = 51544.5
|
|
83
|
+
# DJM00 = 51544.5
|
|
85
84
|
|
|
86
85
|
# 1977 Jan 1.0 as MJD = 43144.0
|
|
87
|
-
DJM77 = 43144.0
|
|
86
|
+
# DJM77 = 43144.0
|
|
88
87
|
|
|
89
88
|
# Days per Julian year = 365.25
|
|
90
|
-
DJY = 365.25
|
|
89
|
+
# DJY = 365.25
|
|
91
90
|
|
|
92
91
|
# Milli-arc-seconds to radians = DAS2R / 1e3
|
|
93
|
-
DMAS2R = DAS2R / 1e3
|
|
94
|
-
|
|
95
|
-
# Pi = 3.141592653589793238462643
|
|
96
|
-
DPI = 3.141592653589793238462643
|
|
92
|
+
# DMAS2R = DAS2R / 1e3
|
|
97
93
|
|
|
98
94
|
# Radians to arc seconds = 206264.8062470963551564734
|
|
99
|
-
DR2AS = 206264.8062470963551564734
|
|
100
|
-
|
|
101
|
-
# Radians to degrees = 57.29577951308232087679815
|
|
102
|
-
DR2D = 57.29577951308232087679815
|
|
95
|
+
# DR2AS = 206264.8062470963551564734
|
|
103
96
|
|
|
104
97
|
# Seconds of time to radians = 7.272205216643039903848712e-5
|
|
105
|
-
DS2R = 7.272205216643039903848712e-5
|
|
98
|
+
# DS2R = 7.272205216643039903848712e-5
|
|
106
99
|
|
|
107
100
|
# Default DateTime = DateTime.new( 2000, 01, 01, 12, 00, 00, "+00:00" )
|
|
108
101
|
DT2000 = DateTime.new( 2000, 01, 01, 12, 00, 00, "+00:00" )
|
|
109
102
|
|
|
110
103
|
# arc seconds degrees to radians = PI / 180.0 / ARCSEC
|
|
111
|
-
DTR = PI / 180.0 / ARCSEC
|
|
104
|
+
# DTR = PI / 180.0 / ARCSEC
|
|
105
|
+
# DTR = 4.8481368110953599358991410235795e-6 # from calculator
|
|
112
106
|
|
|
113
107
|
# Length of tropical year B1900 (days) = 365.242198781
|
|
114
|
-
DTY = 365.242198781
|
|
108
|
+
# DTY = 365.242198781
|
|
115
109
|
|
|
116
110
|
# L_G = 1 - d(TT)/d(TCG) = 6.969290134e-10
|
|
117
|
-
ELG = 6.969290134e-10
|
|
111
|
+
# ELG = 6.969290134e-10
|
|
118
112
|
|
|
119
113
|
# L_B = 1 - d(TDB)/d(TCB) = 1.550519768e-8
|
|
120
|
-
ELB = 1.550519768e-8
|
|
114
|
+
# ELB = 1.550519768e-8
|
|
121
115
|
|
|
122
116
|
# max(A,B) - larger (most +ve) of two numbers (generic)
|
|
123
117
|
# gmax(A,B) = (((A)>(B))?(A):(B))
|
|
@@ -127,35 +121,38 @@ class Eot
|
|
|
127
121
|
|
|
128
122
|
# Reference epoch (J2000.0), Julian Date
|
|
129
123
|
# Default Julian Number = 2451545.0
|
|
130
|
-
J2000 = 2451545.0
|
|
124
|
+
# J2000 = 2451545.0
|
|
131
125
|
|
|
132
126
|
# Julian Date of Modified Julian Date zero
|
|
133
127
|
# 1858, 11, 17, 0.0 midnight start of calendar reform = 2400000.5
|
|
134
|
-
MJD0 = 2400000.5
|
|
128
|
+
# MJD0 = 2400000.5
|
|
135
129
|
|
|
136
130
|
# 2Pi from Math module = Math::PI * 2.0
|
|
137
|
-
P2 = PI * 2.0
|
|
131
|
+
# P2 = PI * 2.0
|
|
138
132
|
|
|
139
|
-
#
|
|
140
|
-
PI
|
|
133
|
+
# from desktop calculator PI = 3.1415926535897932384626433832795
|
|
134
|
+
PI = 3.1415926535897932384626433832795
|
|
135
|
+
|
|
136
|
+
# from desktop calculator R2D = 57.295779513082320876798154814105
|
|
137
|
+
R2D = 57.295779513082320876798154814105
|
|
141
138
|
|
|
142
|
-
#
|
|
143
|
-
RTD =
|
|
139
|
+
# from desktop calculator RTD = 0.015915494309189533576888376337251
|
|
140
|
+
RTD = 0.015915494309189533576888376337251
|
|
144
141
|
|
|
145
|
-
# Sidereal minutes = 4.0 / 1.0027379093507953456536618754278
|
|
142
|
+
# from desktop calculator Sidereal minutes = 4.0 / 1.0027379093507953456536618754278
|
|
146
143
|
SM = 4.0 / 1.0027379093507953456536618754278
|
|
147
144
|
|
|
148
145
|
# Schwarzschild radius of the Sun (au) = 2 * 1.32712440041e20 / (2.99792458e8)^2 / 1.49597870700e11
|
|
149
|
-
SRS = 1.97412574336e-8
|
|
146
|
+
# SRS = 1.97412574336e-8
|
|
150
147
|
|
|
151
148
|
# TDB (s) at TAI 1977/1/1.0 = -6.55e-5
|
|
152
|
-
TDB0 = -6.55e-5
|
|
149
|
+
# TDB0 = -6.55e-5
|
|
153
150
|
|
|
154
151
|
# TT minus TAI (s) = 32.184
|
|
155
|
-
TTMTAI = 32.184
|
|
152
|
+
# TTMTAI = 32.184
|
|
156
153
|
|
|
157
154
|
# Arcseconds in a full circle = 1296000.0
|
|
158
|
-
TURNAS = 1296000.0
|
|
155
|
+
# TURNAS = 1296000.0
|
|
159
156
|
|
|
160
157
|
end
|
|
161
158
|
|
data/lib/eot/displays.rb
CHANGED
|
@@ -4,26 +4,29 @@ class Eot
|
|
|
4
4
|
|
|
5
5
|
# From displays.rb<br>
|
|
6
6
|
# String formatter for d:m:s display
|
|
7
|
-
def degrees_to_s(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
absolute_degrees =
|
|
7
|
+
def degrees_to_s( radians = 0.0 )
|
|
8
|
+
radians.nil? ? radians = 0.0 : radians
|
|
9
|
+
radians < 0 ? sign_string = "-" : sign_string = "+"
|
|
10
|
+
absolute_degrees = radians.abs * R2D
|
|
11
11
|
absolute_degrees_integer = Integer( absolute_degrees )
|
|
12
12
|
absolute_decimal_minutes = 60.0 *
|
|
13
13
|
(
|
|
14
14
|
absolute_degrees -
|
|
15
15
|
absolute_degrees_integer
|
|
16
16
|
)
|
|
17
|
+
|
|
17
18
|
absolute_minutes_integer = Integer( absolute_decimal_minutes )
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
|
|
20
|
+
absolute_decimal_seconds = 60.0 *
|
|
21
|
+
(
|
|
22
|
+
absolute_decimal_minutes -
|
|
23
|
+
absolute_minutes_integer
|
|
24
|
+
)
|
|
25
|
+
|
|
24
26
|
absolute_seconds_integer = Integer( absolute_decimal_seconds )
|
|
27
|
+
|
|
25
28
|
absolute_milli_seconds_integer = Integer(1000.0 *
|
|
26
|
-
|
|
29
|
+
(
|
|
27
30
|
absolute_decimal_seconds -
|
|
28
31
|
absolute_seconds_integer
|
|
29
32
|
)
|
|
@@ -60,8 +63,8 @@ class Eot
|
|
|
60
63
|
|
|
61
64
|
# From displays.rb<br>
|
|
62
65
|
# String format of apparent longitude
|
|
63
|
-
def string_al_Sun(
|
|
64
|
-
degrees_to_s( al_Sun(
|
|
66
|
+
def string_al_Sun()
|
|
67
|
+
degrees_to_s( al_Sun() )
|
|
65
68
|
end
|
|
66
69
|
alias_method :apparent_longitude_string, :string_al_Sun
|
|
67
70
|
|
|
@@ -83,27 +86,27 @@ class Eot
|
|
|
83
86
|
|
|
84
87
|
# From displays.rb<br>
|
|
85
88
|
# String format of declination
|
|
86
|
-
def string_dec_Sun(
|
|
87
|
-
degrees_to_s( dec_Sun(
|
|
89
|
+
def string_dec_Sun()
|
|
90
|
+
degrees_to_s( dec_Sun() )
|
|
88
91
|
end
|
|
89
92
|
alias_method :declination_string, :string_dec_Sun
|
|
90
93
|
|
|
91
94
|
# From displays.rb<br>
|
|
92
95
|
# String format for delta oblique
|
|
93
|
-
def string_delta_oblique(
|
|
94
|
-
show_minutes(delta_oblique(
|
|
96
|
+
def string_delta_oblique()
|
|
97
|
+
show_minutes(delta_oblique())
|
|
95
98
|
end
|
|
96
99
|
|
|
97
100
|
# From displays.rb<br>
|
|
98
101
|
# String format for delta orbit
|
|
99
|
-
def string_delta_orbit(
|
|
100
|
-
show_minutes(delta_orbit(
|
|
102
|
+
def string_delta_orbit()
|
|
103
|
+
show_minutes(delta_orbit())
|
|
101
104
|
end
|
|
102
105
|
|
|
103
106
|
# From displays.rb<br>
|
|
104
107
|
# String format for centre
|
|
105
|
-
def string_eqc(
|
|
106
|
-
degrees_to_s( center(
|
|
108
|
+
def string_eqc()
|
|
109
|
+
degrees_to_s( center())
|
|
107
110
|
end
|
|
108
111
|
|
|
109
112
|
# From displays.rb<br>
|
|
@@ -129,7 +132,7 @@ class Eot
|
|
|
129
132
|
|
|
130
133
|
# From displays.rb<br>
|
|
131
134
|
# String format conversion of jd to date
|
|
132
|
-
def string_jd_to_date( jd =
|
|
135
|
+
def string_jd_to_date( jd = DJ00 )
|
|
133
136
|
jd = check_jd_zero( jd )
|
|
134
137
|
Date.jd( jd ).to_s
|
|
135
138
|
end
|
|
@@ -144,15 +147,15 @@ class Eot
|
|
|
144
147
|
|
|
145
148
|
# From displays.rb<br>
|
|
146
149
|
# String format of right ascension
|
|
147
|
-
def string_ra_Sun(
|
|
148
|
-
degrees_to_s( ra_Sun(
|
|
150
|
+
def string_ra_Sun()
|
|
151
|
+
degrees_to_s( ra_Sun() )
|
|
149
152
|
end
|
|
150
153
|
alias_method :right_ascension_string, :string_ra_Sun
|
|
151
154
|
|
|
152
155
|
# From displays.rb<br>
|
|
153
156
|
# String format of true anomaly
|
|
154
|
-
def string_ta_Sun(
|
|
155
|
-
degrees_to_s( ta_Sun(
|
|
157
|
+
def string_ta_Sun( )
|
|
158
|
+
degrees_to_s( ta_Sun() )
|
|
156
159
|
end
|
|
157
160
|
alias_method :true_anomaly_string, :string_ta_Sun
|
|
158
161
|
|
|
@@ -168,13 +171,13 @@ class Eot
|
|
|
168
171
|
intsecs = Integer( seconds )
|
|
169
172
|
decsecs = Integer(( seconds - intsecs ).round( 3 ) * 1000.0 )
|
|
170
173
|
else
|
|
171
|
-
decimal
|
|
172
|
-
hours
|
|
173
|
-
mindecimal =
|
|
174
|
-
minutes
|
|
175
|
-
seconds
|
|
176
|
-
intsecs
|
|
177
|
-
decsecs
|
|
174
|
+
decimal = dt % DAY_HOURS
|
|
175
|
+
hours = Integer( decimal )
|
|
176
|
+
mindecimal = 60.0 * ( decimal - hours )
|
|
177
|
+
minutes = Integer( mindecimal )
|
|
178
|
+
seconds = 60.0 * ( mindecimal - minutes )
|
|
179
|
+
intsecs = Integer( seconds )
|
|
180
|
+
decsecs = Integer(( seconds - intsecs ).round( 3 ) * 1000.0 )
|
|
178
181
|
end
|
|
179
182
|
|
|
180
183
|
"%02d" % hours +
|
|
@@ -189,15 +192,15 @@ class Eot
|
|
|
189
192
|
|
|
190
193
|
# From displays.rb<br>
|
|
191
194
|
# String format of true longitude
|
|
192
|
-
def string_tl_Sun(
|
|
193
|
-
degrees_to_s( tl_Sun(
|
|
195
|
+
def string_tl_Sun()
|
|
196
|
+
degrees_to_s( tl_Sun() )
|
|
194
197
|
end
|
|
195
198
|
alias_method :true_longitude_string, :string_tl_Sun
|
|
196
199
|
|
|
197
200
|
# From displays.rb<br>
|
|
198
201
|
# String format of true obliquity
|
|
199
|
-
def string_to_Earth(
|
|
200
|
-
degrees_to_s( to_Earth(
|
|
202
|
+
def string_to_Earth()
|
|
203
|
+
degrees_to_s( to_Earth() )
|
|
201
204
|
end
|
|
202
205
|
alias_method :true_obliquity_string, :string_to_Earth
|
|
203
206
|
|
data/lib/eot/geo_lat_lng_smt.rb
CHANGED
|
@@ -8,7 +8,7 @@ require 'rest-client'
|
|
|
8
8
|
class GeoLatLng
|
|
9
9
|
|
|
10
10
|
# Base address for Google maps api
|
|
11
|
-
attr_reader :base
|
|
11
|
+
attr_reader :base
|
|
12
12
|
|
|
13
13
|
# Default US set to PARCS
|
|
14
14
|
attr_reader :default_us
|
|
@@ -37,7 +37,8 @@ class GeoLatLng
|
|
|
37
37
|
@lat = 0.0
|
|
38
38
|
@lng = 0.0
|
|
39
39
|
MultiXml.parser = :rexml#:libxml#:ox # :nokogiri
|
|
40
|
-
|
|
40
|
+
@addr = @default_int
|
|
41
|
+
|
|
41
42
|
end
|
|
42
43
|
|
|
43
44
|
# set address
|
|
@@ -56,13 +57,13 @@ class GeoLatLng
|
|
|
56
57
|
result = parsed_res[ "GeocodeResponse" ][ "result" ]
|
|
57
58
|
status = parsed_res[ "GeocodeResponse" ][ "status" ]
|
|
58
59
|
if status != "OK"
|
|
59
|
-
@
|
|
60
|
+
@default_int
|
|
60
61
|
else
|
|
61
62
|
if result.count != 4
|
|
62
|
-
@
|
|
63
|
+
@default_int
|
|
63
64
|
else
|
|
64
|
-
@lat = parsed_res[ "GeocodeResponse" ][ "result" ][ "geometry" ][ "location" ][ "lat" ]
|
|
65
|
-
@lng = parsed_res[ "GeocodeResponse" ][ "result" ][ "geometry" ][ "location" ][ "lng" ]
|
|
65
|
+
@lat = parsed_res[ "GeocodeResponse" ][ "result" ][ "geometry" ][ "location" ][ "lat" ].to_f
|
|
66
|
+
@lng = parsed_res[ "GeocodeResponse" ][ "result" ][ "geometry" ][ "location" ][ "lng" ].to_f
|
|
66
67
|
end
|
|
67
68
|
end
|
|
68
69
|
|
data/lib/eot/init.rb
CHANGED
|
@@ -1,76 +1,91 @@
|
|
|
1
1
|
# init.rb
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
require 'celes'
|
|
4
|
+
require_relative 'geo_lat_lng_smt'
|
|
5
|
+
require_relative 'times'
|
|
4
6
|
|
|
7
|
+
class Eot
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# From init.rb:<br>
|
|
11
|
+
# address used for GeoLatLng.addr
|
|
12
|
+
attr_accessor :addr
|
|
13
|
+
|
|
5
14
|
# From init.rb:<br>
|
|
6
|
-
# Astronomical Julian Day Number is an instance of
|
|
7
|
-
# When new Equation of Time class is initialized @ajd =
|
|
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.
|
|
15
|
+
# Astronomical Julian Day Number is an instance of DateTime class.
|
|
16
|
+
# When new Equation of Time class is initialized @ajd = DateTime.jd
|
|
10
17
|
attr_accessor :ajd
|
|
18
|
+
|
|
19
|
+
# Method for change of @ajd from the default so @ma will get set anew.
|
|
20
|
+
# Calling ma_Sun method will set @ta so be sure to not set @ma directly.
|
|
21
|
+
def ajd=(ajd)
|
|
22
|
+
@ajd = ajd.to_f
|
|
23
|
+
@ta = (( @ajd - DJ00 ) / DJC).to_f
|
|
24
|
+
@ma = Celes.falp03(@ta)
|
|
25
|
+
end
|
|
11
26
|
|
|
12
27
|
# From init.rb:<br>
|
|
13
28
|
# Nutation Data is an instance of Array class.
|
|
14
29
|
# @data = nutation_table5_3a.yaml
|
|
15
30
|
# YAML File loaded when new Eot class is initialized.
|
|
16
|
-
attr_reader :data
|
|
31
|
+
#attr_reader :data
|
|
17
32
|
|
|
18
33
|
# From init.rb:<br>
|
|
19
|
-
# @date is an instance of
|
|
20
|
-
# When new Eot class is initialized @date =
|
|
34
|
+
# @date is an instance of DateTime class.
|
|
35
|
+
# When new Eot class is initialized @date = now UTC
|
|
21
36
|
attr_accessor :date
|
|
22
37
|
|
|
23
38
|
# From init.rb:<br>
|
|
24
|
-
# Julian Day Number is an instance of
|
|
25
|
-
# When new Eot class is initialized @jd = jd
|
|
39
|
+
# Julian Day Number is an instance of DateTime class.
|
|
40
|
+
# When new Eot class is initialized @jd = DateTime.jd
|
|
26
41
|
attr_accessor :jd
|
|
27
42
|
|
|
28
43
|
# From init.rb:<br>
|
|
29
44
|
# Latitude input is an instance of Float class.
|
|
30
45
|
# When new Eot class is initialized @latitude = 0.0
|
|
31
|
-
# May use GeoLatLng class to set it also but
|
|
32
|
-
# internet connection is present
|
|
46
|
+
# May use GeoLatLng class to set it also but please comment that out
|
|
47
|
+
# if no internet connection is present via proxies or firewalls :D
|
|
33
48
|
attr_accessor :latitude
|
|
34
49
|
|
|
35
50
|
# From init.rb:<br>
|
|
36
51
|
# Longitude input is an instance of Float class.
|
|
37
52
|
# When new Eot class is initialized @longitude = 0.0
|
|
38
|
-
# May use GeoLatLng class to set it also but
|
|
39
|
-
# internet connection is present
|
|
53
|
+
# May use GeoLatLng class to set it also but please comment that out
|
|
54
|
+
# if no internet connection is present via proxies or firewalls :D
|
|
40
55
|
attr_accessor :longitude
|
|
41
56
|
|
|
42
57
|
# From init.rb:<br>
|
|
43
|
-
# Mean Anomaly gets called a lot so attribute
|
|
58
|
+
# Mean Anomaly gets called a lot so class attribute saves it.
|
|
44
59
|
attr_accessor :ma
|
|
60
|
+
|
|
45
61
|
|
|
46
62
|
# From init.rb:<br>
|
|
47
|
-
#
|
|
48
|
-
|
|
49
|
-
|
|
63
|
+
# JCT gets called a lot so class attribute it.
|
|
64
|
+
# Setting @ajd or @ma will set this
|
|
65
|
+
attr_accessor :ta
|
|
50
66
|
|
|
51
67
|
# From init.rb:<br>
|
|
52
|
-
# Initialize
|
|
68
|
+
# Initialize to set attributes
|
|
53
69
|
# You may use GeoLatLng to set up @latitude and @longitude but you need to have
|
|
54
|
-
# internet so
|
|
70
|
+
# internet so if not please comment it out for now.
|
|
55
71
|
def initialize(addr=nil)
|
|
56
72
|
|
|
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
|
|
73
|
+
# file_path = File.expand_path( File.dirname( __FILE__ ) + "/nutation_table5_3a.yaml" )
|
|
74
|
+
# @data = YAML::load( File.open( file_path, 'r'), :safe => true ).freeze
|
|
59
75
|
|
|
60
|
-
|
|
61
|
-
@
|
|
62
|
-
@jd
|
|
63
|
-
@
|
|
64
|
-
@
|
|
65
|
-
@ma
|
|
66
|
-
|
|
67
|
-
#
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
#@longitude = geo.lng.to_f
|
|
76
|
+
# set all date and time from this attribute
|
|
77
|
+
@ajd = DateTime.now.to_time.utc.to_datetime.jd.to_f
|
|
78
|
+
@jd = @ajd
|
|
79
|
+
@date = ajd_to_datetime(@ajd)
|
|
80
|
+
@ta = (( @ajd - DJ00 ) / DJC).to_f
|
|
81
|
+
@ma = Celes.falp03(@ta)
|
|
82
|
+
|
|
83
|
+
# comment out below if you do not have internet connection
|
|
84
|
+
geo = GeoLatLng.new()
|
|
85
|
+
@addr = geo.addr
|
|
86
|
+
geo.get_coordinates_from_address
|
|
87
|
+
@latitude.nil? ? @latitude = geo.lat : @latitude
|
|
88
|
+
@longitude.nil? ? @longitude = geo.lng : @longitude
|
|
74
89
|
end
|
|
75
90
|
|
|
76
91
|
end
|
|
@@ -80,12 +95,20 @@ end
|
|
|
80
95
|
if __FILE__ == $PROGRAM_NAME
|
|
81
96
|
|
|
82
97
|
lib = File.expand_path('../../../lib', __FILE__)
|
|
83
|
-
puts "Loading gem from #{lib}/eot.rb"
|
|
84
98
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
85
99
|
require 'eot'
|
|
86
|
-
|
|
87
|
-
|
|
100
|
+
eot = Eot.new
|
|
101
|
+
|
|
102
|
+
p eot.ajd
|
|
103
|
+
p eot.date
|
|
104
|
+
p eot.jd
|
|
88
105
|
|
|
106
|
+
p eot.ma
|
|
107
|
+
p eot.ta
|
|
108
|
+
p eot.addr
|
|
109
|
+
p eot.latitude
|
|
110
|
+
p eot.longitude
|
|
111
|
+
|
|
89
112
|
spec = File.expand_path('../../../tests/minitest', __FILE__)
|
|
90
113
|
$LOAD_PATH.unshift(spec) unless $LOAD_PATH.include?(spec)
|
|
91
114
|
require 'init_spec'
|