solcal 0.0.4 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2afbb64769ab3034ea32fa6ddb97a9a2e628e411
4
- data.tar.gz: d8d4789eeb5a351226410fe08346222a20e26e36
3
+ metadata.gz: b9a9149546523840d9f583cc54dd93730f27e554
4
+ data.tar.gz: 2b1259db753c028063767183077c320bb2611ae6
5
5
  SHA512:
6
- metadata.gz: a79f0fc3f6245d736e4df3d1eaaee189bdf979402dfe1fb4912a0eb28ebba023958a4fd5cdd83702914016c8dc4c671feb0b520df13c342ede59e66fcb16ef92
7
- data.tar.gz: 561a9b6a8a84628074dbabf6adebe2d0e8f741a0650565a5ff70f18eb3d523228d38edd505ee4059fd29746adcfadf8ccdee19a76df0befc67160d2b47498db3
6
+ metadata.gz: f12c2a9a6004f71f8e3335490aae846a229e694057062ed9197aa00dd1b9eb3a3955fa8b932f66c93a55a11826ea1427e05deead54d71ffa914011c65848244c
7
+ data.tar.gz: e582c6243c7a22c613da22342edac15ab885a2d2c118a910be0eedd8baefe276bd285f7a8016f633f2eb183cf886208a96de801ed01db455f52f5dcaadda6e55
data/.gitignore CHANGED
@@ -16,4 +16,5 @@ mkmf.log
16
16
  bootstrap.sh
17
17
  Vagrantfile
18
18
  solcal*.gem
19
- ._*.rb
19
+ ._*.rb
20
+ npm-debug.log
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
1
  source 'https://rubygems.org'
2
- ruby "2.1.5"
2
+ ruby "2.2.2"
3
3
 
4
4
  group :test do
5
5
  gem 'rspec'
@@ -24,7 +24,9 @@ module SolCal
24
24
  autoload :HaCivilTwighlightCommand, 'solcal/commands/ha_civil_twighlight_command'
25
25
  autoload :CivilDawnCommand, 'solcal/commands/civil_dawn_command'
26
26
  autoload :CivilDuskCommand, 'solcal/commands/civil_dusk_command'
27
+ autoload :HaAngleToZenithCommand, 'solcal/commands/ha_angle_to_zenith_command'
27
28
  autoload :TimeToAngleFromZenithCommand, 'solcal/commands/time_to_angle_from_zenith_command'
29
+ autoload :OppositeTimeToAngleFromZenithCommand, 'solcal/commands/opposite_time_to_angle_from_zenith_command'
28
30
 
29
31
  extend NamingConvention
30
32
 
@@ -0,0 +1,15 @@
1
+ module SolCal
2
+ module Commands
3
+ class HaAngleToZenithCommand < BaseCommand
4
+ protected
5
+ def do_execute
6
+ a = Math.cos(Angle.from_deg(angle_from_zenith).to_rad)
7
+ b = Math.cos(latitude.to_rad)*Math.cos(declination.to_rad)
8
+ c = Math.tan(latitude.to_rad)*Math.tan(declination.to_rad)
9
+ d = a/b-c
10
+ return nil unless d >= 0 and d<=1
11
+ Angle.from_rad(Math.acos(d))
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ module SolCal
2
+ module Commands
3
+ class OppositeTimeToAngleFromZenithCommand < BaseCommand
4
+ protected
5
+ def do_execute
6
+ return "The sun will not reach #{angle_from_zenith} degrees from zenith today." unless ha_angle_to_zenith
7
+ SolCal::TimeOfDay.new(solar_noon+ha_angle_to_zenith.to_deg*4/1440)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -3,12 +3,7 @@ module SolCal
3
3
  class TimeToAngleFromZenithCommand < BaseCommand
4
4
  protected
5
5
  def do_execute
6
- a = Math.cos(Angle.from_deg(angle_from_zenith).to_rad)
7
- b = Math.cos(latitude.to_rad)*Math.cos(declination.to_rad)
8
- c = Math.tan(latitude.to_rad)*Math.tan(declination.to_rad)
9
- d = a/b-c
10
- return "The sun will not reach #{angle_from_zenith} degrees from zenith today." unless d >= 0 and d<=1
11
- ha_angle_to_zenith = Angle.from_rad(Math.acos(d))
6
+ return "The sun will not reach #{angle_from_zenith} degrees from zenith today." unless ha_angle_to_zenith
12
7
  SolCal::TimeOfDay.new(solar_noon-ha_angle_to_zenith.to_deg*4/1440)
13
8
  end
14
9
  end
@@ -22,6 +22,7 @@ module SolCal
22
22
  results = create_data(year, month, day, time_zone)
23
23
  results[:angle_from_zenith] = angle_from_zenith
24
24
  Commands.run(:time_to_angle_from_zenith, results)
25
+ Commands.run(:opposite_time_to_angle_from_zenith, results)
25
26
  results
26
27
  end
27
28
 
@@ -1,3 +1,3 @@
1
1
  module Solcal
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -87,21 +87,25 @@ describe "Location" do
87
87
  it "should calculate time to 70deg from zenith on 2015-09-06 in Miami" do
88
88
  results = @miami.time_to_angle_from_zenith(2015, 9, 6, -4, 70)
89
89
  expect(results[:time_to_angle_from_zenith].to_s).to eql("08:35")
90
+ expect(results[:opposite_time_to_angle_from_zenith].to_s).to eql("18:02")
90
91
  end
91
92
 
92
93
  it "should calculate time to 70deg from zenith on 2015-09-06 in Sydney" do
93
94
  results = @sydney.time_to_angle_from_zenith(2015, 9, 6, +10, 70)
94
95
  expect(results[:time_to_angle_from_zenith].to_s).to eql("07:51")
96
+ expect(results[:opposite_time_to_angle_from_zenith].to_s).to eql("15:56")
95
97
  end
96
98
 
97
99
  it "should return that the sun will never reach 47deg from zenith on 2015-09-06 in Edmonton" do
98
100
  results = @edmonton.time_to_angle_from_zenith(2015, 9, 6, -6, 47)
99
101
  expect(results[:time_to_angle_from_zenith].to_s).to eql("The sun will not reach 47 degrees from zenith today.")
102
+ expect(results[:opposite_time_to_angle_from_zenith].to_s).to eql("The sun will not reach 47 degrees from zenith today.")
100
103
  end
101
104
 
102
105
  it "should return that the sun will never reach 19.3deg from zenith on 2015-09-06 in Miami" do
103
106
  results = @miami.time_to_angle_from_zenith(2015, 9, 6, -6, 19.3)
104
107
  expect(results[:time_to_angle_from_zenith].to_s).to eql("The sun will not reach 19.3 degrees from zenith today.")
108
+ expect(results[:opposite_time_to_angle_from_zenith].to_s).to eql("The sun will not reach 19.3 degrees from zenith today.")
105
109
  end
106
110
  end
107
111
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solcal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neil Bourgeois
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-06 00:00:00.000000000 Z
11
+ date: 2015-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,12 +66,14 @@ files:
66
66
  - lib/solcal/commands/equation_of_time_command.rb
67
67
  - lib/solcal/commands/geometric_mean_anom_command.rb
68
68
  - lib/solcal/commands/geometric_mean_long_command.rb
69
+ - lib/solcal/commands/ha_angle_to_zenith_command.rb
69
70
  - lib/solcal/commands/ha_civil_twighlight_command.rb
70
71
  - lib/solcal/commands/ha_sunrise_command.rb
71
72
  - lib/solcal/commands/julian_century_command.rb
72
73
  - lib/solcal/commands/mean_oblique_ecliptic_command.rb
73
74
  - lib/solcal/commands/naming_convention.rb
74
75
  - lib/solcal/commands/oblique_correction_command.rb
76
+ - lib/solcal/commands/opposite_time_to_angle_from_zenith_command.rb
75
77
  - lib/solcal/commands/right_ascension_command.rb
76
78
  - lib/solcal/commands/solar_noon_command.rb
77
79
  - lib/solcal/commands/sunrise_command.rb
@@ -133,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
135
  version: '0'
134
136
  requirements: []
135
137
  rubyforge_project:
136
- rubygems_version: 2.4.3
138
+ rubygems_version: 2.4.8
137
139
  signing_key:
138
140
  specification_version: 4
139
141
  summary: 'Solar Calculator: find sunrise, sunset, solar Noon and solar position for