######################################################################
# Copyright (c) 2008-2013, Alliance for Sustainable Energy.
# All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
######################################################################
# TODO: this should its own gem because this file may be useful in various workflows
module OpenStudio
module Weather
class Epw
attr_accessor :filename
attr_reader :city
attr_reader :state
attr_reader :country
attr_accessor :data_type
attr_reader :wmo
attr_reader :lat
attr_reader :lon
attr_reader :gmt
attr_reader :elevation
attr_accessor :data_period
# access to all the weather data in array of arrays
attr_reader :header_data
attr_accessor :weather_data
def initialize(filename)
@filename = filename
@city = ''
@state = ''
@country = ''
@data_type = ''
@wmo = ''
@lat = ''
@lon = ''
@gmt = ''
@elevation = ''
@valid = false
@header_data = []
@weather_data = []
process_header
end
def self.load(filename)
raise "EPW file does not exist: #{filename}" unless File.exist?(filename)
f = OpenStudio::Weather::Epw.new(filename)
end
def to_kml(xml_builder_obj, url)
xml_builder_obj.Placemark do
xml_builder_obj.name @city
xml_builder_obj.visibility '0'
xml_builder_obj.description do
xml_builder_obj.cdata!('
'\ "#{@city} | |
Data Type | |
WMO #{@wmo} | |
E 3� 15' N 36� 43' | |
25 m | |
Time Zone GMT #{@gmt} hours | |
ASHRAE Std 169 Climate Zone 4A - Mixed - Humid | |
99% Heating DB=3.1, 1% Cooling DB=33.2 | |
HDD18 1019, CDD10 2849 | |
URL #{url} |