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 +4 -4
- data/.gitignore +2 -1
- data/Gemfile +1 -1
- data/lib/solcal/commands.rb +2 -0
- data/lib/solcal/commands/ha_angle_to_zenith_command.rb +15 -0
- data/lib/solcal/commands/opposite_time_to_angle_from_zenith_command.rb +11 -0
- data/lib/solcal/commands/time_to_angle_from_zenith_command.rb +1 -6
- data/lib/solcal/location.rb +1 -0
- data/lib/solcal/version.rb +1 -1
- data/spec/location_spec.rb +4 -0
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b9a9149546523840d9f583cc54dd93730f27e554
|
|
4
|
+
data.tar.gz: 2b1259db753c028063767183077c320bb2611ae6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f12c2a9a6004f71f8e3335490aae846a229e694057062ed9197aa00dd1b9eb3a3955fa8b932f66c93a55a11826ea1427e05deead54d71ffa914011c65848244c
|
|
7
|
+
data.tar.gz: e582c6243c7a22c613da22342edac15ab885a2d2c118a910be0eedd8baefe276bd285f7a8016f633f2eb183cf886208a96de801ed01db455f52f5dcaadda6e55
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/lib/solcal/commands.rb
CHANGED
|
@@ -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
|
-
|
|
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
|
data/lib/solcal/location.rb
CHANGED
data/lib/solcal/version.rb
CHANGED
data/spec/location_spec.rb
CHANGED
|
@@ -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
|
+
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-
|
|
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.
|
|
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
|