Faster way to interpolate 3D-gridded data?
3 views (last 30 days)
Show older comments
Hi. I have a 3D-grid of temperatures with a 1 hour resolution. The matrix is formed as follows:
T(time,longitude,latitude)
Where
T(i,:,:) = nan(1,longitude,latidude)
if i corresponds to a time value that is between full hours. basically T(1,:,:) has values, the following 3 T(i,:,:) are filled with NaNs, T(4,:,:) has values again, etc.
I would like to linearly interpolate the data to have a 15-minute resolution. What I have done is:
%t1h = timestamp according to T (as a datenum)
%t15m = timestamp 4 times the length of t1h ranging from t1h(1) to t1h(end)
tf = ismember(t15m,t1h);
T(~tf,:,:) = interp1(find(tf),T(tf,:,:),find(~tf));
This seems to work, but it takes forever. I have found the functions "interp3" and "griddedInterpolant" in the documentation, but I can't seem to be able to figure out how to get them to do what the above method does.
Does anyone have an idea? Also, would it be any faster?
Thanks in advance! - Marc
0 Comments
Answers (0)
See Also
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!