Skip to content

Commit

Permalink
Ensure forcing path when file_pattern configured.
Browse files Browse the repository at this point in the history
Ensure configured forcing params include a 'path' value whenever a
'file_pattern' is present.
robertbartel committed Nov 17, 2023
1 parent 1dcd255 commit acdab4e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions include/realizations/catchment/Formulation_Manager.hpp
Original file line number Diff line number Diff line change
@@ -477,11 +477,11 @@ namespace realization {
}

forcing_params get_forcing_params(geojson::PropertyMap &forcing_prop_map, std::string identifier, simulation_time_params &simulation_time_config) {
std::string path = "";
std::string path;
if(forcing_prop_map.count("path") != 0){
path = forcing_prop_map.at("path").as_string();
}
std::string provider = "";
std::string provider;
if(forcing_prop_map.count("provider") != 0){
provider = forcing_prop_map.at("provider").as_string();
}
@@ -494,6 +494,11 @@ namespace realization {
);
}

if (path.empty()) {
throw std::runtime_error("Error with NGEN config - 'path' in forcing params must be set to a "
"non-empty parent directory path when 'file_pattern' is used.");
}

// Since we are given a pattern, we need to identify the directory and pull out anything that matches the pattern
if (path.compare(path.size() - 1, 1, "/") != 0) {
path += "/";

0 comments on commit acdab4e

Please sign in to comment.