NOAA-OWP / ngen

Next Generation Water Modeling Engine and Framework Prototype
Other
83 stars 62 forks source link

No output written if `output_root` is specified in realization config and does not exist or is a file #848

Closed aaraney closed 1 month ago

aaraney commented 2 months ago

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 ```json { "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:

stcui007 commented 1 month ago

The current code appears to default the output to the project directory if output_root directory does not exist. This can end up filling the project directory with over a million files in the case of CONUS if output_root directory does not present, which makes working in the project directory very difficult.

stcui007 commented 1 month ago

Closed via #855.