Question with interp3
Show older comments
Hi all,
I got an error using interp3 as:
% Error using griddedInterpolant
% The grid vectors do not define a grid of points that match the given values.
My code is as:
addpath('nctoolbox-1.1.3');
load('matlab.mat')
setup_nctoolbox;
grib = ncgeodataset('2018_Jan.grib');
grib.variables;
grib.size('10_metre_U_wind_component_surface');
U_wind1 = grib.geovariable('10_metre_U_wind_component_surface');
grib.dimensions('10_metre_U_wind_component_surface');
size(U_wind1);
class(U_wind1);
U_wind = U_wind1.data(:, :, :);
U_wind = permute(U_wind,[2 3 1]);
U_wind = squeeze(double(U_wind));
U_wind = flipud(U_wind);
skip = length(U_wind)/2;
U_wind = circshift(U_wind,[0,skip]);
coords_latitude = -90:0.75:90;
coords_longitude = -180:0.75:179.25;
coords_lat = coords_latitude';
coords_lon = coords_longitude';
path_time_total_grib = path_time_total/6;
for i=1:size(path_lat_value,1)
for j=1:size(path_lat_value,2)
U_wind_route(i,j) = interp3(coords_lon,coords_lat,...
coords_time,U_wind,path_lon_value(i,j),path_lat_value(i,j),path_time_total_grib(i,j));
end
end
I also attach the path_lon_value, path_lat_value, path_time_total as matlab.mat and Grib file as this google drive link https://drive.google.com/open?id=1ifuEnEnSThdhsq6FHbUXDfy-DyhhB_Ba
Thank you for your help
Accepted Answer
More Answers (1)
meghannmarie
on 6 Jun 2019
1 vote
Your welcome!
Categories
Find more on String Parsing 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!