solcal 0.0.2 → 0.0.3

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.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/Gemfile +0 -0
  4. data/LICENSE.txt +0 -0
  5. data/README.md +0 -0
  6. data/Rakefile +0 -0
  7. data/lib/solcal.rb +0 -0
  8. data/lib/solcal/angle.rb +0 -0
  9. data/lib/solcal/commands.rb +3 -0
  10. data/lib/solcal/commands/app_longitude_command.rb +0 -0
  11. data/lib/solcal/commands/base_command.rb +0 -0
  12. data/lib/solcal/commands/civil_dawn_command.rb +10 -0
  13. data/lib/solcal/commands/civil_dusk_command.rb +10 -0
  14. data/lib/solcal/commands/declination_command.rb +0 -0
  15. data/lib/solcal/commands/duration_command.rb +0 -0
  16. data/lib/solcal/commands/eccent_earth_orbit_command.rb +0 -0
  17. data/lib/solcal/commands/equation_of_center_command.rb +0 -0
  18. data/lib/solcal/commands/equation_of_time_command.rb +0 -0
  19. data/lib/solcal/commands/geometric_mean_anom_command.rb +0 -0
  20. data/lib/solcal/commands/geometric_mean_long_command.rb +0 -0
  21. data/lib/solcal/commands/ha_civil_twighlight_command.rb +13 -0
  22. data/lib/solcal/commands/ha_sunrise_command.rb +0 -0
  23. data/lib/solcal/commands/julian_century_command.rb +0 -0
  24. data/lib/solcal/commands/mean_oblique_ecliptic_command.rb +0 -0
  25. data/lib/solcal/commands/naming_convention.rb +0 -0
  26. data/lib/solcal/commands/oblique_correction_command.rb +0 -0
  27. data/lib/solcal/commands/right_ascension_command.rb +0 -0
  28. data/lib/solcal/commands/solar_noon_command.rb +0 -0
  29. data/lib/solcal/commands/sunrise_command.rb +0 -0
  30. data/lib/solcal/commands/sunset_command.rb +0 -0
  31. data/lib/solcal/commands/true_longitude_command.rb +0 -0
  32. data/lib/solcal/commands/var_y_command.rb +0 -0
  33. data/lib/solcal/location.rb +2 -0
  34. data/lib/solcal/time_of_day.rb +0 -0
  35. data/lib/solcal/version.rb +1 -1
  36. data/solcal.gemspec +0 -0
  37. data/spec/angle_spec.rb +0 -0
  38. data/spec/commands/app_longitude_command_spec.rb +0 -0
  39. data/spec/commands/base_command_spec.rb +0 -0
  40. data/spec/commands/civil_dawn_command_spec.rb +13 -0
  41. data/spec/commands/civil_dusk_command_spec.rb +13 -0
  42. data/spec/commands/declination_command_spec.rb +0 -0
  43. data/spec/commands/duration_command_spec.rb +0 -0
  44. data/spec/commands/eccent_earth_orbit_command_spec.rb +0 -0
  45. data/spec/commands/equation_of_center_command_spec.rb +0 -0
  46. data/spec/commands/equation_of_time_command_spec.rb +0 -0
  47. data/spec/commands/geometric_mean_anom_command_spec.rb +0 -0
  48. data/spec/commands/geometric_mean_long_command_spec.rb +0 -0
  49. data/spec/commands/ha_civil_twightlight_command_spec.rb +13 -0
  50. data/spec/commands/ha_sunrise_command_spec.rb +0 -0
  51. data/spec/commands/julian_century_command_spec.rb +0 -0
  52. data/spec/commands/mean_oblique_ecliptic_command_spec.rb +0 -0
  53. data/spec/commands/naming_convention_spec.rb +0 -0
  54. data/spec/commands/oblique_correction_command_spec.rb +0 -0
  55. data/spec/commands/right_ascension_command_spec.rb +0 -0
  56. data/spec/commands/solar_noon_command_spec.rb +0 -0
  57. data/spec/commands/sunrise_command_spec.rb +0 -0
  58. data/spec/commands/sunset_command_spec.rb +0 -0
  59. data/spec/commands/true_longitude_command_spec.rb +0 -0
  60. data/spec/commands/var_y_command_spec.rb +0 -0
  61. data/spec/date_pair_spec.rb +0 -0
  62. data/spec/location_spec.rb +14 -0
  63. data/spec/spec.opts +0 -0
  64. data/spec/spec_helper.rb +0 -0
  65. data/spec/time_of_day_spec.rb +0 -0
  66. metadata +11 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 848951985cdcf0671f66fdc25b2ef4a4785acc76
4
- data.tar.gz: 3097df8b686ac93f491e0e4a5b45797a2e3cb05e
3
+ metadata.gz: ce20de0e91a3f7575b44bcacf6d9710b61953d5f
4
+ data.tar.gz: f50b80342f7c647a5c456565b9cf3103d6f453fa
5
5
  SHA512:
6
- metadata.gz: 1abbd6f9aaa58a259a44c85c1a668cace5751c719ed818d55df6857f2a46b493556d3a6c713fb5052c92312726aabbaf4edb29be72d6ff1336840817fd330b3c
7
- data.tar.gz: 218bf343db317d62d310896a31642a756a7a7629954725d6e8b8dd00f9f35f800415ba55eff32e89b4a0705d7cf48fedc4eeced6e26dc7641c475f174ab20a49
6
+ metadata.gz: 62fc500956aae9a20f175db75f870fd4c21b1a26fd415d311150b2acb43cdd00fffdc3f4f03b8c2a8100683a73e80253fee38e19341a2f4327f1310d348fc1a5
7
+ data.tar.gz: c66bfb77c4519f09555034a84fb29103d74ee7ae45d53b7d91c453883c18c230378991c70add50b64a17c387a3ec3437e80f1fc1377a99325bf5db74a4b3dbf6
data/.gitignore CHANGED
@@ -15,4 +15,5 @@ mkmf.log
15
15
  .vagrant
16
16
  bootstrap.sh
17
17
  Vagrantfile
18
- solcal*.gem
18
+ solcal*.gem
19
+ ._*.rb
data/Gemfile CHANGED
File without changes
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
File without changes
File without changes
File without changes
@@ -21,6 +21,9 @@ module SolCal
21
21
  autoload :SunriseCommand, 'solcal/commands/sunrise_command'
22
22
  autoload :SunsetCommand, 'solcal/commands/sunset_command'
23
23
  autoload :DaylightCommand, 'solcal/commands/daylight_command'
24
+ autoload :HaCivilTwighlightCommand, 'solcal/commands/ha_civil_twighlight_command'
25
+ autoload :CivilDawnCommand, 'solcal/commands/civil_dawn_command'
26
+ autoload :CivilDuskCommand, 'solcal/commands/civil_dusk_command'
24
27
 
25
28
  extend NamingConvention
26
29
 
File without changes
@@ -0,0 +1,10 @@
1
+ module SolCal
2
+ module Commands
3
+ class CivilDawnCommand < BaseCommand
4
+ protected
5
+ def do_execute
6
+ SolCal::TimeOfDay.new(solar_noon-ha_civil_twighlight.to_deg*4/1440)
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module SolCal
2
+ module Commands
3
+ class CivilDuskCommand < BaseCommand
4
+ protected
5
+ def do_execute
6
+ SolCal::TimeOfDay.new(solar_noon+ha_civil_twighlight.to_deg*4/1440)
7
+ end
8
+ end
9
+ end
10
+ end
File without changes
@@ -0,0 +1,13 @@
1
+ module SolCal
2
+ module Commands
3
+ class HaCivilTwighlightCommand < BaseCommand
4
+ protected
5
+ def do_execute
6
+ a = Math.cos(Angle.from_deg(96).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
+ Angle.from_rad(Math.acos(a/b-c))
10
+ end
11
+ end
12
+ end
13
+ end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -13,6 +13,8 @@ module SolCal
13
13
  Commands.run(:sunrise, results)
14
14
  Commands.run(:sunset, results)
15
15
  Commands.run(:duration, results)
16
+ Commands.run(:civil_dawn, results)
17
+ Commands.run(:civil_dusk, results)
16
18
  results
17
19
  end
18
20
 
File without changes
@@ -1,3 +1,3 @@
1
1
  module Solcal
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
File without changes
File without changes
File without changes
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe "CivilDawnCommand" do
4
+ before :each do
5
+ @result = {julian_century:0.149125142596397, latitude:SolCal::Angle.from_deg(53.5333),declination:SolCal::Angle.from_deg(-21.7958) ,solar_noon:0.515931}
6
+ @command = SolCal::Commands::CivilDawnCommand.new(@result)
7
+ end
8
+
9
+ it "should execute" do
10
+ @command.execute
11
+ expect(@result[:civil_dawn].to_s).to eql("07:45")
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe "CivilDuskCommand" do
4
+ before :each do
5
+ @result = {julian_century:0.149125142596397, latitude:SolCal::Angle.from_deg(53.5333),declination:SolCal::Angle.from_deg(-21.7958) ,solar_noon:0.515931}
6
+ @command = SolCal::Commands::CivilDuskCommand.new(@result)
7
+ end
8
+
9
+ it "should execute" do
10
+ @command.execute
11
+ expect(@result[:civil_dusk].to_s).to eql("17:00")
12
+ end
13
+ end
File without changes
File without changes
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe "HaCivilTwighlightCommand" do
4
+ before :each do
5
+ @result = {julian_century:0.149125142596397, latitude:SolCal::Angle.from_deg(53.5333),declination:SolCal::Angle.from_deg(-21.7958) ,solar_noon:0.515931}
6
+ @command = SolCal::Commands::HaCivilTwighlightCommand.new(@result)
7
+ end
8
+
9
+ it "should execute" do
10
+ @command.execute
11
+ expect(@result[:ha_civil_twighlight].to_deg).to be_within(0.0001).of(69.4109)
12
+ end
13
+ end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -27,42 +27,56 @@ describe "Location" do
27
27
  expect(results[:sunrise].to_s).to eql("08:27")
28
28
  expect(results[:sunset].to_s).to eql("16:18")
29
29
  expect(results[:duration]).to be_within(1).of(472.16513)
30
+ expect(results[:civil_dawn].to_s).to eql("07:45")
31
+ expect(results[:civil_dusk].to_s).to eql("17:00")
30
32
  end
31
33
 
32
34
  it "should calculate daylight information in Edmonton on winter solstice" do
33
35
  results = @edmonton.daylight(2014,12,21,-7)
34
36
  expect(results[:sunrise].to_s).to eql("08:48")
35
37
  expect(results[:sunset].to_s).to eql("16:15")
38
+ expect(results[:civil_dawn].to_s).to eql("08:05")
39
+ expect(results[:civil_dusk].to_s).to eql("16:59")
36
40
  end
37
41
 
38
42
  it "should calculate daylight information in Edmonton on summer solstice" do
39
43
  results = @edmonton.daylight(2014,6,21,-6)
40
44
  expect(results[:sunrise].to_s).to eql("05:04")
41
45
  expect(results[:sunset].to_s).to eql("22:07")
46
+ expect(results[:civil_dawn].to_s).to eql("04:11")
47
+ expect(results[:civil_dusk].to_s).to eql("23:00")
42
48
  end
43
49
 
44
50
  it "should calculate daylight information in Miami on winter solstice" do
45
51
  results = @miami.daylight(2014,12,21,-5)
46
52
  expect(results[:sunrise].to_s).to eql("07:03")
47
53
  expect(results[:sunset].to_s).to eql("17:34")
54
+ expect(results[:civil_dawn].to_s).to eql("06:37")
55
+ expect(results[:civil_dusk].to_s).to eql("17:59")
48
56
  end
49
57
 
50
58
  it "should calculate daylight information in Miami on summer solstice" do
51
59
  results = @miami.daylight(2014,6,21,-4)
52
60
  expect(results[:sunrise].to_s).to eql("06:30")
53
61
  expect(results[:sunset].to_s).to eql("20:15")
62
+ expect(results[:civil_dawn].to_s).to eql("06:04")
63
+ expect(results[:civil_dusk].to_s).to eql("20:41")
54
64
  end
55
65
 
56
66
  it "should calculate daylight information in Sydney on winter solstice" do
57
67
  results = @sydney.daylight(2014,12,21,+11)
58
68
  expect(results[:sunrise].to_s).to eql("05:41")
59
69
  expect(results[:sunset].to_s).to eql("20:05")
70
+ expect(results[:civil_dawn].to_s).to eql("05:11")
71
+ expect(results[:civil_dusk].to_s).to eql("20:34")
60
72
  end
61
73
 
62
74
  it "should calculate daylight information in Sydney on summer solstice" do
63
75
  results = @sydney.daylight(2014,6,21,+10)
64
76
  expect(results[:sunrise].to_s).to eql("07:00")
65
77
  expect(results[:sunset].to_s).to eql("16:53")
78
+ expect(results[:civil_dawn].to_s).to eql("06:32")
79
+ expect(results[:civil_dusk].to_s).to eql("17:21")
66
80
  end
67
81
  end
68
82
 
File without changes
File without changes
File without changes
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.2
4
+ version: 0.0.3
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-01-15 00:00:00.000000000 Z
11
+ date: 2015-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -57,6 +57,8 @@ files:
57
57
  - lib/solcal/commands.rb
58
58
  - lib/solcal/commands/app_longitude_command.rb
59
59
  - lib/solcal/commands/base_command.rb
60
+ - lib/solcal/commands/civil_dawn_command.rb
61
+ - lib/solcal/commands/civil_dusk_command.rb
60
62
  - lib/solcal/commands/declination_command.rb
61
63
  - lib/solcal/commands/duration_command.rb
62
64
  - lib/solcal/commands/eccent_earth_orbit_command.rb
@@ -64,6 +66,7 @@ files:
64
66
  - lib/solcal/commands/equation_of_time_command.rb
65
67
  - lib/solcal/commands/geometric_mean_anom_command.rb
66
68
  - lib/solcal/commands/geometric_mean_long_command.rb
69
+ - lib/solcal/commands/ha_civil_twighlight_command.rb
67
70
  - lib/solcal/commands/ha_sunrise_command.rb
68
71
  - lib/solcal/commands/julian_century_command.rb
69
72
  - lib/solcal/commands/mean_oblique_ecliptic_command.rb
@@ -82,6 +85,8 @@ files:
82
85
  - spec/angle_spec.rb
83
86
  - spec/commands/app_longitude_command_spec.rb
84
87
  - spec/commands/base_command_spec.rb
88
+ - spec/commands/civil_dawn_command_spec.rb
89
+ - spec/commands/civil_dusk_command_spec.rb
85
90
  - spec/commands/declination_command_spec.rb
86
91
  - spec/commands/duration_command_spec.rb
87
92
  - spec/commands/eccent_earth_orbit_command_spec.rb
@@ -89,6 +94,7 @@ files:
89
94
  - spec/commands/equation_of_time_command_spec.rb
90
95
  - spec/commands/geometric_mean_anom_command_spec.rb
91
96
  - spec/commands/geometric_mean_long_command_spec.rb
97
+ - spec/commands/ha_civil_twightlight_command_spec.rb
92
98
  - spec/commands/ha_sunrise_command_spec.rb
93
99
  - spec/commands/julian_century_command_spec.rb
94
100
  - spec/commands/mean_oblique_ecliptic_command_spec.rb
@@ -134,6 +140,8 @@ test_files:
134
140
  - spec/angle_spec.rb
135
141
  - spec/commands/app_longitude_command_spec.rb
136
142
  - spec/commands/base_command_spec.rb
143
+ - spec/commands/civil_dawn_command_spec.rb
144
+ - spec/commands/civil_dusk_command_spec.rb
137
145
  - spec/commands/declination_command_spec.rb
138
146
  - spec/commands/duration_command_spec.rb
139
147
  - spec/commands/eccent_earth_orbit_command_spec.rb
@@ -141,6 +149,7 @@ test_files:
141
149
  - spec/commands/equation_of_time_command_spec.rb
142
150
  - spec/commands/geometric_mean_anom_command_spec.rb
143
151
  - spec/commands/geometric_mean_long_command_spec.rb
152
+ - spec/commands/ha_civil_twightlight_command_spec.rb
144
153
  - spec/commands/ha_sunrise_command_spec.rb
145
154
  - spec/commands/julian_century_command_spec.rb
146
155
  - spec/commands/mean_oblique_ecliptic_command_spec.rb