Class: OpenstudioStandards::Weather::StatFile
- Inherits:
-
Object
- Object
- OpenstudioStandards::Weather::StatFile
- Defined in:
- lib/openstudio-standards/weather/stat_file.rb
Instance Attribute Summary collapse
-
#autumn_months ⇒ Object
Returns the value of attribute autumn_months.
-
#cdd10 ⇒ Object
Returns the value of attribute cdd10.
-
#cdd18 ⇒ Object
Returns the value of attribute cdd18.
-
#climate_zone ⇒ Object
Returns the value of attribute climate_zone.
-
#cooling_design_info ⇒ Object
Returns the value of attribute cooling_design_info.
-
#delta_dry_bulb ⇒ Object
Returns the value of attribute delta_dry_bulb.
-
#elevation ⇒ Object
Returns the value of attribute elevation.
-
#extremes_design_info ⇒ Object
Returns the value of attribute extremes_design_info.
-
#gmt ⇒ Object
Returns the value of attribute gmt.
-
#hdd10 ⇒ Object
Returns the value of attribute hdd10.
-
#hdd18 ⇒ Object
Returns the value of attribute hdd18.
-
#heating_design_info ⇒ Object
Returns the value of attribute heating_design_info.
-
#lat ⇒ Object
Returns the value of attribute lat.
-
#lon ⇒ Object
Returns the value of attribute lon.
-
#mean_dry_bulb ⇒ Object
Returns the value of attribute mean_dry_bulb.
-
#monthly_dry_bulb ⇒ Object
Returns the value of attribute monthly_dry_bulb.
-
#monthly_lagged_dry_bulb ⇒ Object
Returns the value of attribute monthly_lagged_dry_bulb.
-
#monthly_undis_ground_temps_0p5m ⇒ Object
Returns the value of attribute monthly_undis_ground_temps_0p5m.
-
#monthly_undis_ground_temps_4p0m ⇒ Object
Returns the value of attribute monthly_undis_ground_temps_4p0m.
-
#path ⇒ Object
Returns the value of attribute path.
-
#spring_months ⇒ Object
Returns the value of attribute spring_months.
-
#standard ⇒ Object
Returns the value of attribute standard.
-
#summer_wet_months ⇒ Object
Returns the value of attribute summer_wet_months.
-
#text ⇒ Object
Returns the value of attribute text.
-
#typical_autumn_week ⇒ Object
Returns the value of attribute typical_autumn_week.
-
#typical_spring_week ⇒ Object
Returns the value of attribute typical_spring_week.
-
#typical_summer_wet_week ⇒ Object
Returns the value of attribute typical_summer_wet_week.
-
#typical_winter_dry_week ⇒ Object
Returns the value of attribute typical_winter_dry_week.
-
#valid ⇒ Object
Returns the value of attribute valid.
-
#winter_dry_months ⇒ Object
Returns the value of attribute winter_dry_months.
Class Method Summary collapse
-
.load(filename) ⇒ Object
load a Stat file as an instance of OpenstudioStandards::Weather::StatFile.
Instance Method Summary collapse
-
#delta_dry_bulb_calc ⇒ Object
max - min of the mean monthly dry bulbs.
-
#initialize(path) ⇒ StatFile
constructor
A new instance of StatFile.
-
#mean_dry_bulb_calc ⇒ Object
the mean of the mean monthly dry bulbs.
-
#monthly_lagged_dry_bulb_calc ⇒ Object
ground temps as monthly dry bulb tempreature lagged 3 months.
-
#output ⇒ Object
Output for debugging stat routines.
-
#to_json(*options) ⇒ String
returns the stat data as a JSON string.
- #valid? ⇒ Boolean
Constructor Details
#initialize(path) ⇒ StatFile
Returns a new instance of StatFile.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 15 def initialize(path) @text = '' @path = Pathname.new(path) @valid = false @lat = nil @lon = nil @gmt = nil @elevation = nil @hdd18 = nil @cdd18 = nil @hdd10 = nil @cdd10 = nil @monthly_dry_bulb = [] @monthly_lagged_dry_bulb = [] @delta_dry_bulb = nil @mean_dry_bulb = nil @heating_design_info = [] @cooling_design_info = [] @extremes_design_info = [] @climate_zone = [] @standard = [] @summer_wet_months = [] @winter_dry_months = [] @autumn_months = [] @spring_months = [] @typical_summer_wet_week = [] @typical_winter_dry_week = [] @typical_autumn_week = [] @typical_spring_week = [] @monthly_undis_ground_temps_0p5m = [] @monthly_undis_ground_temps_4p0m = [] init end |
Instance Attribute Details
#autumn_months ⇒ Object
Returns the value of attribute autumn_months.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def autumn_months @autumn_months end |
#cdd10 ⇒ Object
Returns the value of attribute cdd10.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def cdd10 @cdd10 end |
#cdd18 ⇒ Object
Returns the value of attribute cdd18.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def cdd18 @cdd18 end |
#climate_zone ⇒ Object
Returns the value of attribute climate_zone.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def climate_zone @climate_zone end |
#cooling_design_info ⇒ Object
Returns the value of attribute cooling_design_info.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def cooling_design_info @cooling_design_info end |
#delta_dry_bulb ⇒ Object
Returns the value of attribute delta_dry_bulb.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def delta_dry_bulb @delta_dry_bulb end |
#elevation ⇒ Object
Returns the value of attribute elevation.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def elevation @elevation end |
#extremes_design_info ⇒ Object
Returns the value of attribute extremes_design_info.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def extremes_design_info @extremes_design_info end |
#gmt ⇒ Object
Returns the value of attribute gmt.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def gmt @gmt end |
#hdd10 ⇒ Object
Returns the value of attribute hdd10.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def hdd10 @hdd10 end |
#hdd18 ⇒ Object
Returns the value of attribute hdd18.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def hdd18 @hdd18 end |
#heating_design_info ⇒ Object
Returns the value of attribute heating_design_info.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def heating_design_info @heating_design_info end |
#lat ⇒ Object
Returns the value of attribute lat.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def lat @lat end |
#lon ⇒ Object
Returns the value of attribute lon.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def lon @lon end |
#mean_dry_bulb ⇒ Object
Returns the value of attribute mean_dry_bulb.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def mean_dry_bulb @mean_dry_bulb end |
#monthly_dry_bulb ⇒ Object
Returns the value of attribute monthly_dry_bulb.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def monthly_dry_bulb @monthly_dry_bulb end |
#monthly_lagged_dry_bulb ⇒ Object
Returns the value of attribute monthly_lagged_dry_bulb.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def monthly_lagged_dry_bulb @monthly_lagged_dry_bulb end |
#monthly_undis_ground_temps_0p5m ⇒ Object
Returns the value of attribute monthly_undis_ground_temps_0p5m.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def monthly_undis_ground_temps_0p5m @monthly_undis_ground_temps_0p5m end |
#monthly_undis_ground_temps_4p0m ⇒ Object
Returns the value of attribute monthly_undis_ground_temps_4p0m.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def monthly_undis_ground_temps_4p0m @monthly_undis_ground_temps_4p0m end |
#path ⇒ Object
Returns the value of attribute path.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def path @path end |
#spring_months ⇒ Object
Returns the value of attribute spring_months.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def spring_months @spring_months end |
#standard ⇒ Object
Returns the value of attribute standard.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def standard @standard end |
#summer_wet_months ⇒ Object
Returns the value of attribute summer_wet_months.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def summer_wet_months @summer_wet_months end |
#text ⇒ Object
Returns the value of attribute text.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def text @text end |
#typical_autumn_week ⇒ Object
Returns the value of attribute typical_autumn_week.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def typical_autumn_week @typical_autumn_week end |
#typical_spring_week ⇒ Object
Returns the value of attribute typical_spring_week.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def typical_spring_week @typical_spring_week end |
#typical_summer_wet_week ⇒ Object
Returns the value of attribute typical_summer_wet_week.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def typical_summer_wet_week @typical_summer_wet_week end |
#typical_winter_dry_week ⇒ Object
Returns the value of attribute typical_winter_dry_week.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def typical_winter_dry_week @typical_winter_dry_week end |
#valid ⇒ Object
Returns the value of attribute valid.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def valid @valid end |
#winter_dry_months ⇒ Object
Returns the value of attribute winter_dry_months.
6 7 8 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 6 def winter_dry_months @winter_dry_months end |
Class Method Details
.load(filename) ⇒ Object
load a Stat file as an instance of OpenstudioStandards::Weather::StatFile
52 53 54 55 56 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 52 def self.load(filename) raise "Stat file does not exist: #{filename}" unless File.file?(filename) f = OpenstudioStandards::Weather::StatFile.new(filename) end |
Instance Method Details
#delta_dry_bulb_calc ⇒ Object
max - min of the mean monthly dry bulbs
128 129 130 131 132 133 134 135 136 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 128 def delta_dry_bulb_calc if @monthly_dry_bulb.empty? delta_t = '' else delta_t = @monthly_dry_bulb.max - @monthly_dry_bulb.min end delta_t.to_f end |
#mean_dry_bulb_calc ⇒ Object
the mean of the mean monthly dry bulbs
116 117 118 119 120 121 122 123 124 125 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 116 def mean_dry_bulb_calc if @monthly_dry_bulb.empty? mean = '' else sum = @monthly_dry_bulb.inject(:+) mean = sum / @monthly_dry_bulb.size end mean.to_f end |
#monthly_lagged_dry_bulb_calc ⇒ Object
ground temps as monthly dry bulb tempreature lagged 3 months
105 106 107 108 109 110 111 112 113 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 105 def monthly_lagged_dry_bulb_calc if @monthly_dry_bulb.empty? lagged_temperatures = [] else lagged_temperatures = @monthly_dry_bulb.rotate(-3) end lagged_temperatures end |
#output ⇒ Object
Output for debugging stat routines.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 59 def output line = '' line << "#{@path} , " line << "#{@lat} ," line << "#{@lon} ," line << "#{@gmt} ," line << "#{@elevation} ," line << "#{@hdd18} ," line << "#{@cdd18} ," line << "#{@hdd10} ," line << "#{@cdd10} ," line << "#{monthly_dry_bulb} ," line << "#{monthly_lagged_dry_bulb} ," line << "#{delta_dry_bulb} ," line << "#{mean_dry_bulb} ," line << "#{@heating_design_info} ," line << "#{@cooling_design_info} ," line << "#{@extremes_design_info} ," line << "#{@climate_zone} ," line << "#{@standard} ," line << "#{@summer_wet_months} ," line << "#{@winter_dry_months} ," line << "#{@autumn_months} ," line << "#{@spring_months} ," line << "#{@typical_summer_wet_week} ," line << "#{@typical_winter_dry_week} ," line << "#{@typical_autumn_week} ," line << "#{@typical_spring_week} ," line << "#{@monthly_undis_ground_temps_0p5m} ," line << "#{@monthly_undis_ground_temps_4p0m} ," line << @valid.to_s end |
#to_json(*options) ⇒ String
returns the stat data as a JSON string
96 97 98 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 96 def to_json(*) as_json(*).to_json(*) end |
#valid? ⇒ Boolean
100 101 102 |
# File 'lib/openstudio-standards/weather/stat_file.rb', line 100 def valid? return @valid end |