equationoftime 4.1.5 → 4.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3548bdc8e0b497b9d4db22274c1cba9c31f2705f
4
- data.tar.gz: 7a7045370ba55b1f21c143514a52d1ba4b7a928a
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YWNhMGU3ZGYzZWY3YjAxMzNmMTI5ZjY5YWQxY2VjNjRjNTc5ODRlMw==
5
+ data.tar.gz: !binary |-
6
+ ZTIwMDE4ODE3NGYyNmMyZjFkOGIzMGFkZTY0MGRkNGUwMmUyY2IwMw==
5
7
  SHA512:
6
- metadata.gz: cb8d7bbd702b98551b247b0574e9cf3ec1cc08f209f9ffc0d65f07a5dad6ec69bbc4ccfe6c746870d1f9959fd1cb316180f4834e09b628710e6d1ebb00c91953
7
- data.tar.gz: 67c10e32092d3cbb9441c0052580eb58a573199ddcafeac4bf05ed185366a8273eb2c11f69366c411488f5f5fbb09d78a502ad1f7c623b2b337ff7027bff8039
8
+ metadata.gz: !binary |-
9
+ YjZjMjU5NjBkMjcyMzRiYTcwM2FmYmI5ZGYwYjY2MzA0MmI3MjVjN2FhYzU3
10
+ NzM2MjFjN2M3ZGNhNGQ2YWEwZmVlZTBiYzU3NTgwZDJhODg5NzA5ODUwZDhm
11
+ Yzc4MjQzMDZmNWYzMGMzZWUwMmY4MjgyZjdjYmE2OWQ0OGY2MDc=
12
+ data.tar.gz: !binary |-
13
+ MjYxODJkODNhYzBjYjMyYjk2YzU2NzE3MzNhNzQ4NWY3NTc2Njk3NzFlN2Iz
14
+ ZTZjZjZiNDY0MjNmYmExZTE0ZDg3OGRiNjcwYzA4YmEzOGVhNDRhMjFlZmU1
15
+ MzYwYzQxMTA3MTlhNTM4ZGU2OGY4NTZiNDE0OWJhYzQzYWU5ODg=
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.1.2
1
+ 1.9.3
data/Gemfile CHANGED
@@ -1,9 +1,15 @@
1
1
  source 'https://rubygems.org'
2
- ruby '2.1.2'
2
+ ruby '1.9.3'
3
+ # ruby '2.0.0'
4
+ # ruby '2.1.0'
5
+ # ruby '2.1.1'
6
+ # ruby '2.1.2'
7
+ # ruby '2.1.3'
8
+ # ruby '2.1.4'
3
9
 
4
10
  gemspec
5
11
 
6
- group :development do
12
+ group :development, :test do
7
13
  gem 'rubocop'
8
14
  gem 'hoe'
9
15
  gem 'rake'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- equationoftime (4.1.5)
4
+ equationoftime (4.1.6)
5
5
  addressable (~> 2.3.6)
6
6
  celes (~> 0.0.1)
7
7
  rest-client
@@ -9,7 +9,7 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- ZenTest (4.10.1)
12
+ ZenTest (4.11.0)
13
13
  addressable (2.3.6)
14
14
  ast (2.0.0)
15
15
  astrolabe (1.3.0)
@@ -19,9 +19,9 @@ GEM
19
19
  timers (~> 4.0.0)
20
20
  coderay (1.1.0)
21
21
  diff-lcs (1.2.5)
22
- ffi (1.9.3)
22
+ ffi (1.9.6)
23
23
  formatador (0.2.5)
24
- guard (2.6.1)
24
+ guard (2.8.1)
25
25
  formatador (>= 0.2.4)
26
26
  listen (~> 2.7)
27
27
  lumberjack (~> 1.0)
@@ -31,19 +31,19 @@ GEM
31
31
  guard (~> 2.0)
32
32
  minitest (>= 3.0)
33
33
  hitimes (1.2.2)
34
- hoe (3.12.0)
34
+ hoe (3.13.0)
35
35
  rake (>= 0.8, < 11.0)
36
36
  json (1.8.1)
37
- listen (2.7.9)
37
+ listen (2.7.11)
38
38
  celluloid (>= 0.15.2)
39
39
  rb-fsevent (>= 0.9.3)
40
40
  rb-inotify (>= 0.9)
41
41
  lumberjack (1.0.9)
42
42
  method_source (0.8.2)
43
- mime-types (2.3)
44
- minitest (5.4.1)
45
- netrc (0.7.7)
46
- parser (2.2.0.pre.4)
43
+ mime-types (2.4.3)
44
+ minitest (5.4.2)
45
+ netrc (0.8.0)
46
+ parser (2.2.0.pre.7)
47
47
  ast (>= 1.1, < 3.0)
48
48
  slop (~> 3.4, >= 3.4.5)
49
49
  powerpack (0.0.9)
@@ -67,26 +67,26 @@ GEM
67
67
  rspec-core (~> 3.1.0)
68
68
  rspec-expectations (~> 3.1.0)
69
69
  rspec-mocks (~> 3.1.0)
70
- rspec-core (3.1.2)
70
+ rspec-core (3.1.7)
71
71
  rspec-support (~> 3.1.0)
72
- rspec-expectations (3.1.0)
72
+ rspec-expectations (3.1.2)
73
73
  diff-lcs (>= 1.2.0, < 2.0)
74
74
  rspec-support (~> 3.1.0)
75
- rspec-mocks (3.1.0)
75
+ rspec-mocks (3.1.3)
76
76
  rspec-support (~> 3.1.0)
77
- rspec-support (3.1.0)
78
- rubocop (0.26.1)
77
+ rspec-support (3.1.2)
78
+ rubocop (0.27.0)
79
79
  astrolabe (~> 1.3)
80
- parser (>= 2.2.0.pre.4, < 3.0)
80
+ parser (>= 2.2.0.pre.6, < 3.0)
81
81
  powerpack (~> 0.0.6)
82
82
  rainbow (>= 1.99.1, < 3.0)
83
83
  ruby-progressbar (~> 1.4)
84
- ruby-progressbar (1.6.0)
84
+ ruby-progressbar (1.7.0)
85
85
  slop (3.6.0)
86
86
  thor (0.19.1)
87
87
  timers (4.0.1)
88
88
  hitimes
89
- yard (0.8.7.4)
89
+ yard (0.8.7.6)
90
90
 
91
91
  PLATFORMS
92
92
  ruby
data/Manifest.txt CHANGED
@@ -1,9 +1,12 @@
1
1
  .autotest
2
2
  .buildpath
3
+ .git
3
4
  .minitest.rb
4
5
  .project
6
+ .settings
5
7
  .rspec
6
8
  .ruby-version
9
+ .yardoc
7
10
  CHANGELOG.rdoc
8
11
  Gemfile
9
12
  Gemfile.lock
@@ -14,7 +17,7 @@ Manifest.txt
14
17
  README.rdoc
15
18
  Rakefile
16
19
  equationoftime.gemspec
17
- examples/Equation_of_Time.jpg
20
+ examples/Equation_of_Time.png
18
21
  examples/my_lst.rb
19
22
  examples/use_addr.rb
20
23
  examples/use_ajd.rb
@@ -44,5 +47,6 @@ test/eot/displays_spec.rb
44
47
  test/eot/geo_spec.rb
45
48
  test/eot/init_spec.rb
46
49
  test/eot/times_spec.rb
50
+ run_tests_eclipse.rb
47
51
  wiki.md
48
52
  wiki2.md
data/README.rdoc CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Home :: http://equationoftime.herokuapp.com/
4
4
  Code :: https://github.com/DouglasAllen/equationoftime
5
- RDoc :: http://rubydoc.info/gems/equationoftime/4.1.2/frames
5
+ RDoc :: http://rubydoc.info/gems/equationoftime/4.1.5/frames
6
6
  Issues :: https://github.com/DouglasAllen/equationoftime/issues
7
7
 
8
8
 
@@ -22,36 +22,59 @@ Lots of examples to play with for learning about Eot.
22
22
  require 'eot'
23
23
  eot = Eot.new
24
24
  eot.string_eot # todays eot
25
- eot.addr # what is the location
26
- eot.addr = "huston, tx" #changed location
25
+ eot.ajd # was initialized to noon today ei. jd
26
+ # Try the real AJD
27
+ eot.ajd = DateTime.now.to_time.utc.to_datetime.ajd.to_f
28
+
29
+ eot.string_eot # nothing changes so...
30
+ eot.ma_ta_set # recalculate ma and ta after initialization
31
+ eot.string_eot # should be different than before
32
+
33
+ # check and set a new address
27
34
  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
+ geo.addr
36
+ geo.addr = "houston, tx" # set new location
37
+ geo.set_coordinates # set new coordinates
38
+ eot.latitude = geo.lat # set the Eot class attributes
39
+ eot.longitude = geo.lng
40
+
41
+ # Be shure you have the date set right
42
+ eot.ajd = DateTime.new(2014,11,07).to_time.utc.to_datetime.jd.to_f
43
+
44
+ eot.ma_ta_set # recalculate ma and ta after initialization
45
+
46
+ eot.sunrise_jd # the dates sunrise as a jd
47
+ eot.sunset_jd # the dates sunset as a jd
48
+ eot.sunrise_dt # the dates sunrise as DateTime
49
+ eot.sunset_dt # the dates sunset as a DateTime
50
+
51
+
52
+ eot.ajd += 1 # the days after times can be read
53
+ eot.ma_ta_set # recalculate ma and ta after initialization
35
54
  eot.ajd = 2451545 # ajd set to 2001-01-01 12:00
36
55
 
37
56
 
57
+ == Gem patch:
58
+
59
+ $ gem install eot
60
+
61
+ After realizing this name was available I decided to use it.
62
+ It installs the needed requirements as for some reason
63
+ gem install equationoftime doesn't always. Hoe hoe hoe!
64
+
38
65
  == REQUIREMENTS:
39
66
 
40
- * bundle install
67
+ $ bundle install
41
68
 
42
69
  == INSTALL:
43
70
 
44
- * rake install
71
+ $ bundle exec rake install
45
72
 
46
73
  == DEVELOPERS:
47
74
 
48
75
  After checking out the source, run:
49
76
 
50
- $ rake newb
51
-
52
- Or use patch to install as gem
53
-
54
- $ gem install eot
77
+ $ bundle exec rake newb
55
78
 
56
79
  This task will install any missing dependencies, run the tests/specs,
57
80
  and generate the RDoc.
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.5
10
+ # rake release VERSION=4.1.6
11
11
  Hoe.spec 'equationoftime' do
12
12
  developer('Douglas Allen', 'kb9agt@gmail.com')
13
13
  license('MIT')
14
- self.version = '4.1.5'
14
+ #self.version = '4.1.6'
15
15
  self.readme_file = 'README.rdoc'
16
16
  self.history_file = 'CHANGELOG.rdoc'
17
17
  self.extra_rdoc_files = FileList['*.rdoc']
@@ -49,7 +49,7 @@ Rake::RDocTask.new(:rdox) do |rd|
49
49
 
50
50
  rd.rdoc_dir = 'rdocs'
51
51
 
52
- rd.rdoc_files.include 'lib/**/*.rb', 'README.md', 'wiki.md'
52
+ rd.rdoc_files.include 'lib/**/*.rb', 'README.rdoc', 'wiki.md'
53
53
 
54
54
  rd.options << '--line-numbers'
55
55
 
data/examples/my_lst.rb CHANGED
@@ -3,7 +3,9 @@ eot = Eot.new
3
3
  puts 'My Local Apparent Sidereal Time'
4
4
  loop do
5
5
  eot.ajd = DateTime.now.to_time.utc.to_datetime.ajd
6
- puts "LST = #{ eot.string_time(((eot.tl_aries * Eot::R2D) + -88.75) / 15.0) }"
6
+ gst = eot.string_deg_to_time(eot.tl_aries - -88.75 * Eot::D2R)
7
+ era = eot.string_deg_to_time(eot.era - -88.75 * Eot::D2R)
8
+ puts "LST gst #{gst} LST era #{era}"
7
9
  # the number is syncing my machine. machine may vary in this.
8
10
  sleep 0.99613381875
9
11
  end
data/ext/eot/ceot.c CHANGED
@@ -21,9 +21,7 @@ double eoe(double t)
21
21
  double e;
22
22
 
23
23
  /* Eccentricity of Earth orbit */
24
- e = (0.016708617 +
25
- t * (-0.000042037 +
26
- t * -0.0000001235));
24
+ e = (0.016708617 + t * (-0.000042037 + t * -0.0000001235));
27
25
 
28
26
  return e;
29
27
  }
@@ -72,6 +70,11 @@ double alSun(double ma, double t, double o)
72
70
  return a;
73
71
  }
74
72
 
73
+ double raSun(double y0, double cos_al_Sun)
74
+ {
75
+ return atan2(-y0, -cos_al_Sun);
76
+ }
77
+
75
78
  double cosZ(double zenith)
76
79
  {
77
80
 
@@ -107,7 +110,7 @@ double cos_lat(double lat)
107
110
 
108
111
  double ca;
109
112
 
110
- ca = cos(lat);
113
+ ca = cos(lat * 0.017453292519943295769236907684886);
111
114
 
112
115
  return ca;
113
116
  }
@@ -157,7 +160,7 @@ double sin_lat(double lat)
157
160
 
158
161
  double sa;
159
162
 
160
- sa = sin(lat);
163
+ sa = sin(lat * 0.017453292519943295769236907684886);
161
164
 
162
165
  return sa;
163
166
  }
@@ -182,4 +185,26 @@ double sin_to_earth(double to_earth)
182
185
  return sa;
183
186
  }
184
187
 
185
-
188
+ double sun(double zenith, double dec_sun, double lat)
189
+ {
190
+ double cos1 = cosZ(zenith);
191
+ double sin2 = sin_dec_sun(dec_sun);
192
+ double sin3 = sin_lat(lat);
193
+ double cos2 = cos_dec_sun(dec_sun);
194
+ double cos3 = cos_lat(lat);
195
+ double top = cos1 - sin2 * sin3;
196
+ double bot = cos2 * cos3;
197
+ double ca = top / bot;
198
+ double c;
199
+ c = (ca > 1.0 || ca < -1.0) ? 1.0: ca;
200
+ return acos(c);
201
+ }
202
+
203
+ double sun_dec(double al_sun, double to_earth)
204
+ {
205
+ double sin1 = sin_to_earth(to_earth);
206
+ double sin2 = sin_al_sun(al_sun);
207
+ double a = asin(sin1 * sin2);
208
+ return a;
209
+ }
210
+ //
data/ext/eot/ceot.h CHANGED
@@ -5,6 +5,7 @@ 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 raSun(double y0, double cos_al_Sun);
8
9
  double cosZ(double zenith);
9
10
  double cos_al_sun(double al_sun);
10
11
  double cos_tl_sun(double tl_sun);
@@ -16,3 +17,6 @@ double sin_dec_sun(double dec_sun);
16
17
  double cos_dec_sun(double dec_sun);
17
18
  double sin_lat(double lat);
18
19
  double cos_lat(double lat);
20
+ double sun_dec(double al_sun, double to_earth);
21
+ double sun(double zenith, double dec_sun, double lat);
22
+
data/ext/eot/eot.c CHANGED
@@ -87,6 +87,21 @@ VALUE func_cos_lat(VALUE klass, VALUE vlat) {
87
87
  return DBL2NUM(cos_lat(NUM2DBL(vlat)));
88
88
  }
89
89
 
90
+ VALUE func_sun(VALUE klass, VALUE vz, VALUE vds, VALUE vlat) {
91
+ rb_ivar_set(klass, id_status, INT2FIX(0));
92
+ return DBL2NUM(sun(NUM2DBL(vz), NUM2DBL(vds), NUM2DBL(vlat)));
93
+ }
94
+
95
+ VALUE func_sun_dec(VALUE klass, VALUE vals, VALUE vtoe) {
96
+ rb_ivar_set(klass, id_status, INT2FIX(0));
97
+ return DBL2NUM(sun_dec(NUM2DBL(vals), NUM2DBL(vtoe)));
98
+ }
99
+
100
+ VALUE func_sun_ra(VALUE klass, VALUE vy0, VALUE vcas) {
101
+ rb_ivar_set(klass, id_status, INT2FIX(0));
102
+ return DBL2NUM(raSun(NUM2DBL(vy0), NUM2DBL(vcas)));
103
+ }
104
+
90
105
  VALUE cEot;
91
106
  void
92
107
  Init_eot(void) {
@@ -109,4 +124,8 @@ Init_eot(void) {
109
124
  rb_define_method(cEot, "sin_dec_sun", func_sin_dec_sun, 1);
110
125
  rb_define_method(cEot, "cos_lat", func_cos_lat, 1);
111
126
  rb_define_method(cEot, "sin_lat", func_sin_lat, 1);
127
+ rb_define_method(cEot, "sun_dec", func_sun_dec, 2);
128
+ rb_define_method(cEot, "sun", func_sun, 3);
129
+ rb_define_method(cEot, "sun_ra", func_sun_ra, 2);
130
+
112
131
  }
data/lib/eot.rb CHANGED
@@ -1,19 +1,21 @@
1
1
  # eot.rb
2
2
  # require 'multi_xml'
3
3
  require 'addressable/uri'
4
- require 'rest-client'
5
- require 'json'
6
4
  require 'celes'
7
5
  require 'date'
8
- require 'eot/version'
9
- require 'eot/eot'
10
- require 'eot/constants'
11
- require 'eot/init'
12
- require 'eot/utilities'
6
+ require 'json'
7
+ require 'rest-client'
13
8
  require 'eot/angles'
9
+ require 'eot/angle_displays'
10
+ require 'eot/constants'
14
11
  require 'eot/deltas'
15
- require 'eot/trigonometric'
12
+ require 'eot/delta_times'
13
+ require 'eot/eot'
14
+ require 'eot/geo_lat_lng_smt'
15
+ require 'eot/init'
16
+ require 'eot/jd_times'
16
17
  require 'eot/times'
17
- require 'eot/angle_displays'
18
18
  require 'eot/time_displays'
19
- require 'eot/geo_lat_lng_smt'
19
+ require 'eot/trigonometric'
20
+ require 'eot/utilities'
21
+ require 'eot/version'
@@ -1,29 +1,12 @@
1
1
  # class Eot file = angle_displays.rb
2
+ # methods for display of angles
2
3
  class Eot
3
- def deg_string(sgn, d, m, s, ds)
4
- sgn +
5
- format('%03d', d) +
6
- ':' +
7
- format('%02d', m) +
8
- ':' +
9
- format('%02d', s) +
10
- '.' +
11
- format('%3.3d', ds)
12
- end
13
-
14
4
  # From displays.rb
15
5
  # String formatter for d:m:s display
16
6
  def degrees_to_s(radians = 0.0)
17
7
  radians.nil? ? radians = 0.0 : radians
18
- radians < 0 ? sign = '-' : sign = '+'
19
- deg = (radians * R2D).abs
20
- int_deg = Integer(deg)
21
- min = 60.0 * (deg - int_deg)
22
- int_min = Integer(min)
23
- sec = 60.0 * (min - int_min)
24
- int_sec = Integer(sec)
25
- int_ds = Integer(1000.0 * (sec - int_sec))
26
- deg_string(sign, int_deg, int_min, int_sec, int_ds)
8
+ s, idmsf = Celes.a2af(3, radians)
9
+ f_string(s, idmsf[0], idmsf[1], idmsf[2], idmsf[3])
27
10
  end
28
11
 
29
12
  # From displays.rb