MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / initializeWeatherFileFromOSW

Method initializeWeatherFileFromOSW

src/workflow/OSWorkflow.cpp:107–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107void OSWorkflow::initializeWeatherFileFromOSW() {
108 LOG(Debug, "Initialize the weather file from osw");
109 auto epwPath_ = workflowJSON.weatherFile();
110
111 if (epwPath_) {
112 LOG(Debug, "Search for weather file defined by osw " << epwPath_.get());
113 auto epwFullPath_ = workflowJSON.findFile(epwPath_.get());
114 if (!epwFullPath_) {
115 auto epwFullPath_ = workflowJSON.findFile(epwPath_->filename());
116 }
117 if (!epwFullPath_) {
118 throw std::runtime_error(fmt::format("Weather file {} specified but cannot be found", epwPath_->string()));
119 }
120
121 epwPath = epwFullPath_.get();
122
123 if (auto epwFile_ = openstudio::EpwFile::load(epwPath)) {
124 model::WeatherFile::setWeatherFile(model, epwFile_.get());
125 runner.setLastEpwFilePath(epwPath);
126 } else {
127 LOG(Warn, "Could not load weather file from " << epwPath_.get());
128 }
129 } else {
130 LOG(Debug, "No weather file specified in OSW, looking in model");
131 updateLastWeatherFileFromModel();
132 if (epwPath.empty()) {
133 LOG(Warn, "No valid weather file defined in either the osm or osw.");
134 }
135 }
136}
137
138void OSWorkflow::updateLastWeatherFileFromModel() {
139 LOG(Debug, "Find model's weather file and update LastEpwFilePath");

Callers

nothing calls this directly

Calls 7

findFileMethod · 0.80
filenameMethod · 0.80
setLastEpwFilePathMethod · 0.80
weatherFileMethod · 0.45
getMethod · 0.45
stringMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected