Closed pauwiersma closed 8 months ago
Good spot! The docstring of that function is outdated. We decided to no longer support the None argument in the setup_gauges method. If you don't want to add gauges to your model, we thought it is better to just remove the [setup_gauges]
block from the ini file. We will update the docstring of this function to reflect this new behavior. Thanks for spotting this issue!
According to the documentation the default value of gauges_fn is None (line 1079), but
os.path.isfile()
throws an error if it is fed with a None (line 1119):2023-08-18 13:54:01,154 - build - model_api - INFO - setup_gauges.gauges_fn: None 2023-08-18 13:54:01,154 - build - model_api - INFO - setup_gauges.index_col: None 2023-08-18 13:54:01,154 - build - model_api - INFO - setup_gauges.snap_to_river: False 2023-08-18 13:54:01,154 - build - model_api - INFO - setup_gauges.mask: None 2023-08-18 13:54:01,154 - build - model_api - INFO - setup_gauges.snap_uparea: False 2023-08-18 13:54:01,154 - build - model_api - INFO - setup_gauges.max_dist: 10000.0 2023-08-18 13:54:01,154 - build - model_api - INFO - setup_gauges.wdw: 3 2023-08-18 13:54:01,154 - build - model_api - INFO - setup_gauges.rel_error: 0.05 2023-08-18 13:54:01,154 - build - model_api - INFO - setup_gauges.derive_subcatch: False 2023-08-18 13:54:01,154 - build - model_api - INFO - setup_gauges.basename: None 2023-08-18 13:54:01,154 - build - model_api - INFO - setup_gauges.toml_output: csv 2023-08-18 13:54:01,154 - build - model_api - INFO - setup_gauges.gauge_toml_header: ['Q', 'P'] 2023-08-18 13:54:01,154 - build - model_api - INFO - setup_gauges.gauge_toml_param: ['lateral.river.q_av', 'vertical.precipitation'] 2023-08-18 13:54:01,154 - build - main - ERROR - stat: path should be string, bytes, os.PathLike or integer, not NoneType Traceback (most recent call last): File "/home/pwiersma/miniconda3/envs/hydromt-wflow/lib/python3.10/site-packages/hydromt/cli/main.py", line 207, in build mod.build(region, opt=opt) File "/home/pwiersma/miniconda3/envs/hydromt-wflow/lib/python3.10/site-packages/hydromt/models/model_api.py", line 220, in build self._run_log_method(method, *kwargs) File "/home/pwiersma/miniconda3/envs/hydromt-wflow/lib/python3.10/site-packages/hydromt/models/model_api.py", line 163, in _run_log_method return func(args, **kwargs) File "/home/pwiersma/miniconda3/envs/hydromt-wflow/lib/python3.10/site-packages/hydromt_wflow/wflow.py", line 1119, in setup_gauges elif isfile(gauges_fn): File "/home/pwiersma/miniconda3/envs/hydromt-wflow/lib/python3.10/genericpath.py", line 30, in isfile st = os.stat(path) TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType