Quiver plot for Wind data of reanalysis

17 visualizaciones (últimos 30 días)
Marzuki Marzuki
Marzuki Marzuki el 8 de Nov. de 2021
Editada: Cris LaPierre el 12 de Nov. de 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.

Respuesta aceptada

Cris LaPierre
Cris LaPierre el 11 de Nov. de 2021
Editada: Cris LaPierre el 11 de Nov. de 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);
Use wrapTo180 on the longitudinal data to fix that.
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 comentarios
Marzuki Marzuki
Marzuki Marzuki el 12 de Nov. de 2021
Thank you @Cris LaPierre . It is really helpfull. I've checked my data, the data is the same as yours, but the data processing process is slightly different, where I replaced missing_value with NaN, for example:
ncid1 = netcdf.open('uwnd.mon.mean.nc');
varid1 = netcdf.inqVarID(ncid1,'uwnd');
v_longway = netcdf.getVar(ncid1,varid1);
missing_value = netcdf.getAtt(ncid1,varid1,'missing_value');
v_longway(v_longway==missing_value)=NaN;
v=double(v_longway(:,:,1,1));
netcdf.close(ncid1);
does this affect the results?
But it solved, thank you again.
Cris LaPierre
Cris LaPierre el 12 de Nov. de 2021
Editada: Cris LaPierre el 12 de Nov. de 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)
% ^^

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Vector Fields en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by