equationoftime 4.0.0 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +8 -3
- data/Gemfile.lock +48 -0
- data/README.md +22 -19
- data/Rakefile +14 -7
- data/equationoftime.gemspec +9 -6
- data/ext/ceot/ceot.c +52 -0
- data/ext/ceot/eot.c +79 -0
- data/ext/ceot/eot.h +8 -0
- data/ext/ceot/extconf.rb +5 -0
- data/lib/eot.rb +2 -1
- data/lib/eot/angles.rb +44 -43
- data/lib/eot/init.rb +13 -6
- data/lib/eot/version.rb +1 -1
- data/wiki.md +6 -7
- metadata +26 -255
- data/.settings/org.eclipse.ltk.core.refactoring.prefs +0 -2
- data/Makefile +0 -238
- data/analemma_data.yml +0 -2925
- data/examples/Equation_of_Time.jpg +0 -0
- data/examples/analemma_data_generator.rb +0 -53
- data/examples/celes_parts/.RUBYARCHDIR.time +0 -0
- data/examples/celes_parts/.cproject +0 -56
- data/examples/celes_parts/.project +0 -78
- data/examples/celes_parts/a2af.c +0 -120
- data/examples/celes_parts/a2tf.c +0 -116
- data/examples/celes_parts/af2a.c +0 -107
- data/examples/celes_parts/anp.c +0 -82
- data/examples/celes_parts/anpm.c +0 -82
- data/examples/celes_parts/bi00.c +0 -116
- data/examples/celes_parts/bp00.c +0 -173
- data/examples/celes_parts/bp06.c +0 -136
- data/examples/celes_parts/bpn2xy.c +0 -100
- data/examples/celes_parts/c2i00a.c +0 -139
- data/examples/celes_parts/c2i00b.c +0 -139
- data/examples/celes_parts/c2i06a.c +0 -136
- data/examples/celes_parts/c2ibpn.c +0 -142
- data/examples/celes_parts/c2ixy.c +0 -131
- data/examples/celes_parts/c2ixys.c +0 -123
- data/examples/celes_parts/c2s.c +0 -96
- data/examples/celes_parts/c2t00a.c +0 -154
- data/examples/celes_parts/c2t00b.c +0 -150
- data/examples/celes_parts/c2t06a.c +0 -152
- data/examples/celes_parts/c2tcio.c +0 -122
- data/examples/celes_parts/c2teqx.c +0 -122
- data/examples/celes_parts/c2tpe.c +0 -167
- data/examples/celes_parts/c2txy.c +0 -159
- data/examples/celes_parts/cal2jd.c +0 -139
- data/examples/celes_parts/celes_core.c +0 -2522
- data/examples/celes_parts/cp.c +0 -80
- data/examples/celes_parts/cpv.c +0 -82
- data/examples/celes_parts/cr.c +0 -83
- data/examples/celes_parts/d2dtf.c +0 -206
- data/examples/celes_parts/d2tf.c +0 -160
- data/examples/celes_parts/dat.c +0 -289
- data/examples/celes_parts/depend +0 -25
- data/examples/celes_parts/dtdb.c +0 -1213
- data/examples/celes_parts/dtf2d.c +0 -196
- data/examples/celes_parts/ee00.c +0 -128
- data/examples/celes_parts/ee00a.c +0 -135
- data/examples/celes_parts/ee00b.c +0 -141
- data/examples/celes_parts/ee06a.c +0 -122
- data/examples/celes_parts/eect00.c +0 -282
- data/examples/celes_parts/eform.c +0 -147
- data/examples/celes_parts/eo06a.c +0 -131
- data/examples/celes_parts/eors.c +0 -108
- data/examples/celes_parts/epb.c +0 -96
- data/examples/celes_parts/epb2jd.c +0 -91
- data/examples/celes_parts/epj.c +0 -93
- data/examples/celes_parts/epj2jd.c +0 -91
- data/examples/celes_parts/epv00.c +0 -2589
- data/examples/celes_parts/eqeq94.c +0 -131
- data/examples/celes_parts/era00.c +0 -136
- data/examples/celes_parts/extconf.rb +0 -4
- data/examples/celes_parts/fad03.c +0 -103
- data/examples/celes_parts/fae03.c +0 -102
- data/examples/celes_parts/faf03.c +0 -106
- data/examples/celes_parts/faju03.c +0 -102
- data/examples/celes_parts/fal03.c +0 -103
- data/examples/celes_parts/falp03.c +0 -103
- data/examples/celes_parts/fama03.c +0 -102
- data/examples/celes_parts/fame03.c +0 -102
- data/examples/celes_parts/fane03.c +0 -99
- data/examples/celes_parts/faom03.c +0 -104
- data/examples/celes_parts/fapa03.c +0 -103
- data/examples/celes_parts/fasa03.c +0 -102
- data/examples/celes_parts/faur03.c +0 -99
- data/examples/celes_parts/fave03.c +0 -102
- data/examples/celes_parts/fk52h.c +0 -143
- data/examples/celes_parts/fk5hip.c +0 -126
- data/examples/celes_parts/fk5hz.c +0 -160
- data/examples/celes_parts/fw2m.c +0 -134
- data/examples/celes_parts/fw2xy.c +0 -120
- data/examples/celes_parts/gc2gd.c +0 -134
- data/examples/celes_parts/gc2gde.c +0 -200
- data/examples/celes_parts/gd2gc.c +0 -134
- data/examples/celes_parts/gd2gce.c +0 -138
- data/examples/celes_parts/gmst00.c +0 -145
- data/examples/celes_parts/gmst06.c +0 -136
- data/examples/celes_parts/gmst82.c +0 -151
- data/examples/celes_parts/gst00a.c +0 -138
- data/examples/celes_parts/gst00b.c +0 -146
- data/examples/celes_parts/gst06.c +0 -140
- data/examples/celes_parts/gst06a.c +0 -131
- data/examples/celes_parts/gst94.c +0 -131
- data/examples/celes_parts/h2fk5.c +0 -148
- data/examples/celes_parts/hfk5z.c +0 -175
- data/examples/celes_parts/ir.c +0 -83
- data/examples/celes_parts/jd2cal.c +0 -155
- data/examples/celes_parts/jdcalf.c +0 -161
- data/examples/celes_parts/num00a.c +0 -121
- data/examples/celes_parts/num00b.c +0 -121
- data/examples/celes_parts/num06a.c +0 -125
- data/examples/celes_parts/numat.c +0 -109
- data/examples/celes_parts/nut00a.c +0 -2047
- data/examples/celes_parts/nut00b.c +0 -372
- data/examples/celes_parts/nut06a.c +0 -153
- data/examples/celes_parts/nut80.c +0 -325
- data/examples/celes_parts/nutm80.c +0 -117
- data/examples/celes_parts/obl06.c +0 -118
- data/examples/celes_parts/obl80.c +0 -118
- data/examples/celes_parts/p06e.c +0 -321
- data/examples/celes_parts/p2pv.c +0 -83
- data/examples/celes_parts/p2s.c +0 -91
- data/examples/celes_parts/pap.c +0 -139
- data/examples/celes_parts/pas.c +0 -96
- data/examples/celes_parts/pb06.c +0 -144
- data/examples/celes_parts/pdp.c +0 -84
- data/examples/celes_parts/pfw06.c +0 -165
- data/examples/celes_parts/plan94.c +0 -514
- data/examples/celes_parts/pm.c +0 -83
- data/examples/celes_parts/pmat00.c +0 -118
- data/examples/celes_parts/pmat06.c +0 -122
- data/examples/celes_parts/pmat76.c +0 -141
- data/examples/celes_parts/pmp.c +0 -85
- data/examples/celes_parts/pn.c +0 -109
- data/examples/celes_parts/pn00.c +0 -177
- data/examples/celes_parts/pn00a.c +0 -162
- data/examples/celes_parts/pn00b.c +0 -162
- data/examples/celes_parts/pn06.c +0 -187
- data/examples/celes_parts/pn06a.c +0 -152
- data/examples/celes_parts/pnm00a.c +0 -121
- data/examples/celes_parts/pnm00b.c +0 -121
- data/examples/celes_parts/pnm06a.c +0 -124
- data/examples/celes_parts/pnm80.c +0 -126
- data/examples/celes_parts/pom00.c +0 -115
- data/examples/celes_parts/ppp.c +0 -85
- data/examples/celes_parts/ppsp.c +0 -94
- data/examples/celes_parts/pr00.c +0 -142
- data/examples/celes_parts/prec76.c +0 -148
- data/examples/celes_parts/pv2p.c +0 -81
- data/examples/celes_parts/pv2s.c +0 -144
- data/examples/celes_parts/pvdpv.c +0 -102
- data/examples/celes_parts/pvm.c +0 -86
- data/examples/celes_parts/pvmpv.c +0 -87
- data/examples/celes_parts/pvppv.c +0 -87
- data/examples/celes_parts/pvstar.c +0 -207
- data/examples/celes_parts/pvu.c +0 -93
- data/examples/celes_parts/pvup.c +0 -88
- data/examples/celes_parts/pvxpv.c +0 -107
- data/examples/celes_parts/pxp.c +0 -94
- data/examples/celes_parts/rm2v.c +0 -111
- data/examples/celes_parts/rv2m.c +0 -118
- data/examples/celes_parts/rx.c +0 -110
- data/examples/celes_parts/rxp.c +0 -99
- data/examples/celes_parts/rxpv.c +0 -86
- data/examples/celes_parts/rxr.c +0 -99
- data/examples/celes_parts/ry.c +0 -110
- data/examples/celes_parts/rz.c +0 -110
- data/examples/celes_parts/s00.c +0 -371
- data/examples/celes_parts/s00a.c +0 -143
- data/examples/celes_parts/s00b.c +0 -143
- data/examples/celes_parts/s06.c +0 -368
- data/examples/celes_parts/s06a.c +0 -145
- data/examples/celes_parts/s2c.c +0 -85
- data/examples/celes_parts/s2p.c +0 -88
- data/examples/celes_parts/s2pv.c +0 -103
- data/examples/celes_parts/s2xpv.c +0 -87
- data/examples/celes_parts/sepp.c +0 -105
- data/examples/celes_parts/seps.c +0 -93
- data/examples/celes_parts/sofa.h +0 -379
- data/examples/celes_parts/sofam.h +0 -155
- data/examples/celes_parts/sp00.c +0 -118
- data/examples/celes_parts/starpm.c +0 -205
- data/examples/celes_parts/starpv.c +0 -264
- data/examples/celes_parts/sxp.c +0 -84
- data/examples/celes_parts/sxpv.c +0 -85
- data/examples/celes_parts/taitt.c +0 -110
- data/examples/celes_parts/taiut1.c +0 -112
- data/examples/celes_parts/taiutc.c +0 -182
- data/examples/celes_parts/tcbtdb.c +0 -132
- data/examples/celes_parts/tcgtt.c +0 -109
- data/examples/celes_parts/tdbtcb.c +0 -137
- data/examples/celes_parts/tdbtt.c +0 -122
- data/examples/celes_parts/test_celes.rb +0 -48
- data/examples/celes_parts/tf2a.c +0 -107
- data/examples/celes_parts/tf2d.c +0 -107
- data/examples/celes_parts/tr.c +0 -93
- data/examples/celes_parts/trxp.c +0 -93
- data/examples/celes_parts/trxpv.c +0 -93
- data/examples/celes_parts/tttai.c +0 -110
- data/examples/celes_parts/tttcg.c +0 -112
- data/examples/celes_parts/tttdb.c +0 -121
- data/examples/celes_parts/ttut1.c +0 -110
- data/examples/celes_parts/ut1tai.c +0 -111
- data/examples/celes_parts/ut1tt.c +0 -110
- data/examples/celes_parts/ut1utc.c +0 -193
- data/examples/celes_parts/utctai.c +0 -163
- data/examples/celes_parts/utcut1.c +0 -151
- data/examples/celes_parts/xy06.c +0 -2758
- data/examples/celes_parts/xys00a.c +0 -133
- data/examples/celes_parts/xys00b.c +0 -133
- data/examples/celes_parts/xys06a.c +0 -133
- data/examples/celes_parts/zp.c +0 -77
- data/examples/celes_parts/zpv.c +0 -79
- data/examples/celes_parts/zr.c +0 -83
- data/examples/check_date_type.rb +0 -55
- data/examples/compare_geoc_long_ra.rb +0 -39
- data/examples/data_table_for_astro_dog.rb +0 -40
- data/examples/earth_rotation.rb +0 -38
- data/examples/eot.c +0 -15
- data/examples/eot.h +0 -2
- data/examples/eot_methods_list.rb +0 -43
- data/examples/eot_plot.r +0 -57
- data/examples/eot_suntimes.rb +0 -144
- data/examples/equation_of_time.py +0 -186
- data/examples/extconf.rb +0 -2
- data/examples/figure_1.jpg +0 -0
- data/examples/file_converter.rb +0 -31
- data/examples/from_readme.rb +0 -10
- data/examples/geo_locator.rb +0 -12
- data/examples/getjd.rb +0 -45
- data/examples/gmst_gast_non_sofa.rb +0 -404
- data/examples/input_suntimes.rb +0 -21
- data/examples/julian_day_formula.rb +0 -29
- data/examples/julian_day_formula.txt +0 -12
- data/examples/my_time_conversion.rb +0 -21
- data/examples/nutation_series.txt +0 -678
- data/examples/nutation_series.yaml +0 -14239
- data/examples/nutation_table5_3a.txt +0 -682
- data/examples/nutation_table5_3a.yaml +0 -9532
- data/examples/ptime.rb +0 -162
- data/examples/rbeot.c +0 -24
- data/examples/suntimes.rb +0 -28
- data/examples/suntimes_test.rb +0 -47
- data/examples/test_eot.rb +0 -17
- data/examples/test_poly_eval.rb +0 -27
- data/examples/time_scales.rb +0 -26
- data/examples/times_year.rb +0 -50
- data/examples/usage_example.rb +0 -23
- data/examples/use_angles.rb +0 -219
- data/rise_set_data.yml +0 -1461
- data/tests/minitest/aliased_angles_spec.rb +0 -241
- data/tests/minitest/aliased_displays_spec.rb +0 -108
- data/tests/minitest/aliased_utilities_spec.rb +0 -38
- data/tests/minitest/angles_spec.rb +0 -266
- data/tests/minitest/constants_spec.rb +0 -21
- data/tests/minitest/delta_epsilon_spec.rb +0 -32
- data/tests/minitest/displays_spec.rb +0 -113
- data/tests/minitest/geo_spec.rb +0 -40
- data/tests/minitest/init_spec.rb +0 -46
- data/tests/minitest/nutation_spec.rb +0 -39
- data/tests/minitest/times_spec.rb +0 -139
- data/tests/minitest/utilities_spec.rb +0 -37
- data/tests/spec_config.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bbe68b6f756ff39bd440ad62c0f6209c87399db
|
4
|
+
data.tar.gz: b5927f2e937a02fa15c48a09eb04d4abbe54c358
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b64380f519afa2d4d1caaabd7a7991dd222430475ca4f1c40fce4e8f76f2be889bec4d16d01dc3e06db1f454f92d32d1b4780fbd1f51b822b9217970ccdb00bb
|
7
|
+
data.tar.gz: f4c5c5b927e7a0dd1aa66d40746d339563ed8bca8462fcea8d183b628a22b8edce2a55709c4e02febc8e4ce142b90e81280449b4bfca800801e15a17657df284
|
data/.gitignore
CHANGED
@@ -1,15 +1,16 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
.gem
|
2
|
+
.rbc
|
3
3
|
.rspec
|
4
4
|
.bundle
|
5
5
|
.config
|
6
|
+
.settings
|
6
7
|
.yardoc
|
7
8
|
Gemfile.lock
|
9
|
+
|
8
10
|
InstalledFiles
|
9
11
|
_yardoc
|
10
12
|
coverage
|
11
13
|
doc
|
12
|
-
|
13
14
|
lib/bundler/man
|
14
15
|
pkg
|
15
16
|
rdoc
|
@@ -17,3 +18,7 @@ spec/reports
|
|
17
18
|
test/tmp
|
18
19
|
test/version_tmp
|
19
20
|
tmp
|
21
|
+
ext/ceot/*.o
|
22
|
+
ext/ceot/*.so
|
23
|
+
ext/ceot/Makefile
|
24
|
+
lib/*.so
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
equationoftime (4.1.1)
|
5
|
+
celes
|
6
|
+
multi_xml
|
7
|
+
rest-client
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
celes (0.0.1)
|
13
|
+
diff-lcs (1.2.5)
|
14
|
+
mime-types (2.3)
|
15
|
+
minitest (5.4.1)
|
16
|
+
multi_xml (0.5.5)
|
17
|
+
netrc (0.7.7)
|
18
|
+
rake (10.3.2)
|
19
|
+
rake-compiler (0.9.3)
|
20
|
+
rake
|
21
|
+
rest-client (1.7.2)
|
22
|
+
mime-types (>= 1.16, < 3.0)
|
23
|
+
netrc (~> 0.7)
|
24
|
+
rspec (3.0.0)
|
25
|
+
rspec-core (~> 3.0.0)
|
26
|
+
rspec-expectations (~> 3.0.0)
|
27
|
+
rspec-mocks (~> 3.0.0)
|
28
|
+
rspec-core (3.0.4)
|
29
|
+
rspec-support (~> 3.0.0)
|
30
|
+
rspec-expectations (3.0.4)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.0.0)
|
33
|
+
rspec-mocks (3.0.4)
|
34
|
+
rspec-support (~> 3.0.0)
|
35
|
+
rspec-support (3.0.4)
|
36
|
+
yard (0.8.7.4)
|
37
|
+
|
38
|
+
PLATFORMS
|
39
|
+
ruby
|
40
|
+
|
41
|
+
DEPENDENCIES
|
42
|
+
bundler (~> 1.5)
|
43
|
+
equationoftime!
|
44
|
+
minitest
|
45
|
+
rake
|
46
|
+
rake-compiler
|
47
|
+
rspec
|
48
|
+
yard
|
data/README.md
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
[![Gem Version](https://badge.fury.io/rb/equationoftime.png)](http://badge.fury.io/rb/equationoftime)
|
2
|
-
|
3
|
-
##[*Graphic Plot 1*](https://github.com/DouglasAllen/equationoftime
|
4
|
-
|
2
|
+
|
3
|
+
##[*Graphic Plot 1*](https://github.com/DouglasAllen/equationoftime/blob/master/examples/figure_1.jpg)
|
4
|
+
created from [*equation_of_time.py*](https://bitbucket.org/cmcqueen1975/sundials/src/26a0f54a7c18fc3b54a3a4cff4f79192fcef1a91/equation_of_time.py?at=default)
|
5
|
+
|
6
|
+
[*Graphic Plot 1*](https://github.com/DouglasAllen/equationoftime/blob/master/examples/equation_of_time.py)
|
7
|
+
|
8
|
+
##[*Graphic Plot 2*](https://github.com/DouglasAllen/equationoftime/blob/master/examples/Equation_of_Time.jpg) created from [*R script*](http://en.wikipedia.org/wiki/File:Zeitgleichung.png)
|
5
9
|
##[*Solar Time*](http://www.maa.mhn.de/Scholar/times.html#solar)
|
6
10
|
##[*Web Calculator*](http://www.nature1st.net/bogan/astro/time/jsjdetst.html)
|
7
11
|
# equationoftime gem
|
@@ -12,23 +16,23 @@
|
|
12
16
|
|
13
17
|
Fork it and Clone it:
|
14
18
|
|
15
|
-
$ git clone git@github.com:DouglasAllen/equationoftime
|
19
|
+
$ git clone git@github.com:DouglasAllen/equationoftime.git
|
16
20
|
|
17
21
|
Enter dir:
|
18
22
|
|
19
|
-
$ cd equationoftime
|
23
|
+
$ cd equationoftime
|
20
24
|
|
21
25
|
Execute:
|
22
26
|
|
23
|
-
$ bundle
|
27
|
+
$ bundle install
|
24
28
|
|
25
|
-
|
29
|
+
Build extension:
|
26
30
|
|
27
|
-
$ rake
|
31
|
+
$ rake compile:ceot
|
28
32
|
|
29
|
-
|
33
|
+
Run minitest tests:
|
30
34
|
|
31
|
-
$ rake
|
35
|
+
$ rake
|
32
36
|
|
33
37
|
Local install of gem build:
|
34
38
|
|
@@ -41,7 +45,7 @@ Add this line to your application's Gemfile:
|
|
41
45
|
|
42
46
|
And then execute:
|
43
47
|
|
44
|
-
$ bundle
|
48
|
+
$ bundle install
|
45
49
|
|
46
50
|
Or install it yourself as:
|
47
51
|
|
@@ -52,24 +56,23 @@ Or install it yourself as:
|
|
52
56
|
$ irb --simple-prompt
|
53
57
|
|
54
58
|
require 'eot'
|
55
|
-
eot = Eot.new
|
59
|
+
eot = Eot.new
|
56
60
|
eot.string_eot()
|
57
61
|
|
58
|
-
#[Wikis](https://github.com/DouglasAllen/equationoftime
|
59
|
-
|
60
|
-
|
61
|
-
Notes:
|
62
|
-
|
63
|
-
1. for other time equations see:[*gist 2032003*](https://gist.github.com/2032003)
|
62
|
+
#[Wikis](https://github.com/DouglasAllen/equationoftime/blob/master/wiki.md)
|
64
63
|
|
65
64
|
|
66
65
|
Suggestions:
|
67
66
|
|
68
67
|
1. http://equationoftime.herokuapp.com/analemma Itererates through a years worth of dates and computes analemma data.
|
69
68
|
2. A file is included in examples named analemma_data_generator.rb and may help you get started.
|
70
|
-
3. See the [*astro dog*](https://github.com/DouglasAllen/Sinatra-projects/tree/master/astro_dog) project
|
69
|
+
3. See the [*astro dog*](https://github.com/DouglasAllen/Sinatra-projects/tree/master/astro_dog) project or the web post [*Heroku*](http://equationoftime.herokuapp.com/) for more info about the Equation of Time.
|
71
70
|
4. See the wikis for more usage examples.
|
72
71
|
|
72
|
+
Notes:
|
73
|
+
|
74
|
+
1. for other time equations see:[*gist 2032003*](https://gist.github.com/2032003)
|
75
|
+
|
73
76
|
Contributing:
|
74
77
|
|
75
78
|
1. Fork it
|
data/Rakefile
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
-
|
2
|
+
=begin
|
3
3
|
require 'thor'
|
4
4
|
require 'bundler'
|
5
5
|
require 'rbconfig'
|
@@ -35,7 +35,7 @@ module Bundler
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
38
|
-
|
38
|
+
=end
|
39
39
|
# require "bundler/install_tasks"
|
40
40
|
|
41
41
|
require 'rspec/core/rake_task'
|
@@ -43,10 +43,17 @@ require 'rspec/core/rake_task'
|
|
43
43
|
|
44
44
|
task :default => [ :test ]
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
46
|
+
RSpec::Core::RakeTask.new(:spec) do | t |
|
47
|
+
t.pattern = "./tests/minitest/*_spec.rb"
|
48
|
+
t.rspec_opts = []
|
49
|
+
end
|
50
|
+
|
51
|
+
require 'rake/extensiontask'
|
52
|
+
spec = Gem::Specification.load('equationoftime.gemspec')
|
53
|
+
Rake::ExtensionTask.new('ceot', spec)
|
54
|
+
#Rake::ExtensionTask.new "ceot" do |ext|
|
55
|
+
#ext.lib_dir = "lib"
|
56
|
+
#end
|
50
57
|
|
51
58
|
require 'rake/testtask'
|
52
59
|
|
@@ -114,4 +121,4 @@ Rake::RDocTask.new(:rdox) do |rd|
|
|
114
121
|
|
115
122
|
rd.options << '--line-numbers'
|
116
123
|
|
117
|
-
end
|
124
|
+
end
|
data/equationoftime.gemspec
CHANGED
@@ -10,22 +10,25 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.authors = ["DouglasAllen"]
|
11
11
|
spec.email = ["kb9agt@gmail.com"]
|
12
12
|
spec.summary = %q{Equation of Time calculates time of solar transition.}
|
13
|
-
spec.description = %q{Calculate Sunrise and Sunset
|
14
|
-
Lots of examples to play with
|
15
|
-
spec.homepage = "http://equationoftime.herokuapp.com"
|
16
|
-
|
13
|
+
spec.description = %q{Calculate Sunrise and Sunset. Now uses native C wrappers.
|
14
|
+
Lots of examples to play with for learning.}
|
15
|
+
#spec.homepage = "http://equationoftime.herokuapp.com"
|
16
|
+
spec.homepage = "https://github.com/DouglasAllen/equationoftime"
|
17
17
|
spec.license = "MIT"
|
18
18
|
|
19
19
|
|
20
20
|
# Manifest
|
21
|
-
|
22
|
-
|
21
|
+
spec.files = Dir.glob("ext/**/*.{c,h,rb, so}") + Dir.glob("**") +
|
22
|
+
Dir.glob("lib/**/*.rb") + Dir.glob(".*")
|
23
|
+
#spec.files = `git ls-files -z`.split($/)#split("\x0")
|
24
|
+
spec.extensions << "ext/ceot/extconf.rb"
|
23
25
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
24
26
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
25
27
|
spec.require_paths = ["lib"]
|
26
28
|
spec.platform = Gem::Platform::RUBY
|
27
29
|
spec.add_development_dependency "bundler", "~> 1.5"
|
28
30
|
spec.add_development_dependency "rake"
|
31
|
+
spec.add_development_dependency "rake-compiler"
|
29
32
|
spec.add_development_dependency "minitest"
|
30
33
|
spec.add_development_dependency "rspec"
|
31
34
|
spec.add_development_dependency "yard"
|
data/ext/ceot/ceot.c
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
#include "ruby.h"
|
2
|
+
#include "eot.h"
|
3
|
+
|
4
|
+
#ifndef DBL2NUM
|
5
|
+
# define DBL2NUM(dbl) rb_float_new(dbl)
|
6
|
+
#endif
|
7
|
+
|
8
|
+
ID id_status;
|
9
|
+
|
10
|
+
VALUE func_ml(VALUE klass, VALUE vt) {
|
11
|
+
rb_ivar_set(klass, id_status, INT2FIX(0));
|
12
|
+
return DBL2NUM(mlSun(NUM2DBL(vt)));
|
13
|
+
}
|
14
|
+
|
15
|
+
VALUE func_eoe(VALUE klass, VALUE vt) {
|
16
|
+
rb_ivar_set(klass, id_status, INT2FIX(0));
|
17
|
+
return DBL2NUM(eoe(NUM2DBL(vt)));
|
18
|
+
}
|
19
|
+
|
20
|
+
VALUE func_eqc(VALUE klass, VALUE vma, VALUE vt) {
|
21
|
+
rb_ivar_set(klass, id_status, INT2FIX(0));
|
22
|
+
return DBL2NUM(eqc(NUM2DBL(vma), NUM2DBL(vt)));
|
23
|
+
}
|
24
|
+
|
25
|
+
VALUE func_tl(VALUE klass, VALUE vma, VALUE vt) {
|
26
|
+
rb_ivar_set(klass, id_status, INT2FIX(0));
|
27
|
+
return DBL2NUM(tlSun(NUM2DBL(vma), NUM2DBL(vt)));
|
28
|
+
}
|
29
|
+
|
30
|
+
VALUE func_al(VALUE klass, VALUE vma, VALUE vt, VALUE vo) {
|
31
|
+
rb_ivar_set(klass, id_status, INT2FIX(0));
|
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 cEot;
|
41
|
+
void
|
42
|
+
Init_ceot(void) {
|
43
|
+
|
44
|
+
VALUE cEot = rb_define_class("Eot", rb_cObject);
|
45
|
+
id_status = rb_intern("@status");
|
46
|
+
rb_define_method(cEot, "ml", func_ml, 1);
|
47
|
+
rb_define_method(cEot, "eoe", func_eoe, 1);
|
48
|
+
rb_define_method(cEot, "eqc", func_eqc, 2);
|
49
|
+
rb_define_method(cEot, "tl", func_tl, 2);
|
50
|
+
rb_define_method(cEot, "al", func_al, 3);
|
51
|
+
rb_define_method(cEot, "cosZ", func_cosZ, 1);
|
52
|
+
}
|
data/ext/ceot/eot.c
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
#include "eot.h"
|
2
|
+
|
3
|
+
|
4
|
+
double mlSun(double t)
|
5
|
+
{
|
6
|
+
double a;
|
7
|
+
|
8
|
+
/* Mean geocentric longitude of the Sun */
|
9
|
+
a = fmod( 280.4664567 +
|
10
|
+
t * ( 36000.76982779 +
|
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
|
+
|
16
|
+
return a;
|
17
|
+
}
|
18
|
+
|
19
|
+
double eoe(double t)
|
20
|
+
{
|
21
|
+
double e;
|
22
|
+
|
23
|
+
/* Eccentricity of Earth orbit */
|
24
|
+
e = (0.016708617 +
|
25
|
+
t * (-0.000042037 +
|
26
|
+
t * -0.0000001235));
|
27
|
+
|
28
|
+
return e;
|
29
|
+
}
|
30
|
+
|
31
|
+
double eqc(double ma, double t)
|
32
|
+
{
|
33
|
+
double a, e, e2, e3, e4, e5;
|
34
|
+
e = eoe(t);
|
35
|
+
e2 = pow(e, 2);
|
36
|
+
e3 = pow(e, 3);
|
37
|
+
e4 = pow(e, 4);
|
38
|
+
e5 = pow(e, 5);
|
39
|
+
|
40
|
+
/* Equation of Center */
|
41
|
+
a = sin( 1.0 * ma ) * (e * 2.0 - e3 * 1.0/4.0 + e5 * 5.0/96.0) +
|
42
|
+
sin( 2.0 * ma ) * (e2 * 5.0/4.0 - 0.0 - e4 * 11.0/24.0) +
|
43
|
+
sin( 3.0 * ma ) * (e3 * 13.0/12.0 - 0.0 - e5 * 43.0/64.0) +
|
44
|
+
sin( 4.0 * ma ) * e4 * 103.0/96.0 +
|
45
|
+
sin( 5.0 * ma ) * e5 * 1097.0/960.0;
|
46
|
+
|
47
|
+
return a;
|
48
|
+
}
|
49
|
+
|
50
|
+
double tlSun(double ma, double t)
|
51
|
+
{
|
52
|
+
double a;
|
53
|
+
|
54
|
+
a = fmod( mlSun(t) + eqc(ma, t), 57.295779513082320876798154814105);
|
55
|
+
|
56
|
+
return a;
|
57
|
+
}
|
58
|
+
|
59
|
+
double alSun(double ma, double t, double o)
|
60
|
+
{
|
61
|
+
double a;
|
62
|
+
|
63
|
+
a = fmod(tlSun(ma, t) -
|
64
|
+
0.00569 * 0.017453292519943295769236907684886 -
|
65
|
+
0.00478 * 0.017453292519943295769236907684886 *
|
66
|
+
sin(o), 57.295779513082320876798154814105);
|
67
|
+
|
68
|
+
return a;
|
69
|
+
}
|
70
|
+
|
71
|
+
double cosZ(double zenith)
|
72
|
+
{
|
73
|
+
|
74
|
+
double a;
|
75
|
+
|
76
|
+
a = cos(zenith * 0.017453292519943295769236907684886);
|
77
|
+
|
78
|
+
return a;
|
79
|
+
}
|
data/ext/ceot/eot.h
ADDED
data/ext/ceot/extconf.rb
ADDED
data/lib/eot.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# eot.rb
|
2
2
|
|
3
|
+
require 'ceot'
|
3
4
|
require 'eot/version'
|
4
5
|
require 'eot/constants'
|
5
6
|
require 'eot/init'
|
@@ -8,4 +9,4 @@ require 'eot/angles'
|
|
8
9
|
require 'eot/times'
|
9
10
|
require 'eot/displays'
|
10
11
|
require 'eot/nutation'
|
11
|
-
require 'eot/geo_lat_lng_smt'
|
12
|
+
require 'eot/geo_lat_lng_smt'
|
data/lib/eot/angles.rb
CHANGED
@@ -7,7 +7,8 @@ class Eot
|
|
7
7
|
# From angles.rb:<br>
|
8
8
|
# Apparent solar longitude = true longitude - aberation
|
9
9
|
def al_Sun()
|
10
|
-
Celes.anp(tl_Sun() - 0.00569 * D2R - 0.00478 * D2R * sin(omega()))
|
10
|
+
#Celes.anp(tl_Sun() - 0.00569 * D2R - 0.00478 * D2R * sin(omega()))
|
11
|
+
al(@ma, @ta, Celes.faom03(@ta))
|
11
12
|
end
|
12
13
|
alias_method :apparent_longitude, :al_Sun
|
13
14
|
alias_method :alsun, :al_Sun
|
@@ -23,7 +24,7 @@ class Eot
|
|
23
24
|
# From angles.rb:<br>
|
24
25
|
# one time component to total equation of time
|
25
26
|
def angle_delta_oblique()
|
26
|
-
|
27
|
+
al(@ma, @ta, Celes.faom03(@ta)) - ra_Sun()
|
27
28
|
end
|
28
29
|
alias_method :delta_t_ecliptic, :angle_delta_oblique
|
29
30
|
alias_method :delta_oblique, :angle_delta_oblique
|
@@ -31,7 +32,7 @@ class Eot
|
|
31
32
|
# From angles.rb:<br>
|
32
33
|
# one time component to total equation of time
|
33
34
|
def angle_delta_orbit()
|
34
|
-
@ma -
|
35
|
+
@ma - Celes.anp(@ma + eqc( @ma, @ta ))
|
35
36
|
end
|
36
37
|
alias_method :delta_t_elliptic, :angle_delta_orbit
|
37
38
|
alias_method :delta_orbit, :angle_delta_orbit
|
@@ -48,7 +49,7 @@ class Eot
|
|
48
49
|
# total equation of time
|
49
50
|
def angle_equation_of_time()
|
50
51
|
#~ @ma = ma_Sun()
|
51
|
-
|
52
|
+
@ma - Celes.anp(@ma + eqc( @ma, @ta )) + al(@ma, @ta, Celes.faom03(@ta)) - ra_Sun()
|
52
53
|
end
|
53
54
|
alias_method :eot, :angle_equation_of_time
|
54
55
|
|
@@ -56,20 +57,21 @@ class Eot
|
|
56
57
|
# equation of centre
|
57
58
|
# added to mean anomaly to get true anomaly.
|
58
59
|
def center()
|
59
|
-
sine_1M = sin( 1.0 * @ma )
|
60
|
-
sine_2M = sin( 2.0 * @ma )
|
61
|
-
sine_3M = sin( 3.0 * @ma )
|
62
|
-
sine_4M = sin( 4.0 * @ma )
|
63
|
-
sine_5M = sin( 5.0 * @ma )
|
64
|
-
e = eccentricity_Earth()
|
65
|
-
sine_1M * (
|
66
|
-
sine_2M * (
|
67
|
-
sine_3M * ( 13/12.0 * e**3 - 43/64.0 * e**5 )
|
68
|
-
sine_4M * 103/96.0 * e**4
|
69
|
-
sine_5M * 1097/960.0 * e**5
|
70
|
-
# sine_1M *( 1.914602 - ta
|
71
|
-
# sine_2M *( 0.019993 - ta
|
60
|
+
# sine_1M = sin( 1.0 * @ma )
|
61
|
+
# sine_2M = sin( 2.0 * @ma )
|
62
|
+
# sine_3M = sin( 3.0 * @ma )
|
63
|
+
# sine_4M = sin( 4.0 * @ma )
|
64
|
+
# sine_5M = sin( 5.0 * @ma )
|
65
|
+
# e = eccentricity_Earth()
|
66
|
+
# sine_1M * ( 2.0 * e - e**3 * 1.0/4.0 + 5/96.0 * e**5 ) +
|
67
|
+
# sine_2M * ( 5.0/4.0 * e**2 - 11/24.0 * e**4 ) +
|
68
|
+
# sine_3M * ( 13.0/12.0 * e**3 - 43/64.0 * e**5 ) +
|
69
|
+
# sine_4M * 103.0/96.0 * e**4 +
|
70
|
+
# sine_5M * 1097.0/960.0 * e**5
|
71
|
+
# sine_1M * ( 1.914602 - @ta * ( 0.004817 + @ta * 0.000014 )) + +
|
72
|
+
# sine_2M * ( 0.019993 - @ta * 0.000101 ) + +
|
72
73
|
# sine_3M * 0.000289
|
74
|
+
eqc( @ma, @ta )
|
73
75
|
end
|
74
76
|
alias_method :equation_of_center, :center
|
75
77
|
|
@@ -77,7 +79,7 @@ class Eot
|
|
77
79
|
# cosine apparent longitude
|
78
80
|
# could be useful when dividing
|
79
81
|
def cosine_al_Sun()
|
80
|
-
cos(
|
82
|
+
cos( al(@ma, @ta, Celes.faom03(@ta)) )
|
81
83
|
end
|
82
84
|
alias_method :cosine_apparent_longitude, :cosine_al_Sun
|
83
85
|
alias_method :cosalsun, :cosine_al_Sun
|
@@ -86,7 +88,7 @@ class Eot
|
|
86
88
|
# cosine true longitude
|
87
89
|
# used in solar right ascension
|
88
90
|
def cosine_tl_Sun()
|
89
|
-
cos(
|
91
|
+
cos( tl(@ma, @ta) )
|
90
92
|
end
|
91
93
|
alias_method :cosine_true_longitude, :cosine_tl_Sun
|
92
94
|
|
@@ -94,15 +96,15 @@ class Eot
|
|
94
96
|
# cosine true obliquity
|
95
97
|
# used in solar right ascension and equation of equinox
|
96
98
|
def cosine_to_Earth()
|
97
|
-
cos(
|
99
|
+
cos( Celes.nut06a(@ajd, 0)[ 1 ] + Celes.obl06(@ajd, 0) )
|
98
100
|
end
|
99
101
|
alias_method :cosine_true_obliquity, :cosine_to_Earth
|
100
102
|
|
101
103
|
# From angles.rb:<br>
|
102
104
|
# solar declination
|
103
105
|
def dec_Sun()
|
104
|
-
|
105
|
-
|
106
|
+
asin( sin(Celes.nut06a(@ajd, 0)[ 1 ] + Celes.obl06(@ajd, 0)) *
|
107
|
+
sin( al(@ma, @ta, Celes.faom03(@ta))))
|
106
108
|
end
|
107
109
|
alias_method :declination, :dec_Sun
|
108
110
|
|
@@ -111,7 +113,8 @@ class Eot
|
|
111
113
|
# eccentricity of elliptical Earth orbit around Sun
|
112
114
|
# Horners' calculation method
|
113
115
|
def eccentricity_Earth()
|
114
|
-
[-0.0000001235, -0.000042037, 0.016708617].inject(0.0) {|p, a| p * @ta + a}
|
116
|
+
# [-0.0000001235, -0.000042037, 0.016708617].inject(0.0) {|p, a| p * @ta + a}
|
117
|
+
eoe(@ta)
|
115
118
|
end
|
116
119
|
alias_method :eccentricity_earth_orbit, :eccentricity_Earth
|
117
120
|
|
@@ -120,7 +123,7 @@ class Eot
|
|
120
123
|
# used for true longitude of Aries
|
121
124
|
# Depricated by Celes.gst06a()
|
122
125
|
def eq_of_equinox()
|
123
|
-
|
126
|
+
cos( Celes.nut06a(@ajd, 0)[ 1 ] + Celes.obl06(@ajd, 0) ) * Celes.nut06a(@ajd, 0)[ 0 ]
|
124
127
|
end
|
125
128
|
|
126
129
|
|
@@ -128,9 +131,10 @@ class Eot
|
|
128
131
|
# angle geometric mean longitude
|
129
132
|
# needed to get true longitude for low accuracy.
|
130
133
|
def gml_Sun()
|
131
|
-
total = [ 1.0/-19880000.0, 1.0/-152990.0, 1.0/499310.0,
|
132
|
-
0.0003032028, 36000.76982779, 280.4664567 ]
|
133
|
-
mod_360(total.inject(0.0) {|p, a| p * @ta + a}) * D2R
|
134
|
+
#total = [ 1.0/-19880000.0, 1.0/-152990.0, 1.0/499310.0,
|
135
|
+
# 0.0003032028, 36000.76982779, 280.4664567 ]
|
136
|
+
# mod_360(total.inject(0.0) {|p, a| p * @ta + a}) * D2R
|
137
|
+
ml(@ta)
|
134
138
|
end
|
135
139
|
alias_method :geometric_mean_longitude, :gml_Sun
|
136
140
|
|
@@ -138,14 +142,9 @@ class Eot
|
|
138
142
|
# horizon angle for provided geo coordinates
|
139
143
|
# used for angles from transit to horizons
|
140
144
|
def ha_Sun()
|
141
|
-
zenith
|
142
|
-
|
143
|
-
|
144
|
-
sine_declination = sin( dec_Sun() )
|
145
|
-
cosine_latitude = cos( @latitude * D2R )
|
146
|
-
sine_latitude = sin( @latitude * D2R )
|
147
|
-
top = cosine_zenith - sine_declination * sine_latitude
|
148
|
-
bottom = cosine_declination * cosine_latitude
|
145
|
+
zenith = 90.8333 # use other zeniths here for non commercial
|
146
|
+
top = cosZ( zenith ) - sin( dec_Sun() ) * sin( @latitude * D2R )
|
147
|
+
bottom = cos( dec_Sun() ) * cos( @latitude * D2R )
|
149
148
|
t_cosine = top / bottom
|
150
149
|
t_cosine > 1.0 || t_cosine < -1.0 ? cos = 1.0 : cos = t_cosine
|
151
150
|
acos( cos )
|
@@ -212,8 +211,9 @@ class Eot
|
|
212
211
|
# From angles.rb:<br>
|
213
212
|
# solar right ascension
|
214
213
|
def ra_Sun()
|
215
|
-
y0 =
|
216
|
-
|
214
|
+
y0 = sin( al(@ma, @ta, Celes.faom03(@ta)) ) * cos( Celes.nut06a(@ajd, 0)[ 1 ] +
|
215
|
+
Celes.obl06(@ajd, 0) )
|
216
|
+
Celes.anp( PI + atan2( -y0, -cos( al(@ma, @ta, Celes.faom03(@ta)) ) ) )
|
217
217
|
end
|
218
218
|
alias_method :right_ascension, :ra_Sun
|
219
219
|
|
@@ -221,7 +221,7 @@ class Eot
|
|
221
221
|
# sine apparent longitude
|
222
222
|
# used in solar declination
|
223
223
|
def sine_al_Sun()
|
224
|
-
sin(
|
224
|
+
sin( al(@ma, @ta, Celes.faom03(@ta)) )
|
225
225
|
end
|
226
226
|
alias_method :sine_apparent_longitude, :sine_al_Sun
|
227
227
|
|
@@ -229,7 +229,7 @@ class Eot
|
|
229
229
|
# sine true longitude
|
230
230
|
# used in solar right ascension
|
231
231
|
def sine_tl_Sun()
|
232
|
-
sin(
|
232
|
+
sin( tl(@ma, @ta) )
|
233
233
|
end
|
234
234
|
alias_method :sine_true_longitude, :sine_tl_Sun
|
235
235
|
|
@@ -237,14 +237,14 @@ class Eot
|
|
237
237
|
# sine true obliquity angle of Earth
|
238
238
|
# used in solar declination
|
239
239
|
def sine_to_Earth()
|
240
|
-
sin(
|
240
|
+
sin(Celes.nut06a(@ajd, 0)[ 1 ] + Celes.obl06(@ajd, 0))
|
241
241
|
end
|
242
242
|
|
243
243
|
# From angles.rb:<br>
|
244
244
|
# angle true anomaly
|
245
245
|
# used in equation of time
|
246
246
|
def ta_Sun()
|
247
|
-
Celes.anp(@ma +
|
247
|
+
Celes.anp(@ma + eqc( @ma, @ta ))
|
248
248
|
end
|
249
249
|
alias_method :true_anomaly, :ta_Sun
|
250
250
|
|
@@ -263,7 +263,8 @@ class Eot
|
|
263
263
|
# angle of true longitude sun
|
264
264
|
# used in equation of time
|
265
265
|
def tl_Sun()
|
266
|
-
Celes.anp(gml_Sun() + center())
|
266
|
+
#Celes.anp(gml_Sun() + center())
|
267
|
+
tl(@ma, @ta)
|
267
268
|
end
|
268
269
|
alias_method :true_longitude, :tl_Sun
|
269
270
|
alias_method :ecliptic_longitude, :tl_Sun
|
@@ -272,7 +273,7 @@ class Eot
|
|
272
273
|
# From angles.rb:<br>
|
273
274
|
# true obliquity considers nutation
|
274
275
|
def to_Earth()
|
275
|
-
Celes.
|
276
|
+
Celes.nut06a(@ajd, 0)[ 1 ] + Celes.obl06(@ajd, 0)
|
276
277
|
end
|
277
278
|
alias_method :obliquity_correction, :to_Earth
|
278
279
|
alias_method :true_obliquity, :to_Earth
|