How to plot a quiver plot on top a Geographic Map

34 ビュー (過去 30 日間)
George
George 2015 年 10 月 14 日
回答済み: Shai Katz 2022 年 4 月 22 日
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

回答 (2 件)

Chad Greene
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.
  1 件のコメント
George
George 2015 年 10 月 28 日
Hello, thanks for the reply
I also found that quiverm is a bit off, also from some discussion in the forum I found as well quivermc as well And have adapted it into my script my problem though even there is the same. Prior to the usage of quivermc I am using
R = georasterref('RasterSize', size(W10),'Latlim', latlim, 'Lonlim', lonlim);
hold
h=quivermc(lat,lon,U10,V10);
To create a contour of a quantity and then super-impose the quivermc over it, but when this process takes place I lose the first plot.
You are correct when you say I use a netCDF as a source, that is why I also have amde sure that the lat, lim are converted into double always
Any ideas on how to have the contour and quivermc together without having one dissapear?

サインインしてコメントする。


Shai Katz
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.

Community Treasure Hunt

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

Start Hunting!

Translated by