Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure forcing path when file_pattern configured. #678

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions include/realizations/catchment/Formulation_Manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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 += "/";
Expand Down
Loading