
How could I plot wind barbs using wind data from netCDF files of ECMWF?

steeve88
I 've seen the wind barb code in the IGOR manual. I tried to use it, but probably I can't apply it on my dataset. My dataset comes from ECMWF and it is in netCDF form.
Here, I have the two codes that I've written. Firstly, I use Function WindDir(u_1,v_1) using the waves of the attached file (so it is WindDir(nc_u10,nc_v10)) and then I run Function Barb_Plot().
The first code is to convert u and v components into speed and direction of the wind. The second is for plotting barbs.
Function WindDir(u_1,v_1) wave u_1, v_1 Duplicate/o u_1, u_1_easterly Duplicate/o v_1, v_1_northerly u_1_easterly*=-1 v_1_northerly*=-1 Duplicate/O u_1_easterly, w_dir, w_spd //w_dir= direction the wind is coming from w_dir=mod(atan2(u_1_easterly,v_1_northerly)/pi*180+360,360) w_spd=sqrt( (v_1_northerly*v_1_northerly)+(u_1_easterly*u_1_easterly)) end //---------------------------------------------------------------------------------------------------------- Function Barb_Plot() // Make XY data wave w_spd, w_dir, nc_longitude, nc_latitude variable rows, columns,i Display nc_latitude vs nc_longitude // Make graph ModifyGraph mode(nc_latitude) = 3 // Marker mode rows=dimsize(w_spd,0) columns=dimsize(w_spd,1) Make/O/N=(rows,3) barbData // Controls barb length, angle and number of barbs //Edit /W=(439,47,820,240) barbData For (i=0;i<rows;i+=1) barbData[i][0] = 40 barbData[i][1] = w_dir[i] * pi/180 barbData[i][2] = (w_spd[i]/100*1.94) EndFor SetDimLabel 1, 2, WindBarb, barbData // Set column label to WindBarb RemoveFromGraph/Z barbData // Remove it if it is already on the graph AppendToGraph nc_latitude vs nc_longitude ModifyGraph mode=3,arrowMarker(nc_latitude)={barbData,1,10,1,1} ModifyGraph margin(top)=62,margin(right)=84 ModifyGraph rgb(nc_latitude)=(43690,43690,43690) End
Could anyone help please?
You have not told us what the problem is.
Also, this seems to be a question about wind barbs, not about netCDF, so posting a netCDF file is of little use.
I recommend that you create the absolute simplest possible self-contained Igor experiment that shows the problem, and post that along with a description of what you expect and what you get. This will allow people to consider the issue without spending a lot of time on setup and boiling it down.
September 24, 2015 at 02:43 pm - Permalink
Actually, I am trying to get a plot of wind barbs, for example wind barbs over Europe in a random level pressure.
Instead of that I take no barbs, but just markers on a line. So the main problem is that I take markers with a wrong distribution, as you can see in the attachment.
The problem is definetely in the Function Barb_Plot(), but I don't know where. Besides, if I try random values of wind and space I can get barbs, but I can't when I use netCDF files, that's why I mention netCDF files in the title.
I hope that I am a bit more understandable now.
Thank you,
Stavros
September 28, 2015 at 04:12 am - Permalink
October 2, 2015 at 01:28 am - Permalink
As HRodstein said...
This would really help people to help you.
October 2, 2015 at 04:32 am - Permalink
I finally solved this problem. If anyone wants to load netcdf files and plot wind barbs, he should put all the data in a 1-D wave. So for example, he should put all the wind values of a 2-D wave (e.g. for Europe) in a 1-D wave. In the same way, he should put longtide and latitude in 1-D waves, so IGOR to understand that the specific wind value is for specific latitude and longitude.
Stavros
December 3, 2015 at 04:39 am - Permalink
January 10, 2016 at 01:46 am - Permalink
for further information please run
January 14, 2016 at 02:48 pm - Permalink