How to plot vectors of zonally averaged meridional-vertical wind circulation in a latitude-pressure cross-section in MATLAB

3 vues (au cours des 30 derniers jours)
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.

Réponse acceptée

Nipun
Nipun le 13 Juin 2024
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
  2 commentaires
ANKAN SARKAR
ANKAN SARKAR le 17 Juin 2024
Hi Nipun,
Thank you so much for your guidance. However, I tried your code, but still the vectors are quite absurd and very large (Though it looks relatively better than before). I am attaching the full MATLAB code and the figure. Please see these attachments and guide me to solve this issue.
Thanks and regards,
Ankan
load('latitude.mat')
load('plev.mat')
load('Vwind.mat')
load('Wwind.mat')
%%
[X_LAT, Y_PLEV] = meshgrid(latitude, min(plev):10:max(plev));
% V_interp = griddata(latitude, plev, V', X_LAT, Y_PLEV);
% W_interp = griddata(latitude, plev, W, X_LAT, Y_PLEV);
%If you load the previous attachemnts of mat files, you will see that my
%'V' and 'W' are same as your 'V_interp' and 'W_interp' respectively, as I
%also followed the same method
% Plot the background data (e.g., W component)
contourf(X_LAT, Y_PLEV, W, 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 * 100;
% Plot the wind vectors using quiversc
q1 = quiversc(X_LAT, Y_PLEV, V, 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);
ANKAN SARKAR
ANKAN SARKAR le 17 Juin 2024
If in my last comment, the figure is not visible, then please find the attachment here.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Geographic Plots dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by