How to plot vectors of zonally averaged meridional-vertical wind circulation in a latitude-pressure cross-section in MATLAB
3 次查看(过去 30 天)
显示 更早的评论
Dear all,
I have 3D matrices (longitude*latitude*plev) of U, V and W-components of wind. Since I want to plot latitude-pressure vertical cross section, I took average along the first dimension (i.e, longitude) for V and W-components of wind. Also, initially I had the plev data with 12 pressure levels. But, I created 91 interpolated pressure levels using 'meshgrid' command and interpolated the V and W-components of wind data at each pressure levels using 'griddata' command, like in the following:
[X_LAT,Y_PLEV]=meshgrid(latitude,min(plev):10:max(plev));
V=griddata(latitude,plev,Vwind',X_LAT,Y_PLEV);
%same as for W wind
For your convenience, I attached the latitude, plev, V, and W matrices. But, when I tried to plot the wind vectors along latitude-pressure vertical cross-section using 'quiversc' function, I am getting absurd vectors (see the figure attached). But, previously, with the same 'quiversc' function, I got the correct wind vectors when I used U and V-components of wind at x-y plane for a particular pressure level. So, I think, there is nothing wrong with the function. Maybe the code should be different this time as I am plotting latitude-pressure vertical cross section. My code for plotting is as follows:
contourf(X_LAT,Y_PLEV,W,40,'linecolor','none') ;
set(gca,'YDir','reverse');
set(gca,'yscale','log')
hold on
q1=quiversc(X_LAT,Y_PLEV,V,W,'density',10,'MaxHeadSize',5,'AutoScale','on','color','k','LineWidth',1);
colormap(jet(50))
caxis([-2 2])
xlim([-7 1])
ylim([100 1000])
box on
set(gca,'YTick',(100:100:1000),'YTickLabel',{'100' '200' '300' '400' '500' '600' '700' '800' '900' '1000'},'FontName', 'Arial','FontSize',14,'FontWeight','bold','LineWidth',1)
Now, it is important to note that I multiplied W by 100 for scaling as per the V wind. Since, the vertical cross-section is along the latitudes, so I think quiversc should work with V and W to get the meridional-vertical wind circulation vector. Right? Or, do I have to do something additional to get the desired plot. For your reference, I attached a sample figure from Zhu et al. (2022). Can anyone please help me to solve this issue? That will be very helpful for me. Thank you for your time and consideration.
0 个评论
采纳的回答
Nipun
2024-6-13
Hi Ankan,
I understand that you are trying to plot a latitude-pressure vertical cross section using interpolated V and W components of wind and are encountering issues with the quiversc function. Here is how you can achieve this:
Step 1: Interpolating the Data
[X_LAT, Y_PLEV] = meshgrid(latitude, min(plev):10:max(plev));
V_interp = griddata(latitude, plev, Vwind', X_LAT, Y_PLEV);
W_interp = griddata(latitude, plev, Wwind', X_LAT, Y_PLEV);
For more information on meshgrid, refer to the following MathWorks documentation: https://www.mathworks.com/help/matlab/ref/meshgrid.html
For more information on griddata, refer to the following MathWorks documentation: https://www.mathworks.com/help/matlab/ref/griddata.html
Step 2: Plotting the Data
% Plot the background data (e.g., W component)
contourf(X_LAT, Y_PLEV, W_interp, 40, 'linecolor', 'none');
% Set the Y-axis to be reversed (pressure decreases with height)
set(gca, 'YDir', 'reverse');
set(gca, 'yscale', 'log'); % Log scale for the pressure axis
hold on;
% Scale W component for visualization
W_interp_scaled = W_interp * 100;
% Plot the wind vectors using quiversc
q1 = quiversc(X_LAT, Y_PLEV, V_interp, W_interp_scaled, 'density', 10, ...
'MaxHeadSize', 5, 'AutoScale', 'on', 'color', 'k', 'LineWidth', 1);
% Customize the colormap and color axis
colormap(jet(50));
caxis([-2 2]);
% Set the x and y axis limits
xlim([-7 1]);
ylim([100 1000]);
% Customize the box and ticks
box on;
set(gca, 'YTick', (100:100:1000), 'YTickLabel', {'100', '200', '300', '400', '500', '600', '700', '800', '900', '1000'}, ...
'FontName', 'Arial', 'FontSize', 14, 'FontWeight', 'bold', 'LineWidth', 1);
For more information on contourf, refer to the following MathWorks documentation: https://www.mathworks.com/help/matlab/ref/contourf.html
For more information on quiver, refer to the following MathWorks documentation: https://www.mathworks.com/help/matlab/ref/quiver.html
Hope this helps.
Regards,
Nipun
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Geographic Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!