equationoftime 4.1.2 → 4.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/.ruby-version +1 -1
  4. data/Gemfile +6 -4
  5. data/Gemfile.lock +21 -14
  6. data/Guardfile +4 -21
  7. data/Manifest.txt +18 -52
  8. data/README.rdoc +6 -6
  9. data/Rakefile +53 -92
  10. data/equationoftime.gemspec +48 -49
  11. data/examples/my_lst.rb +9 -0
  12. data/examples/use_addr.rb +20 -0
  13. data/examples/use_ajd.rb +40 -0
  14. data/ext/eot/ceot.c +18 -14
  15. data/ext/eot/extconf.rb +4 -5
  16. data/lib/eot/angle_displays.rb +95 -0
  17. data/lib/eot/angles.rb +160 -291
  18. data/lib/eot/constants.rb +78 -81
  19. data/lib/eot/deltas.rb +40 -0
  20. data/lib/eot/geo_lat_lng_smt.rb +30 -57
  21. data/lib/eot/init.rb +86 -124
  22. data/lib/eot/time_displays.rb +105 -0
  23. data/lib/eot/times.rb +118 -121
  24. data/lib/eot/trigometric.rb +51 -0
  25. data/lib/eot/utilities.rb +49 -50
  26. data/lib/eot/version.rb +3 -2
  27. data/lib/eot.rb +11 -5
  28. data/test/eot/aliased_angles_spec.rb +291 -0
  29. data/test/eot/aliased_displays_spec.rb +126 -0
  30. data/test/{aliased_utilities_spec.rb → eot/aliased_utilities_spec.rb} +32 -36
  31. data/test/eot/angles_spec.rb +261 -0
  32. data/test/eot/constants_spec.rb +17 -0
  33. data/test/eot/displays_spec.rb +111 -0
  34. data/test/eot/geo_spec.rb +40 -0
  35. data/test/eot/init_spec.rb +45 -0
  36. data/test/eot/times_spec.rb +137 -0
  37. data/wiki.md +55 -0
  38. data/wiki2.md +4 -0
  39. data.tar.gz.sig +0 -0
  40. metadata +55 -69
  41. metadata.gz.sig +0 -0
  42. data/.settings/org.eclipse.ltk.core.refactoring.prefs +0 -2
  43. data/examples/analemma_data_generator.rb +0 -58
  44. data/examples/check_date_type.rb +0 -60
  45. data/examples/compare_geoc_long_ra.rb +0 -44
  46. data/examples/data_table_for_astro_dog.rb +0 -45
  47. data/examples/earth_rotation.rb +0 -42
  48. data/examples/eot_methods_list.rb +0 -48
  49. data/examples/eot_plot.r +0 -57
  50. data/examples/eot_suntimes.rb +0 -149
  51. data/examples/equation_of_time.py +0 -186
  52. data/examples/figure_1.jpg +0 -0
  53. data/examples/file_converter.rb +0 -31
  54. data/examples/from_readme.rb +0 -14
  55. data/examples/from_wiki.rb +0 -46
  56. data/examples/geo_locator.rb +0 -16
  57. data/examples/getjd.rb +0 -45
  58. data/examples/gmst_gast_non_sofa.rb +0 -406
  59. data/examples/input_suntimes.rb +0 -24
  60. data/examples/julian_day_formula.rb +0 -29
  61. data/examples/julian_day_formula.txt +0 -12
  62. data/examples/my_time_conversion.rb +0 -21
  63. data/examples/nutation_series.txt +0 -678
  64. data/examples/nutation_table5_3a.txt +0 -682
  65. data/examples/ptime.rb +0 -162
  66. data/examples/suntimes.rb +0 -30
  67. data/examples/suntimes_test.rb +0 -50
  68. data/examples/t_sofa.rb +0 -8228
  69. data/examples/test_celes.rb +0 -51
  70. data/examples/test_ceot.rb +0 -55
  71. data/examples/test_poly_eval.rb +0 -32
  72. data/examples/time_scales.rb +0 -29
  73. data/examples/times_year.rb +0 -53
  74. data/examples/usage_example.rb +0 -26
  75. data/examples/use_angles.rb +0 -222
  76. data/lib/eot/displays.rb +0 -216
  77. data/lib/eot/eot.so +0 -0
  78. data/lib/eot/nutation.rb +0 -78
  79. data/run_tests_eclipse.rb +0 -1
  80. data/test/aliased_angles_spec.rb +0 -239
  81. data/test/aliased_displays_spec.rb +0 -105
  82. data/test/angles_spec.rb +0 -264
  83. data/test/constants_spec.rb +0 -20
  84. data/test/displays_spec.rb +0 -110
  85. data/test/geo_spec.rb +0 -38
  86. data/test/init_spec.rb +0 -44
  87. data/test/nutation_spec.rb +0 -37
  88. data/test/spec_config.rb +0 -8
  89. data/test/times_spec.rb +0 -133
  90. data/test/utilities_spec.rb +0 -35
metadata CHANGED
@@ -1,14 +1,36 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: equationoftime
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.2
4
+ version: 4.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Douglas Allen
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain: []
11
- date: 2014-09-14 00:00:00.000000000 Z
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDaDCCAlCgAwIBAgIBATANBgkqhkiG9w0BAQUFADA9MQ8wDQYDVQQDDAZrYjlh
14
+ Z3QxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2NvbTAe
15
+ Fw0xNDA5MjUyMzMyNTZaFw0xNTA5MjUyMzMyNTZaMD0xDzANBgNVBAMMBmtiOWFn
16
+ dDEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29tMIIB
17
+ IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvVFZZ1PC4/wUNgYfERXEja2O
18
+ 5MjfHdh52pwJCJt1sN4+YPJmxYXI30Fo54/RPlvDuEyFsJpgW6zrZ7JRzGmMdMrH
19
+ mhWKPLmLOMz9drDG8E6tz+G99/h6RJFSMw8hQKHEbONi8s5CssFnHmcMeXcb5we2
20
+ J6cN1+rsKvLbna7mk3QZ5Rq0pvWcyEbX7Ve7lP7vgh6ui7y2rJZU2h2Zcs/vWfdN
21
+ sntI2mo7cvYiYRqpwgOl6xCcczyIzaZniTHeY57djSTRwvbJQ6D0nDLgO5x5j523
22
+ dLYvKCKVCP1PV0eIunw7RYhvre8nSauEfb+Ko1m1EaTLHCBrSqyA5FuK3iIVsQID
23
+ AQABo3MwcTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUFP6B78wA
24
+ b+A3wl0ZC6XBJg1P32YwGwYDVR0RBBQwEoEQa2I5YWd0QGdtYWlsLmNvbTAbBgNV
25
+ HRIEFDASgRBrYjlhZ3RAZ21haWwuY29tMA0GCSqGSIb3DQEBBQUAA4IBAQBjSnFN
26
+ oWd9iLjHY+5Y0To/kWH9vTctUX36p1AantuHXgYR3uU8atZRFiym2inx0RkR7PxW
27
+ uIt7qyoLFoCOCH9V8jbtS8yQ8v3wTv9lIZJnybjYJx/toGcYujNU7iwJTV4laIxi
28
+ 3oKvXnfVc2fn1IuDGV5xhUmsS1a1efVoBNSQyai2OR5WU3FlXl6xe5AZnam5HqY4
29
+ 7NZjvKg3DighdGM2wZCRhldTnwe/Q3qWK0MJb73jogw5JpLEWg+F6q9tPEphPNmM
30
+ OAq/puNqaKcS6msFXF8qORqFWdrUeJatbc9im729qTdl9TkcMrrO4W7YT9mRt/h2
31
+ xYNxgIQJ29eiF+5M
32
+ -----END CERTIFICATE-----
33
+ date: 2014-09-26 00:00:00.000000000 Z
12
34
  dependencies:
13
35
  - !ruby/object:Gem::Dependency
14
36
  name: rdoc
@@ -59,7 +81,7 @@ dependencies:
59
81
  - !ruby/object:Gem::Version
60
82
  version: '3.12'
61
83
  description: |-
62
- Calculate Sunrise and Sunset. Now uses native C wrapper.
84
+ Calculate Sunrise and Sunset. Now uses native C wrappers.
63
85
  Lots of examples to play with for learning about Eot.
64
86
  email:
65
87
  - kb9agt@gmail.com
@@ -72,9 +94,8 @@ extra_rdoc_files:
72
94
  - LICENSE.txt
73
95
  - Manifest.txt
74
96
  - README.rdoc
75
- - examples/julian_day_formula.txt
76
- - examples/nutation_series.txt
77
- - examples/nutation_table5_3a.txt
97
+ - wiki.md
98
+ - wiki2.md
78
99
  files:
79
100
  - ".autotest"
80
101
  - ".buildpath"
@@ -83,7 +104,6 @@ files:
83
104
  - ".project"
84
105
  - ".rspec"
85
106
  - ".ruby-version"
86
- - ".settings/org.eclipse.ltk.core.refactoring.prefs"
87
107
  - CHANGELOG.rdoc
88
108
  - Gemfile
89
109
  - Gemfile.lock
@@ -95,67 +115,36 @@ files:
95
115
  - Rakefile
96
116
  - equationoftime.gemspec
97
117
  - examples/Equation_of_Time.jpg
98
- - examples/analemma_data_generator.rb
99
- - examples/check_date_type.rb
100
- - examples/compare_geoc_long_ra.rb
101
- - examples/data_table_for_astro_dog.rb
102
- - examples/earth_rotation.rb
103
- - examples/eot_methods_list.rb
104
- - examples/eot_plot.r
105
- - examples/eot_suntimes.rb
106
- - examples/equation_of_time.py
107
- - examples/figure_1.jpg
108
- - examples/file_converter.rb
109
- - examples/from_readme.rb
110
- - examples/from_wiki.rb
111
- - examples/geo_locator.rb
112
- - examples/getjd.rb
113
- - examples/gmst_gast_non_sofa.rb
114
- - examples/input_suntimes.rb
115
- - examples/julian_day_formula.rb
116
- - examples/julian_day_formula.txt
117
- - examples/my_time_conversion.rb
118
- - examples/nutation_series.txt
119
- - examples/nutation_table5_3a.txt
120
- - examples/ptime.rb
121
- - examples/suntimes.rb
122
- - examples/suntimes_test.rb
123
- - examples/t_sofa.rb
124
- - examples/test_celes.rb
125
- - examples/test_ceot.rb
126
- - examples/test_poly_eval.rb
127
- - examples/time_scales.rb
128
- - examples/times_year.rb
129
- - examples/usage_example.rb
130
- - examples/use_angles.rb
118
+ - examples/my_lst.rb
119
+ - examples/use_addr.rb
120
+ - examples/use_ajd.rb
131
121
  - ext/eot/ceot.c
132
122
  - ext/eot/ceot.h
133
123
  - ext/eot/eot.c
134
124
  - ext/eot/extconf.rb
135
125
  - lib/eot.rb
126
+ - lib/eot/angle_displays.rb
136
127
  - lib/eot/angles.rb
137
128
  - lib/eot/constants.rb
138
- - lib/eot/displays.rb
139
- - lib/eot/eot.so
129
+ - lib/eot/deltas.rb
140
130
  - lib/eot/geo_lat_lng_smt.rb
141
131
  - lib/eot/init.rb
142
- - lib/eot/nutation.rb
132
+ - lib/eot/time_displays.rb
143
133
  - lib/eot/times.rb
134
+ - lib/eot/trigometric.rb
144
135
  - lib/eot/utilities.rb
145
136
  - lib/eot/version.rb
146
- - run_tests_eclipse.rb
147
- - test/aliased_angles_spec.rb
148
- - test/aliased_displays_spec.rb
149
- - test/aliased_utilities_spec.rb
150
- - test/angles_spec.rb
151
- - test/constants_spec.rb
152
- - test/displays_spec.rb
153
- - test/geo_spec.rb
154
- - test/init_spec.rb
155
- - test/nutation_spec.rb
156
- - test/spec_config.rb
157
- - test/times_spec.rb
158
- - test/utilities_spec.rb
137
+ - test/eot/aliased_angles_spec.rb
138
+ - test/eot/aliased_displays_spec.rb
139
+ - test/eot/aliased_utilities_spec.rb
140
+ - test/eot/angles_spec.rb
141
+ - test/eot/constants_spec.rb
142
+ - test/eot/displays_spec.rb
143
+ - test/eot/geo_spec.rb
144
+ - test/eot/init_spec.rb
145
+ - test/eot/times_spec.rb
146
+ - wiki.md
147
+ - wiki2.md
159
148
  homepage: http://equationoftime.herokuapp.com/
160
149
  licenses:
161
150
  - MIT
@@ -183,15 +172,12 @@ signing_key:
183
172
  specification_version: 4
184
173
  summary: Calculate Sunrise and Sunset
185
174
  test_files:
186
- - test/spec_config.rb
187
- - test/nutation_spec.rb
188
- - test/aliased_angles_spec.rb
189
- - test/aliased_displays_spec.rb
190
- - test/angles_spec.rb
191
- - test/times_spec.rb
192
- - test/init_spec.rb
193
- - test/aliased_utilities_spec.rb
194
- - test/utilities_spec.rb
195
- - test/constants_spec.rb
196
- - test/displays_spec.rb
197
- - test/geo_spec.rb
175
+ - test/eot/aliased_angles_spec.rb
176
+ - test/eot/aliased_displays_spec.rb
177
+ - test/eot/angles_spec.rb
178
+ - test/eot/times_spec.rb
179
+ - test/eot/init_spec.rb
180
+ - test/eot/aliased_utilities_spec.rb
181
+ - test/eot/constants_spec.rb
182
+ - test/eot/displays_spec.rb
183
+ - test/eot/geo_spec.rb
metadata.gz.sig ADDED
Binary file
@@ -1,2 +0,0 @@
1
- eclipse.preferences.version=1
2
- org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
@@ -1,58 +0,0 @@
1
- # analemma_data_generator.rb
2
-
3
- begin
4
- require 'eot'
5
- rescue LoadError
6
- lib = File.expand_path('../../lib', __FILE__)
7
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
8
- require 'eot'
9
- end
10
-
11
- require 'eot'
12
- require 'safe_yaml'
13
- require 'time'
14
-
15
- eot = Eot.new
16
-
17
- start = "2014-1-1"
18
- finish = "2014-12-31"
19
-
20
- start_time = Time.utc( 2014, "jan", 1, 12, 0, 0 )
21
- finish_time = Time.utc( 2014, "dec", 31, 12, 0, 0 )
22
-
23
-
24
- start_jd = start_time.to_datetime.jd
25
- finish_jd = finish_time.to_datetime.jd
26
-
27
- fstr = "%b %d"
28
-
29
- @data, @group, @group_id = ["2014", eot.addr, eot.latitude, eot.longitude], {}, 1
30
-
31
- (start_jd..finish_jd).each do |jd|
32
- date = Date.jd(jd + 0.5).strftime(fstr)
33
-
34
- eot.ajd = jd
35
- delta_t = eot.show_minutes(eot.time_eot())
36
- trans = eot.display_time_string(12 - eot.time_eot()/60.0)
37
- e1 = eot.show_minutes(eot.time_delta_orbit())
38
- e2 = eot.show_minutes(eot.time_delta_oblique())
39
- decline = eot.degrees_to_s(eot.dec_Sun())
40
- @group = { "id" => "#{@group_id}",
41
- "date" => date,
42
- "julian" => "#{jd}",
43
- "rise" => eot.sunrise_dt().to_json,
44
- "eot" => delta_t,
45
- "transit" => eot.local_noon_dt().to_json,
46
- "declination" => "#{decline}",
47
- "set" => eot.sunset_dt().to_json
48
- }
49
- @data << @group
50
- @group_id += 1
51
- end
52
-
53
- file_path = "analemma_data.yml"
54
- File::open( file_path, "w" ) do |f|
55
- YAML.dump( @data, f )
56
- end
57
-
58
- puts "File analemma_data.yml processed"
@@ -1,60 +0,0 @@
1
- # check_date_type.rb
2
-
3
- begin
4
- require 'eot'
5
- rescue LoadError
6
- lib = File.expand_path('../../lib', __FILE__)
7
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
8
- require 'eot'
9
- end
10
-
11
- require 'eot'
12
-
13
- eot = Eot.new()
14
-
15
- output =<<EOO
16
-
17
- eot = Eot.new()
18
-
19
- eot.ajd = #{eot.ajd}
20
-
21
- eot.eot = #{eot.eot()} # this is radians for eot today.
22
-
23
- eot.date = #{eot.date = "2014-10-14"} = #{eot.date.class}
24
-
25
- eot.ajd = Date.parse(eot.date).jd.to_f = #{eot.ajd = Date.parse(eot.date).jd.to_f}
26
-
27
- eot.eot = #{eot.eot} # getting default today
28
-
29
- eot.equation_of_time(eot.time_julian_century(eot.ajd)) = #{eot.eot()}
30
-
31
- eot.sunrise_dt() = #{eot.sunrise_dt()} with lat and lng 0.
32
-
33
- eot.longitude = #{eot.longitude = 0}
34
-
35
- eot.sunrise_dt() = #{eot.sunrise_dt()}
36
-
37
- eot.latitude = #{eot.latitude = 0}
38
-
39
- eot.sunrise_dt() = #{eot.sunrise_dt()}
40
-
41
- eot.longitude = #{eot.longitude = 180.0}
42
-
43
- eot.sunrise_dt() = #{eot.sunrise_dt()}
44
-
45
- eot.longitude = #{eot.longitude = -180.0}
46
-
47
- eot.sunrise_dt() = #{eot.sunrise_dt()}
48
-
49
- eot.longitude = #{eot.longitude = 0}
50
- eot.latitude = #{eot.latitude = 90}
51
-
52
- eot.sunrise_dt() = #{eot.sunrise_dt()}
53
-
54
- eot.longitude = #{eot.longitude = 0}
55
- eot.latitude = #{eot.latitude = -90}
56
-
57
- eot.sunrise_dt() = #{eot.sunrise_dt()}
58
- EOO
59
-
60
- puts output
@@ -1,44 +0,0 @@
1
- # compare_geoc_long_ra.rb
2
-
3
- begin
4
- require 'eot'
5
- rescue LoadError
6
- lib = File.expand_path('../../lib', __FILE__)
7
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
8
- require 'eot'
9
- end
10
-
11
- require 'eot'
12
-
13
- eot = Eot.new()
14
-
15
- start = "2014-6-21"
16
- finish = "2014-6-21"
17
-
18
- start_date = Date.parse(start)
19
- finish_date = Date.parse(finish)
20
-
21
- puts "start julian date = #{start_date.jd} date = #{start}"
22
- puts "finish julian date = #{finish_date.jd} date = #{finish}"
23
- puts
24
-
25
- ajd = start_date.ajd * 1.0
26
-
27
- for psec in 630..631
28
- h = 10 / 24.0
29
- fd = h + 45 / 1440.0 + 31 / 86400.0 + 691 / 86400.0 / 1e3 + 244 / 86400.0 / 1e6 + 989 / 86400.0 / 1e9 + psec / 86400.0 / 1e12
30
- eot.ajd = ajd + fd
31
- ml = eot.geometric_mean_longitude()
32
- tl = eot.true_longitude()
33
- da = ml - tl
34
- al = eot.apparent_longitude()
35
- ra = eot.right_ascension()
36
- db = al - ra
37
- # puts "time\t\t\tmean longitude\t\t\ttrue_longitude\t\t\tdifference"
38
- # puts "10:45:31.691_#{usec}\t\t\t#{ml}\t\t#{tl}\t\t#{da}"
39
- # puts
40
- puts "time\t\t\tapparent longitude\t\tright ascension\t\t\tdifference"
41
- puts "10:45:31.691_244_989_#{psec}\t\t\t#{al}\t\t#{ra}\t\t#{db}"
42
- puts
43
- end
44
- #~ end
@@ -1,45 +0,0 @@
1
- # class that goes with equationoftime.herokuapp.com/analemma
2
- class AnalemmaDataTable
3
-
4
- attr_accessor :data, :finish, :start, :table, :html
5
-
6
- def initialize
7
- @start = Time.utc( 2014, "jan", 1, 12, 0, 0 ).to_s
8
- @start_jd = Date.parse(@start).jd.to_s
9
- @finish = Time.utc( 2014, "dec", 31, 12, 0, 0 ).to_s
10
- @finish_jd = Date.parse(@finish).jd.to_s
11
- @span = Date.parse( @finish ).jd - Date.parse( @start ).jd
12
- @file_path = File.expand_path( File.dirname( __FILE__ ) + "/analemma_data.yml" )
13
- @data = YAML::load( File.open( @file_path, 'r'), :safe => true ).freeze
14
- @table = ""
15
- @html = ""
16
-
17
- (0..@span).each do |i|
18
- p @data[i]
19
- # @jd = @data[i].fetch ":jd"
20
- # @date = @data[i].fetch ":date"
21
- # @delta_1 = @data[i].fetch ":delta_1"
22
- # @delta_2 = @data[i].fetch ":delta_2"
23
- # @delta_t = @data[i].fetch ":delta_t"
24
- # @declination = @data[i].fetch ":declination"
25
- # @transit = @data[i].fetch ":transit"
26
- end
27
- end
28
- end
29
-
30
- if __FILE__ == $PROGRAM_NAME
31
-
32
- begin
33
- require 'eot'
34
- rescue LoadError
35
- lib = File.expand_path('../../lib', __FILE__)
36
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
37
- require 'eot'
38
- end
39
-
40
- require 'safe_yaml'
41
- require 'eot'
42
-
43
- adt = AnalemmaDataTable.new
44
-
45
- end
@@ -1,42 +0,0 @@
1
- # earth_rotation.rb
2
-
3
- require 'bigdecimal'
4
-
5
- factor = 1 / (1 - 1 / 366.0)
6
- bd_factor = BigDecimal.new("#{1 / (1 - 1 / 366.0)}") * 1.0
7
- puts "360 degrees x #{factor} = #{360 * factor} degrees"
8
- puts "360 degrees x #{bd_factor} = #{360 * bd_factor} degrees"
9
-
10
- sidereal_minutes = 4 / factor
11
- bd_sidereal_minutes = 4 / bd_factor
12
- puts sidereal_minutes
13
- puts sidereal_minutes
14
-
15
- begin
16
- require 'eot'
17
- rescue LoadError
18
- lib = File.expand_path('../../lib', __FILE__)
19
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
20
- require 'eot'
21
- end
22
-
23
- eot = Eot.new()
24
- # From angles.rb:<br>
25
- # angle factor for daily sidereal time (experimental)
26
- def factor eot
27
- eot.ajd = Date.parse("2000-01-01").jd
28
- tlaa = eot.tl_Aries()
29
- eot.ajd = eot.ajd + 1
30
- tlab = eot.tl_Aries()
31
- dif = (tlab - tlaa) * Eot::R2D
32
- f1 = dif / 360.0 + 1
33
- 1 / f1
34
- end
35
-
36
- p factor(eot) * 4
37
- p factor(eot) * 4 * 360.0
38
- p factor(eot) * 4 * 360.0 / 60.0
39
- p factor(eot) * 4 * 360.0 / 60.0 * 366
40
- shd = factor(eot) * 4 * 360.0 / 60.0
41
- sdnl = shd * 366 * 4
42
- p sdnl / (4 * 365 + 1)
@@ -1,48 +0,0 @@
1
- # eot_methods_list.rb
2
- #
3
- begin
4
- require 'eot'
5
- rescue LoadError
6
- lib = File.expand_path('../../lib', __FILE__)
7
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
8
- require 'eot'
9
- end
10
-
11
- require 'eot'
12
- $DEBUG and set_trace_func proc { |event, file, line, id, binding, classname|
13
- printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname
14
- }
15
-
16
- date = DateTime.now.to_time.utc.to_datetime
17
- puts date
18
-
19
- eot = Eot.new
20
- puts eot.nil?
21
- puts eot.public_methods(false).count
22
- list = eot.public_methods(false).sort
23
- sym_list = []
24
- list.each {|i|sym_list << i.to_sym}
25
- #p sym_list
26
- my_list =[:al_Sun, :angle_delta_oblique, :angle_delta_orbit, :angle_delta_psi, :angle_equation_of_time,
27
- :apparent_longitude, :apparent_longitude_string, :center, :cosine_al_Sun, :cosine_apparent_longitude,
28
- :cosine_tl_Sun, :cosine_to_Earth, :cosine_true_longitude, :cosine_true_obliquity, :dec_Sun,
29
- :declination, :declination_string, :degrees_to_s, :delta_epsilon, :delta_equinox, :delta_oblique, :delta_orbit,
30
- :delta_psi, :delta_t_ecliptic, :delta_t_elliptic, :display_equation_of_time, :display_time_string,
31
- :eccentricity_Earth, :eccentricity_earth_orbit, :ecliptic_longitude, :eot, :eot_jd, :eq_of_equinox,
32
- :equation_of_center, :geometric_mean_longitude, :gml_Sun, :ha_Sun, :horizon_angle,
33
- :jd_to_date_string, :julian_period_day_fraction_to_time, :latitude, :latitude=, :local_noon_dt,
34
- :ma_Sun, :mean_anomaly, :mean_anomaly_string, :mean_local_noon_dt, :mean_longitude_aries,
35
- :mean_obliquity, :mean_obliquity_of_ecliptic, :ml_Aries, :mo_Earth, :mod_360, :now,
36
- :obliquity_correction, :omega, :ra_Sun, :right_ascension, :right_ascension_string, :show_minutes,
37
- :show_now, :sine_al_Sun, :sine_apparent_longitude, :sine_tl_Sun, :sine_to_Earth,
38
- :sine_true_longitude, :string_al_Sun, :string_day_fraction_to_time, :string_dec_Sun,
39
- :string_delta_oblique, :string_delta_orbit, :string_eot, :string_eqc, :string_jd_to_date,
40
- :string_ma_Sun, :string_ra_Sun, :string_ta_Sun, :string_time, :string_tl_Sun, :string_to_Earth,
41
- :sunrise_dt, :sunrise_jd, :sunset_dt, :sunset_jd, :ta_Sun, :time_delta_oblique, :time_delta_orbit,
42
- :time_eot, :time_julian_centurey, :time_julian_century, :tl_Aries, :tl_Sun, :to_Earth,
43
- :true_anomaly, :true_anomaly_string, :true_longitude, :true_longitude_aries,
44
- :true_longitude_string, :true_obliquity, :true_obliquity_string, :truncate]
45
- my_list.collect {|e| p e}
46
-
47
- puts date
48
-
data/examples/eot_plot.r DELETED
@@ -1,57 +0,0 @@
1
-
2
- R version 3.0.0 (2013-04-03) -- "Masked Marvel"
3
- Copyright (C) 2013 The R Foundation for Statistical Computing
4
- Platform: i386-w64-mingw32/i386 (32-bit)
5
-
6
- R is free software and comes with ABSOLUTELY NO WARRANTY.
7
- You are welcome to redistribute it under certain conditions.
8
- Type 'license()' or 'licence()' for distribution details.
9
-
10
- R is a collaborative project with many contributors.
11
- Type 'contributors()' for more information and
12
- 'citation()' on how to cite R or R packages in publications.
13
-
14
- Type 'demo()' for some demos, 'help()' for on-line help, or
15
- 'help.start()' for an HTML browser interface to help.
16
- Type 'q()' to quit R.
17
-
18
- #formulas, equations and notation from http://homeweb2.unifr.ch/hungerbu/pub/sonnenuhr/sundial.ps
19
- # and by the paper of C. Blatter (http://dz-srv1.sub.uni-goettingen.de/sub/digbib/loader?did=D241775)
20
-
21
- epsilon=23.45*2*pi/360
22
- alpha =78.5 *2*pi/360
23
- kappa =0.016722
24
-
25
- mu<-function(t,epsilon,alpha,kappa) {
26
- zaehl= -sin(delta(t,kappa))+tan(epsilon/2)^2*sin(2*(t-alpha)+delta(t,kappa))
27
- nenn = cos(delta(t,kappa))+tan(epsilon/2)^2*cos(2*(t-alpha)+delta(t,kappa))
28
- return( atan(zaehl/nenn) )
29
- }
30
-
31
- # approximation by Blatter
32
- psi<-function(t) {
33
- return(t+delta(t))
34
- }
35
-
36
- delta<-function(t,kappa) {
37
- return( 2*sin(t)*kappa+5/4*sin(2*t)*kappa^2 )
38
- }
39
-
40
- png(filename="Equation of time.jpg", width=1024, height=768, pointsize=12)
41
- par(bg="whitesmoke")
42
- time=seq(-0.6,2*pi+0.4,length=365+(0.6+0.4)/(2*pi)*365)
43
- da<-paste("1.",as.character(seq(1,12,by=2)),".07",sep="")
44
- da<-as.Date(c(da,"1.1.08"),"%d.%m.%y")
45
- #umrechungsfaktor: 24h=2*pi
46
- plot(time,mu(time,epsilon,alpha,kappa)*24*60/(2*pi),type="l",col="red",xlab="Tag",ylab="Time in Minutes",main="Equation of time: true solar time - mean solar time",cex.main=1.5,lwd=3,xaxt="n",xaxs="i",xlim=range(time))
47
- lines(time,mu(time,epsilon=0,alpha,kappa)*24*60/(2*pi),lwd=2,col="navy",lty="dotdash")
48
- lines(time,mu(time,epsilon,alpha,kappa=0)*24*60/(2*pi),lwd=2,col="purple",lty="dashed")
49
- #grid
50
- abline(h=c(-15,-10,-5,5,10,15),lty="dotted",col="grey")
51
- abline(h=0,lty="solid",col="grey33")
52
- tage=cumsum(c(0,31,28,31,30,31,30,31,31,30,31,30,31))/365-3/365
53
- abline(v=tage*2*pi,lty="dotted",col="grey")
54
- axis(1,at=seq(0,2*pi,length=7)-3*2*pi/365,labels=as.character(da,"1. %b"))
55
- legend(x=5.5,y=-10.9,legend=c("Equation of time","Ecliptic","Earth Orbit"),col=c("red","navy","purple"),lwd=c(3,2,2),lty=c("solid","dotdash","dashed"))
56
- dev.off()
57
-
@@ -1,149 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # eot_suntimes.rb leftover from building the parts in the gem so just left it here.
3
- #
4
- begin
5
- require 'eot'
6
- rescue LoadError
7
- lib = File.expand_path('../../lib', __FILE__)
8
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
9
- require 'eot'
10
- end
11
-
12
- #def sunrise_jd(arg)
13
- #
14
- # arg.date.nil? ? result = "date parameter not set" : result = "date parameter OK"
15
- #
16
- # arg.longitude.nil? ? result = "longitude parameter not set" : result = "longitude parameter OK"
17
- #
18
- # arg.latitude.nil? ? result = "latitude parameter not set" : result = "latitude parameter OK"
19
- #
20
- # utc_noon_jd = arg.date.jd
21
- #
22
- # lng_jd = arg.longitude / 360.0
23
- #
24
- # mean_utc_noon_jd = utc_noon_jd - lng_jd
25
- #
26
- # tjc_mean_local_noon_array = arg.time_julian_century(mean_utc_noon_jd)
27
- #
28
- # eot = arg.equation_of_time(tjc_mean_local_noon_array)
29
- #
30
- # eot_jd = eot / 1440.0
31
- #
32
- # true_utc_noon_jd = mean_utc_noon_jd - eot_jd
33
- #
34
- # tjc_true_local_noon_array = arg.time_julian_century(true_utc_noon_jd)
35
- #
36
- # mean_anomaly = arg.ma_Sun(tjc_true_local_noon_array)
37
- #
38
- # lha = arg.ha_Sun(tjc_true_local_noon_array, mean_anomaly)
39
- #
40
- # lha_jd = lha / 360.0
41
- #
42
- # # rise_jd
43
- # true_utc_noon_jd - lha_jd
44
- #
45
- #end
46
- #
47
- #def sunset_jd(arg)
48
- #
49
- # arg.date.nil? ? result = "date parameter not set" : result = "date parameter OK"
50
- #
51
- # arg.longitude.nil? ? result = "longitude parameter not set" : result = "longitude parameter OK"
52
- #
53
- # arg.latitude.nil? ? result = "latitude parameter not set" : result = "latitude parameter OK"
54
- #
55
- # utc_noon_jd = arg.date.jd
56
- #
57
- # lng_jd = arg.longitude / 360.0
58
- #
59
- # mean_utc_noon_jd = utc_noon_jd - lng_jd
60
- #
61
- # tjc_mean_local_noon = arg.time_julian_century(mean_utc_noon_jd)
62
- #
63
- # eot_jd = arg.equation_of_time(tjc_mean_local_noon) / 1440.0
64
- #
65
- # true_utc_noon_jd = mean_utc_noon_jd - eot_jd
66
- #
67
- # tjc_true_local_noon = arg.time_julian_century(true_utc_noon_jd)
68
- #
69
- # mean_anomaly = arg.ma_Sun(tjc_true_local_noon)
70
- #
71
- # lha_jd = arg.ha_Sun(tjc_true_local_noon, mean_anomaly) / 360.0
72
- #
73
- # # sunset jd
74
- # true_utc_noon_jd + lha_jd
75
- #
76
- #end
77
-
78
-
79
- require 'eot'
80
-
81
- addr = "8000 South Michigan Ave., Chicago, IL"
82
- #loc = GeoLatLng.new
83
- #loc.addr = addr
84
- #loc.get_coordinates_from_address
85
- #puts loc.lat, loc.lng
86
-
87
- eot = Eot.new(addr)
88
- #eot.longitude = loc.lng
89
- #eot.ajd = Date.today.jd
90
- #eot.latitude = loc.lat
91
-
92
- #puts "Using this files methods"
93
- #puts sunrise_jd(Date.today)
94
-
95
- ## Note: DateTime.jd() renders time from midnight not noon
96
- ## so 12 hours need to be added for correct time.
97
- #puts DateTime.jd(sunrise_jd() + 0.5)
98
- #puts DateTime.jd(sunrise_jd() + 0.5).to_time.utc
99
- #
100
- #puts
101
- #puts sunset_jd()
102
- #
103
- #puts DateTime.jd(sunset_jd() + 0.5)
104
- #puts DateTime.jd(sunset_jd() + 0.5).to_time.utc
105
-
106
- OUT =<<EOS
107
-
108
- Using eot gem methods
109
-
110
- #{eot.latitude}
111
- #{eot.longitude}
112
-
113
- #{eot.sunrise_jd()}
114
- #{eot.ajd_to_datetime(eot.sunrise_jd())}
115
- #{eot.ajd_to_datetime(eot.sunrise_jd()).to_time}
116
-
117
- #{eot.sunset_jd()}
118
- #{eot.ajd_to_datetime(eot.sunset_jd())}
119
- #{eot.ajd_to_datetime(eot.sunset_jd()).to_time}
120
-
121
- #{Date.jd(Date.today.jd)}
122
- #{Date.today.jd}
123
-
124
- #{DateTime.jd(Date.today.jd)}
125
- #{DateTime.jd(Date.today.jd + 0.5)}
126
-
127
- #{DateTime.jd(Date.today.jd).to_time.utc}
128
- #{DateTime.jd(Date.today.jd + 0.5).to_time.utc}
129
-
130
- #{Time.now.to_datetime}
131
- #{Time.now.to_datetime.jd}
132
-
133
- #{Time.now.utc.to_datetime}
134
- #{Time.now.utc.to_date.jd}
135
-
136
- #{Date.jd(Time.now.to_date.jd)}
137
- #{Date.jd(Time.now.utc.to_date.jd)}
138
-
139
- #{DateTime.jd(Time.now.to_datetime.jd)}
140
- #{DateTime.jd(Time.now.utc.to_datetime.jd)}
141
-
142
- #{DateTime.jd(Time.now.to_datetime.jd).to_time}
143
- #{DateTime.jd(Time.now.utc.to_datetime.jd).to_time}
144
-
145
- #{DateTime.jd(Time.now.to_datetime.jd + 0.5).to_time}
146
- #{DateTime.jd(Time.now.utc.to_datetime.jd + 0.5).to_time}
147
- EOS
148
-
149
- puts OUT