I have two 1D arrays, one for measured data and one for location. For example, the measured data may be temperature, and the other may be the height of measurement:
temp = np.asarray([10, 9.6, 9.3, ..., -20.3, -21.0])
As you can see, the measurement height is not at a regular distance.
I want to calculate the average temperature at regular intervals with intervals. This is some moving average, but the window size is variable, because the data points inside the interval of interest are not always the same.
This can be done using the for loop as follows:
regular_heights = np.arange(0, 6000, 100)
I really dislike this approach, and I was wondering if there would be a more “numeric” solution.
source share