Module: BTAP::Environment
- Defined in:
- lib/openstudio-standards/weather/Weather.Model.rb
Defined Under Namespace
Classes: WeatherFile
Class Method Summary collapse
-
.create_climate_index_file(folder = "#{File.dirname(__FILE__)}/../../../weather", output_file = 'C:/test/phylroy.csv') ⇒ Object
This method will create a climate index file.
-
.create_climate_json_file(folder = "#{File.dirname(__FILE__)}/../../../weather", output_file = 'C:/test/phylroy.csv') ⇒ Object
This method will create a climate index file.
-
.get_canadian_weather_file_names ⇒ Object
this method is used to populate user interfaces if needed from the hash above.
Class Method Details
.create_climate_index_file(folder = "#{File.dirname(__FILE__)}/../../../weather", output_file = 'C:/test/phylroy.csv') ⇒ Object
This method will create a climate index file.
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
# File 'lib/openstudio-standards/weather/Weather.Model.rb', line 279 def self.create_climate_index_file(folder = "#{File.dirname(__FILE__)}/../../../weather", output_file = 'C:/test/phylroy.csv') data = '' counter = 0 File.open(output_file, 'w') do |file| puts "outpus #{output_file}" data << "file,location_name,energy_plus_location_name,country,state_province_region,city,hdd10,hdd18,cdd10,cdd18,latitude,longitude,elevation, deltaDB, climate_zone, cz_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, heating_design_info[1],cooling_design_info[1],extremes_design_info[1],db990\n" BTAP::FileIO.get_find_files_from_folder_by_extension(folder, 'epw').sort.each do |wfile| wf = BTAP::Environment::WeatherFile.new(wfile) data << "#{File.basename(wfile)}, #{wf.location_name}\,#{wf.energy_plus_location_name},#{wf.country}, #{wf.state_province_region}, #{wf.city}, #{wf.hdd10}, #{wf.hdd18},#{wf.cdd10},#{wf.cdd18},#{wf.latitude}, #{wf.longitude}, #{wf.elevation}, #{wf.delta_dry_bulb} ,#{wf.climate_zone},#{wf.standard},#{wf.summer_wet_months}, #{wf.winter_dry_months},#{wf.autumn_months}, #{wf.spring_months}, #{wf.typical_summer_wet_week}, #{wf.typical_winter_dry_week}, #{wf.typical_autumn_week}, #{wf.typical_spring_week},#{wf.heating_design_info[1]},#{wf.cooling_design_info[1]},#{wf.extremes_design_info[1]},#{wf.db990}\n" counter += 1 end file.write(data) end puts "parsed #{counter} weather files." end |
.create_climate_json_file(folder = "#{File.dirname(__FILE__)}/../../../weather", output_file = 'C:/test/phylroy.csv') ⇒ Object
This method will create a climate index file.
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 |
# File 'lib/openstudio-standards/weather/Weather.Model.rb', line 301 def self.create_climate_json_file(folder = "#{File.dirname(__FILE__)}/../../../weather", output_file = 'C:/test/phylroy.csv') data_array = [] File.open(output_file, 'w') do |file| BTAP::FileIO.get_find_files_from_folder_by_extension(folder, 'epw').sort.each do |wfile| wf = BTAP::Environment::WeatherFile.new(wfile) data = {} data_array << data data['file'] = File.basename(wfile).encode('UTF-8') data['location_name'] = wf.location_name.force_encoding('ISO-8859-1').encode('UTF-8') data['energy_plus_location_name'] = wf.energy_plus_location_name.force_encoding('ISO-8859-1').encode('UTF-8') data['country'] = wf.country.force_encoding('ISO-8859-1').encode('UTF-8') data['state_province_region'] = wf.state_province_region.force_encoding('ISO-8859-1').encode('UTF-8') data['city'] = wf.city.force_encoding('ISO-8859-1').encode('UTF-8') data['hdd10'] = wf.hdd10 data['hdd18'] = wf.hdd18 data['cdd10'] = wf.cdd10 data['cdd18'] = wf.cdd18 data['latitude'] = wf.latitude data['longitude'] = wf.longitude data['elevation'] = wf.delta_dry_bulb data['climate_zone'] = wf.climate_zone.force_encoding('ISO-8859-1').encode('UTF-8') data['standard'] = wf.standard data['summer_wet_months'] = wf.summer_wet_months.force_encoding('ISO-8859-1').encode('UTF-8') data['winter_dry_months'] = wf.autumn_months.force_encoding('ISO-8859-1').encode('UTF-8') data['spring_months'] = wf.spring_months.force_encoding('ISO-8859-1').encode('UTF-8') data['typical_summer_wet_week'] = wf.typical_summer_wet_week data['typical_winter_dry_week'] = wf.typical_winter_dry_week data['typical_autumn_week'] = wf.typical_autumn_week data['typical_spring_week'] = wf.typical_spring_week data['wf.heating_design_info[1]'] = wf.heating_design_info[1] data['cooling_design_info[1]'] = wf.cooling_design_info[1] data['extremes_design_info[1]'] = wf.extremes_design_info[1] data['db990'] = wf.db990 end File.write(output_file,JSON.pretty_generate(data_array)) end end |
.get_canadian_weather_file_names ⇒ Object
this method is used to populate user interfaces if needed from the hash above.
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/openstudio-standards/weather/Weather.Model.rb', line 259 def self.get_canadian_weather_file_names() canadian_file_names = [] if __dir__[0] == ':' # Running from OpenStudio CLI ('../../../', /.*\.epw/).each do |file| canadian_file_names << File.basename(file).to_s end else Dir.glob("#{File.dirname(__FILE__)}/../../../**/*.epw").each do |file| canadian_file_names << File.basename(file).to_s puts "File.basename = #{File.basename(file)}" puts "File.dirname = #{File.dirname(file)}" end end return canadian_file_names end |