Method: OpenStudio::Analysis::Workflow.load
- Defined in:
- lib/openstudio/analysis/workflow.rb
.load(h) ⇒ Object
Load from a from a hash
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'lib/openstudio/analysis/workflow.rb', line 251 def self.load(h) # get the version of the file file_format_version = h[:file_format_version] ? h[:file_format_version] : 1 puts "Parsing file version #{file_format_version}" o = OpenStudio::Analysis::Workflow.new if h[:workflow] h[:workflow].each do |wf| puts "Adding measure #{wf[:name]}" # Go though the defined measure paths and try and find the local measure local_measure_dir = nil if wf[:measure_definition_directory_local] && Dir.exist?(wf[:measure_definition_directory_local]) local_measure_dir = wf[:measure_definition_directory_local] else # search in the measure paths for the measure OpenStudio::Analysis.measure_paths.each do |p| test_dir = File.join(p, File.basename(wf[:measure_definition_directory])) if Dir.exist?(test_dir) local_measure_dir = test_dir break end end end raise "Could not find local measure when loading workflow for #{wf[:measure_definition_class_name]} in #{File.basename(wf[:measure_definition_directory])}. You may have to add measure paths to OpenStudio::Analysis.measure_paths" unless local_measure_dir o.add_measure_from_analysis_hash(wf[:name], wf[:display_name], local_measure_dir, wf) end end o end |