Problem longitude and latitude contour in a surface plot

Hi all,
I try to overlay the contour of the coastline of the Strait of Gibraltar into my surface plot of my datas. The bathymetry that I use is from ETOPO, and it´s the one that the has been used for the hidrodynamic model that I use. I reshape the matriz with imresize so both datas has the same dimension and the I plot it.
My problem is when I plot the supossed contour of the coast because it does't match with the end of my data.
Do you know if there is a solution for this??
Thank you in advance.

4 commentaires

Please explain more. It's not clear what is wrong. What is wrong? Can you show? How the result should look like?
Yes, sorry:
The thick blue line sould be in the contour between the datas and the white part.I attach here a plot of how the contour should look like.
I already find where is the problem but I don't know how to solve it.
The size of the datas of the bathymetry (the values=0 are the contour) is 55x87 whre:
bat_lon= 87x1
bat_lat=55x1
bat_altitude=44x87
And the datas that I have plot are in a curvilinear grid of size 40x144.
I change the dimension of the bat_altitude with imresize as bat_final= imresize(bat_altitude, [40,144]), and with this, the coordanates has change (because of that the conour that should appear at the start of the white part, they appear in the middle of the map).
How can I change the matriz dimension of the batimetry without changing the coordenates?
Than you really much.
The size of the datas of the bathymetry (the values=0 are the contour) is 55x87 whre:
bat_lon= 87x1
bat_lat=55x1
bat_altitude=44x87
Try to interpolate bat_lat variable
bat_lat1 = interp1(1:55,bat_lat,linspace(1,55,44));
Thank you!
But this didn,t work, because the batimetry that holds the values is bat_altitude.
I think I should interpolate that variable with interp2 so I obtain a matrix 40x144.
I tried this but I get an error, maybe you can help with the code.
bat_altitude1=interp2(1:87,1:55,bat_altitude,linspace(1,87,40),linspace(1,55,144));
Thank you again

Connectez-vous pour commenter.

Réponses (1)

Sure, use meshgrid
[m,n] = size(bat_latitude);
xx = linspace(1,n,40);
yy = linspace(1,m,144);
[x1,y1] = meshgrid(xx,yy);
[x,y] = meshgrid(1:n,1:m);
bat_altitude1 = interp2(x,y,bat_altitude,x1,y1);

6 commentaires

Thank you again,
But this didn't solve the problem. The contour appear in the same way that the first picture that I attach.
Maybe I have to plot the batymetry with his own lon, lat reference instead of the lon lat reference of the dtas of velocity?
Can you attach the data?
I can' attach them because altough I have compressed them, they are too big.
I'm pretty new here, do you know how can I send them to you?
How big they are? What about google drive? Can you attach only part of it?
Here ir the link to google drive:
I plot the velocity as:
figure
peak_vel_atl=pcolor(lon,lat,peak_mod_atl);colormap jet; colorbar,caxis([0 5])
peak_vel_atl,EdgeAlpha=0,caxis
shading interp
Thank you
Whoa, 200mb, that is too much
Can't you overlay your contour using existing coordinates?
Example
[X,Y] = deal(zeros(20));
t = linspace(-1,1,20)*pi/4; % define angle fo arc part
[x,y] = pol2cart(t,2); % get cartesian arc coordinates
for i = 1:20
X(:,i) = linspace(x(i),5,20);
Y(:,i) = linspace(y(i),tan(t(i))*5,20);
end
Z = X*0; % Z = 0 (flat)
pcolor(X,Y,Z)
line(X(:,[1 end]),Y(:,[1 end]),'linew',2,'color','b')
line(X([1 end],:)',Y([1 end],:)','linew',2,'color','b')
axis equal

Connectez-vous pour commenter.

Commenté :

le 30 Mai 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by