From 81c40a7c1852e31b9ceae3932ffde88a9b06e20f Mon Sep 17 00:00:00 2001 From: Andrew Moodie Date: Wed, 16 Mar 2022 13:04:29 -0500 Subject: [PATCH 1/3] add two more after hooks, after setup domain and after finalize_timestep. --- pyDeltaRCM/hook_tools.py | 22 ++++++++++++++++++++++ pyDeltaRCM/model.py | 2 ++ 2 files changed, 24 insertions(+) diff --git a/pyDeltaRCM/hook_tools.py b/pyDeltaRCM/hook_tools.py index 43cf0827..f253e6db 100644 --- a/pyDeltaRCM/hook_tools.py +++ b/pyDeltaRCM/hook_tools.py @@ -247,6 +247,15 @@ def hook_init_output_file(self): """ pass + def hook_after_create_domain(self): + """Hook called *after* :obj:`~pyDeltaRCM.init_tools.init_tools.create_domain`. + + Unlike the standard model hooks, this hook is called *after* the + domain has been created with the + method :obj:`~pyDeltaRCM.init_tools.init_tools.create_domain` + """ + pass + def hook_after_route_water(self): """Hook called *after* :obj:`~pyDeltaRCM.water_tools.water_tools.route_water`. @@ -264,3 +273,16 @@ def hook_after_route_sediment(self): method :obj:`~pyDeltaRCM.sed_tools.sed_tools.route_sediment` """ pass + + def hook_after_finalize_timestep(self): + """Hook called *after* :obj:`~pyDeltaRCM.iteration_tools.finalize_timestep`. + + Unlike the standard model hooks, this hook is called *after* the + finalize timestep method has completed. + + .. hint:: + + This is the last method called before logging and outputting data + for each timestep. + """ + pass \ No newline at end of file diff --git a/pyDeltaRCM/model.py b/pyDeltaRCM/model.py index 62c674d6..ab3b39c7 100644 --- a/pyDeltaRCM/model.py +++ b/pyDeltaRCM/model.py @@ -113,6 +113,7 @@ def __init__(self, input_file=None, defer_output=False, **kwargs): # create the model domain based on configuration self.hook_create_domain() self.create_domain() + self.hook_after_create_domain() # initialize the sediment router classes self.init_sediment_routers() @@ -194,6 +195,7 @@ def update(self): self.hook_finalize_timestep() self.finalize_timestep() + self.hook_after_finalize_timestep() # update time-tracking fields self._time += self.dt From 64b4504f954fa9a1bf712bfd96a6a7c1cd43b887 Mon Sep 17 00:00:00 2001 From: Andrew Moodie Date: Wed, 16 Mar 2022 13:05:05 -0500 Subject: [PATCH 2/3] increment version to support two new hooks. --- pyDeltaRCM/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyDeltaRCM/_version.py b/pyDeltaRCM/_version.py index 1de6099a..b368a9d3 100644 --- a/pyDeltaRCM/_version.py +++ b/pyDeltaRCM/_version.py @@ -4,4 +4,4 @@ def __version__(): Private version declaration, gets assigned to pyDeltaRCM.__version__ during import """ - return '2.1.2' + return '2.1.3' From d9b33ccb7e4fcd06c19a85693982edbdb6510bc2 Mon Sep 17 00:00:00 2001 From: Andrew Moodie Date: Wed, 16 Mar 2022 13:24:11 -0500 Subject: [PATCH 3/3] style fix --- pyDeltaRCM/hook_tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyDeltaRCM/hook_tools.py b/pyDeltaRCM/hook_tools.py index f253e6db..e26c0e0a 100644 --- a/pyDeltaRCM/hook_tools.py +++ b/pyDeltaRCM/hook_tools.py @@ -285,4 +285,4 @@ def hook_after_finalize_timestep(self): This is the last method called before logging and outputting data for each timestep. """ - pass \ No newline at end of file + pass