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.
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'lib/openstudio-standards/weather/Weather.Model.rb', line 366 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.
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
# File 'lib/openstudio-standards/weather/Weather.Model.rb', line 386 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.
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 |
# File 'lib/openstudio-standards/weather/Weather.Model.rb', line 346 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 |