I have three fields of dimension (4×4) at three different times:
varT1 = np.array([[1,6,2,5],[9,4,2,1], [8,2,9,5], [9,3,2,1]])
varT2 = np.array([[9,4,1,6],[9,8,6,9], [8,4,1,1], [7,2,4,4]])
varT3 = np.array([[1,3,4,9],[8,7,7,4], [7,3,1,3], [3,7,0,6]])
Is it possible to calculate the temporal derivative using np.gradient
?
1
I would stack the three fields along a new axis that we can consider as the time and then use np.gradient
to calculate along that axes
var_stack = np.stack([varT1, varT2, varT3], axis=0)
temporal_derivative = np.gradient(var_stack, axis=0)