I have 92 days of meteorological data with 4 samples per day, thus I should have 368 time steps. However, I currently only have 364 steps because one of the days in the middle of the sample is missing. The data is going to be used to condition another model so I need to have some kind of slightly reasonable data in the gap rather than NaN or 'O'.
The code that I'm trying to use is below, with the intention of creating a new array called 'PRECIP' extracting all of the data that I already have in 'PRECIP_CS' and inserting it into the correct place in the new array. The missing data should fit between step 156 and 157.
PRECIP = zeros(46,28,368);for t=1:156PRECIP(:,:,t) = PRECIP_CS(:,:,t);endfor t=161:368PRECIP(:,:,t) = PRECIP_CS(:,:,t-4);endt1=156;t2=161;for t=1:6;for t3=t1:t2;xt = t1:1:t2;int1(:,:,t) = interp1(PRECIP_CS(:,:,t3),xt);endend
Currently the interpolant creates a new array that is 6x28x157 rather than 46x28x6 that I was hoping for. In addition the new array consists of NaN for the first 6 time steps and 0 for the rest. I know I must be doing something relatively simple wrong, I just can't work out what. Any assistance would be very welcome!
Best Answer