How to plot a quiver plot on top a Geographic Map
26 次查看(过去 30 天)
显示 更早的评论
hello all
I have encountered a problem concerning the plotting of a quiver on top a Geographic map. The quantities I am using are U10, V10 and Wind (which has resulted by combining U10 and V10) The U10 ,V10 are two matrices MxN (exactly equal in size), thus the Wind has the same size The latitude, longitude coordinates are given in vectors which are properly loaded to create the first map layer, using coastline data from a high resolution database
% Input coordinates
latlim=[49 60];
lonlim=[-12 4];
axesm('MapProjection','miller','grid','off','frame','on','maplatlimit',...
latlim,'maplonlimit',lonlim,'mlinelocation',2,'plinelocation',2,...
'meridianlabel','on','parallellabel','on');
geoshow('GSHHS_l_L1.shp', 'FaceColor', [0.7 0.7 0.7]);
R = georasterref('RasterSize', size(W10),'Latlim', latlim, 'Lonlim', lonlim);
geoshow(W10, R, 'DisplayType', 'surface')
hold
contourm(W10, R)
quiverm(latlim,lonlim,U10,V10)
But I get this error
Error using QUIVERM
Expected input number 3, U, to be one of these types:
double, single
Instead its type was struct.
Error in quiverm (line 34)
validateattributes(u, {'double','single'}, {'2d'}, 'QUIVERM', 'U', 3)
and even when I convert the latlim,lonlim into doubles I still cannot get a quiver over the mapped contour
quiverm(double(latlim),double(lonlim),U10,V10)
Does anybody has ever plotted a quiver over a contoured map, and can share information on that?
Any advice is welcome
0 个评论
回答(2 个)
Chad Greene
2015-10-27
I see a few problems here.
1. quiverm does not want the limits of your axes, it wants one latitude location and one longitude location for each point in U10 and V10. So size(lat should equal size(lon) should equal size(U10) should equal size(V10).
2. I'm guessing you got U10 and V10 from a NetCDF or HDF file, and I'm guessing they're in some integer format. Convert them by U10 = double(U10) and V10 = double(V10)
3. quiverm is plagued with a few problems. First, it wants the orders of v and u to be switched. Second, it wants them to be scaled by latitude, which is absolutely absurd and useless for plotting fields such as wind. I recommend you download quivermc and use it instead of quiverm.
Shai Katz
2022-4-22
Hi everyone,
I have the same problem - I want to plot the wind field on a top of geographic map,and I understand we can't do it with quiver function, but only with quiverm. I tried to use the quivermc funtion as well, and I get an error that says:
Error using quivermc (line 145)
Input lat, lon, u, and v must be a grid.
Well, my 4 variables are vactors of 1X12, the are double type.
What are the option to plot this data on a geographic map?
Thanks.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!