From c3285f8b9d8e08a9f832c04bbb8061bc66576f4c Mon Sep 17 00:00:00 2001 From: Dirk Eilander Date: Thu, 13 Apr 2023 17:07:30 +0200 Subject: [PATCH] run method without arguments --- hydromt/models/model_api.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hydromt/models/model_api.py b/hydromt/models/model_api.py index f50d8332f..170dd4e68 100644 --- a/hydromt/models/model_api.py +++ b/hydromt/models/model_api.py @@ -199,12 +199,14 @@ def build( if self._CLI_ARGS["region"] not in opt: opt = {self._CLI_ARGS["region"]: {}, **opt} opt[self._CLI_ARGS["region"]].update(region=region) + # then loop over other methods for method in opt: # if any write_* functions are present in opt, skip the final self.write() call if method.startswith("write_"): write = False - self._run_log_method(method, **opt[method]) + kwargs = {} if opt[method] is None else opt[method] + self._run_log_method(method, **kwargs) # write if write: @@ -275,7 +277,8 @@ def update( # if any write_* functions are present in opt, skip the final self.write() call if method.startswith("write_"): write = False - self._run_log_method(method, **opt[method]) + kwargs = {} if opt[method] is None else opt[method] + self._run_log_method(method, **kwargs) # write if write: