So I am looking at a day's worth of data. I am trying to remove the hour 12:00 to 13:00 from the data set, and then interpolate over that hour given the rest of the data.
I am running into two problems:
The way I am removing the data is incorrect and I am not sure how to fix it. It deletes the data, but then shifts the data over again so there in not a gap. This is evident when I graph the data, and there is no gap.
I don't know if I need to use
interpolate.interp1dorinterpolate.splev.
This is not the exact data I am using, but it is a good example to show what I need to do and what I have tried.
import numpy as np
import matplotlib.pyplot as plt
from scipy import interpolate
from matplotlib import pylab
day_sec=np.arange(0,86400,1) #24 hours in seconds
ydata=np.exp(-day_sec/30) #random ydata for example
remove_seconds=np.arange(43200,46800,1) #12-13:00 in seconds
last=len(remove_seconds)-1
for i in range(len(day_sec)): #what I have tried to remove the data, but failed
if (day_sec[i] >= remove_seconds[0]) and (day_sec[i] <= remove_seconds[last]):
new_day_sec=np.delete(day_sec,[i],None)
new_ydata=np.delete(ydata,[i],None)
f=interpolate.interp1d(new_day_sec,new_ydata) #not sure this is correct
Any help is appreciated. Thanks!
