From f9f7c4d3625d591b652a6ea947371975e9af7fc0 Mon Sep 17 00:00:00 2001 From: Adam Cheng <52572642+adamchengtkc@users.noreply.github.com> Date: Tue, 20 Aug 2024 12:38:40 +0000 Subject: [PATCH] skip output computation for sed only nodes --- warmth/postprocessing.py | 9 +++++---- warmth/simulator.py | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/warmth/postprocessing.py b/warmth/postprocessing.py index fd80d09..b067ff2 100644 --- a/warmth/postprocessing.py +++ b/warmth/postprocessing.py @@ -431,10 +431,11 @@ def cum_reacted(A, E, weights, time, temp_k): DI = np.zeros([nt, nw]) # When computing the deltas, drop index 0, start at index 1 - for i in range(1, time.size): - for j in range(0, weights.size): - DI[i, j] = DI[i - 1, j] + (I[i, j] - I[i - 1, j]) / heat_rate[i] - CR_easy[i] += weights[j] * (1 - np.exp(-DI[i, j])) + with np.errstate(divide='ignore',invalid='ignore'): + for i in range(1, time.size): + for j in range(0, weights.size): + DI[i, j] = DI[i - 1, j] + (I[i, j] - I[i - 1, j]) / heat_rate[i] + CR_easy[i] += weights[j] * (1 - np.exp(-DI[i, j])) return CR_easy diff --git a/warmth/simulator.py b/warmth/simulator.py index 6be4565..d3678d6 100644 --- a/warmth/simulator.py +++ b/warmth/simulator.py @@ -48,13 +48,13 @@ def run(self) -> Path: fw = Forward_model(self.parameters, self.node) if self.node._full_simulation: fw.simulate_single_node() + self.node.max_time = self.node._depth_out.shape[1] + self.node.compute_derived_arrays() else: fw._sedimentation() self.node = fw.current_node self._pad_sediments() self.node.simulated_at = time.time() - self.node.max_time = self.node._depth_out.shape[1] - self.node.compute_derived_arrays() self.node.node_path = self.node_path filepath = self._save_results() # Delete input node