Skip to content

Commit

Permalink
Failsafe if we cannot store as npz revert to a pure pickle file.
Browse files Browse the repository at this point in the history
  • Loading branch information
KriFos1 committed Jan 1, 2024
1 parent 4996063 commit 6d00071
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pipt/misc_tools/analysis_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,11 @@ def save_analysisdebug(ind_save, **kwargs):
is passed to np.savez (kwargs) the variable will be stored with their original name.
"""
# Save input variables
np.savez('debug_analysis_step_{0}'.format(str(ind_save)), **kwargs)
try:
np.savez('debug_analysis_step_{0}'.format(str(ind_save)), **kwargs)
except: # if npz save fails dump to a pickle file
with open(f'debug_analysis_step_{ind_save}.p', 'wb') as file:
pickle.dump(kwargs, file)


def get_list_data_types(obs_data, assim_index):
Expand Down

0 comments on commit 6d00071

Please sign in to comment.