Skip to content

Commit

Permalink
Code for pretty report names in PAT
Browse files Browse the repository at this point in the history
  • Loading branch information
rHorsey committed Mar 1, 2017
1 parent 2d9e67b commit 33d010e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/openstudio/workflow/util/post_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module Workflow
module Util
require 'openstudio/workflow/util/measure'
require 'csv'
require 'rexml/document'

# This module serves as a wrapper around various post-processing tasks used to manage outputs
# @todo (rhorsey) ummmm. So some of this is pretty ugly. Since @dmacumber had ideas about this maybe he can figure
Expand Down Expand Up @@ -136,7 +137,12 @@ def gather_reports(run_dir, directory, logger)
# Also, find any "report*.*" files
Dir["#{run_dir}/*/report*.*"].each do |report|
# get the parent directory of the file and snake case it
measure_class_name = File.basename(File.dirname(report))
measure_dir_name = File.dirname(report).split('/').last.gsub(/[0-9][0-9][0-9]_/, '')
measure_xml_path = File.absolute_path(File.join(File.dirname(report), '../../..', 'measures',

This comment has been minimized.

Copy link
@macumber

macumber Jun 30, 2017

Contributor

@rHorsey are you sure this is correct? shouldn't this use workflow json to find the measure so it searches all the measure paths?

measure_dir_name, 'measure.xml'))
logger.info "measure_xml_path: #{measure_xml_path}"
measure_xml = REXML::Document.new File.read(measure_xml_path)
measure_class_name = OpenStudio.toUnderscoreCase(measure_xml.root.elements['class_name'].text)
file_ext = File.extname(report)
append_str = File.basename(report, '.*')
new_file_name = "#{directory}/reports/#{measure_class_name}_#{append_str}#{file_ext}"
Expand Down

0 comments on commit 33d010e

Please sign in to comment.