0
votes

I don't know if this is possible, but I would like to be able to plot contour lines in a given latitude and longitude. I have an ocean model that gives me the currents in direction u and v at location x (longitude) and y(latitude). Using the quiver function (quiver(x,y,u,v)) and the following code, I managed to map the currents in the Gulf of Lions.

Step=8 %Only use 1 in 8 data point so the arrows don't overlap too much
figure
q=quiver(lonu(1:Step:681,1:Step:711),latu(1:Step:681,1:Step:711),U,V,0)

enter image description here As you can see, the model is more detailed close to the coast, because it uses the following grid:

enter image description here Source: Briton, Florence, et al. "High‐resolution modelling of ocean circulation can reveal retention spots important for biodiversity conservation." Aquatic Conservation: Marine and Freshwater Ecosystems 28.4 (2018): 882-893.

The problem with this is that when I try to use contour or contourf it completely loses the shape of the gulf of Lions due to the choice of grid:

figure
contourf(sqrt(U.^2+V.^2))%The vector of the current is X=sqrt(U^2+V^2) see pythagoras
colorbar

enter image description here So eventually, I would like to be able to indicate the strength of the current using contourf while indicating the direction using quiver. So how do I reshape the picture given by contourf into something realistic using coordinates? I checked question Matlab 2D contour using X-Y coordinate data but I don't understand how to use the proposed function.

1

1 Answers

2
votes

You suddenly decided to avoid imputing the data that gives the shape, X and Y input parameters.

contourf(lonu(1:Step:681,1:Step:711),latu(1:Step:681,1:Step:711),sqrt(U.^2+V.^2))%The vector of the current is X=sqrt(U^2+V^2) see pythagoras