Quiver plot for Wind data of reanalysis
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Marzuki Marzuki
le 8 Nov 2021
Modifié(e) : Cris LaPierre
le 12 Nov 2021
I plan to use Matlab to plot wind of reanalysis that I downloaded from this website: https://psl.noaa.gov/data/gridded/data.ncep.reanalysis2.pressure.html
However, the result is not as expected. I send the sample of data in this posting.
I hope the result is like the image below (run by other software).

I use the following Matlab script:
lon1=load('lon.txt');
lat1=load('lat.txt');
u=load('u.txt');
v=load('v.txt');
coast=load('world_coastline.txt');
lon1q=repmat(lon1',73,1);
lat1q=repmat(lat1,1,144);
quiver(lon1q, lat1q,u',v',1,'k','LineWidth',1)
hold on
plot(coast(:,1), coast(:,2),'k','LineWidth',1.0)
xlim([90 110]);
ylim([-8 8]);
hold off
set(gca,'TickDir','out','FontName','Times New Roman','LineWidth',1);
Hoewever, the result is strange, as given below:

I tried several combinations, and found the quiver below to give somewhat similar results (still different).
quiver(lon1q, flipud(lat1q),flipud(u'),(v')*-1,1,'k','LineWidth',1)
Result

Perhaps some of you have used quiver plots for data reanalysis, and please share your experiences. Thank you very much.
0 commentaires
Réponse acceptée
Cris LaPierre
le 11 Nov 2021
Modifié(e) : Cris LaPierre
le 11 Nov 2021
Part of the issue is a mismatch between your coastline data and your quiver data. If you zoom all the way out, you will see what I mean.
load windData
[lat1q,lon1q]=meshgrid(lat1,lon1);
quiver(lon1q, lat1q,u,v,1,'k','LineWidth',1)
hold on
plot(coast(:,1), coast(:,2),'k','LineWidth',1.0)
hold off
set(gca,'TickDir','out','FontName','Times New Roman','LineWidth',1);
figure
quiver(wrapTo180(lon1q), lat1q,u,v,1,'k','LineWidth',1)
hold on
plot(coast(:,1), coast(:,2),'k','LineWidth',1.0)
hold off
set(gca,'TickDir','out','FontName','Times New Roman','LineWidth',1);
If you have the Mapping Toolbox, you could do the following. To me, the coastlines look a little better.
figure
axesm('eqdcylin')%,"MapLonLimit",[90 110],"MapLatLimit",[-8 8]);
plotm(coast(:,2), coast(:,1),'k','LineWidth',1.0)
[Lon,Lat] = meshgrid(lon1,lat1);
quiverm(Lat,Lon,u',v')
I'm not sure I like the idea of arbitrarily flipping matrices to try to get an expected output. Do you have any information on how the other software processes the data? Are you sure you are using the same data in both places?
4 commentaires
Cris LaPierre
le 12 Nov 2021
Modifié(e) : Cris LaPierre
le 12 Nov 2021
No, your code returns the same result as mine. I checked using isequal. However, your code is assigning the variable v to what should be u (comes from uwnd, not vwnd).
That gave me the insight to figure out what was happening. When I check your u and v matrices, they are the same. You accidentally loaded the uwnd data for both the u and v components. That means the original quiver command was
quiver(lon1q, lat1q,u',u',1,'k','LineWidth',1)
% ^^
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Vector Fields dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



