I am having a 3D field of an averaged quantity. Now I am looking for a pythonic way to revert the averaging to get instantaneous values for each time stamp. Note: The averaging is made from the beginning of the whole period. It is like rolling mean with the window size adapted to the index of the value to be averaged.
For better clarification I give an 1D example:
import numpy as np
input_array = np.array([
[0. ],
[0.5 ],
[1. ],
[1.5 ],
[2. ],
[2.5 ],
[3. ],
[3.25 ],
[3.333333],
[3.3 ],
[3.181818],
[3. ],
[2.769231]
])
exp_result = de_average(input_array)
The expected result exp_result should look like this:
exp_result= np.array([
[0],
[1],
[2],
[3],
[4],
[5],
[6],
[5],
[4],
[3],
[2],
[1],
[0]])