Skip to content

Commit

Permalink
Also added cache fix to diagnostics function
Browse files Browse the repository at this point in the history
  • Loading branch information
modelonrobinandersson committed Nov 5, 2024
1 parent 3f42f5f commit b0fafe8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/common/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit b0fafe8

Please sign in to comment.