You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from pytplot import store_data
tp_data={'x':[1,2,3], 'y':[4,5,6]}
store_data('foo',data=tp_data)
store_data('bar',data=tp_data)
the second store_data() call fails because the previous call modified tp_data:
File "/Users/jwl/PycharmProjects/pyspedas/pyspedas/utilities/tests/tplot_wildcard_tests.py", line 37, in test_tindex_byname
store_data('bar',data=tp_data)
File "/Users/jwl/PycharmProjects/PyTplot/pytplot/store_data.py", line 140, in store_data
values = np.array(data.pop('y'))
KeyError: 'y'
The default should probably be to make a deep copy of the input structure before modifying anything. But for performance reasons (time and memory consumption), it might be good to add a "no_copy" option that defaults to False, allowing store_data to skip the copy for the sake of efficiency. I think most usages could probably use no_copy safely....but still, we should default to safety rather than efficiency.
With this code:
the second store_data() call fails because the previous call modified tp_data:
See also: #654
The text was updated successfully, but these errors were encountered: