From b0fafe8fa46223605ce59283c1c73fa7d74bec3e Mon Sep 17 00:00:00 2001 From: Robin Andersson Date: Tue, 5 Nov 2024 09:17:08 -0500 Subject: [PATCH] Also added cache fix to diagnostics function --- src/common/io.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/common/io.py b/src/common/io.py index 66e557ea..4543df9a 100644 --- a/src/common/io.py +++ b/src/common/io.py @@ -1373,7 +1373,9 @@ def _get_diagnostics_trajectory(self, data_index, start_index = 0, stop_index = """ Returns trajectory for the diagnostics variable that corresponds to index 'data_index'. """ self._verify_file_data() - if data_index in self._data_3: + index_in_cache = data_index in self._data_3 + partial_cache_ok = self._can_use_partial_cache(start_index, stop_index) + if (index_in_cache and not self._allow_file_updates) or (index_in_cache and partial_cache_ok): return self._data_3[data_index] self._data_3[data_index] = self._read_trajectory_data(data_index, True, start_index, stop_index) return self._data_3[data_index][start_index:stop_index]