-
Notifications
You must be signed in to change notification settings - Fork 75
Description
Current behavior
If output_root
is specified in a realization config and points to an existing file or a non-existent directory, NextGen does not write output.
For history sake, this feature was introduce in #531.
Expected behavior
I think this is up for debate. There is an argument for NextGen
attempting to create the output directory if it does not exist, but I can also see the other side. In either case, if output_root
points to a file an exception should be raised. Likewise, if the expected behavior is that NextGen
attempts to create the directory but cannot for whatever reason, an exception should be raised. It is desirable that NextGen
performs these checks before entering the simulation loop.
Steps to replicate behavior
Modified example realization config
realization config
{
"global": {
"formulations": [
{
"name": "bmi_c++",
"params": {
"model_type_name": "test_bmi_cpp",
"library_file": "./extern/test_bmi_cpp/cmake_build/libtestbmicppmodel",
"init_config": "./data/bmi/c/test/test_bmi_c_config.ini",
"main_output_variable": "OUTPUT_VAR_2",
"variables_names_map" : {
"INPUT_VAR_2": "TMP_2maboveground",
"INPUT_VAR_1": "precip_rate"
},
"uses_forcing_file": false
}
}
],
"forcing": {
"file_pattern": ".*{{id}}.*.csv",
"path": "./data/forcing/"
}
},
"time": {
"start_time": "2015-12-01 00:00:00",
"end_time": "2015-12-30 23:00:00",
"output_interval": 3600
},
"output_root": "./output/"
}
Cases:
-
output_root
does not exist:test ! -e output && \ cmake_build/ngen data/catchment_data.geojson all data/nexus_data.geojson all above_realization_config.json && \ test ! -e output
-
output_root
is a file:test ! -d output && \ touch output && \ test -f output && \ cmake_build/ngen data/catchment_data.geojson all data/nexus_data.geojson all above_realization_config.json && \ test ! -d output