Re: draw simple vector field

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon Mar 18 2013 - 11:22:20 MDT

As indicated in the documentation, you need the wind components (u, v)
to draw the arrows. NCL calculates the direction internally.

It would be surprising if u,v are not on the source file. However, if
you have the speed (wspd) and direction (wdir) only, you can
extract the wind components manually:

       rad = 0.01745329
       u = -wspd*sin(wdir*rad)
       v = -wspd*cos(wdir*rad)

Also, if you have 6.1.0 or higher there is a functon:
http://www.ncl.ucar.edu/Document/Functions/Contributed/wind_component.shtml

Good luck
On 3/14/13 2:30 AM, Yann Bertrand wrote:
>
>
>
> Hi,
> i try to draw a vector field :
> but i don't know how to get u and v (2-dimension)
> and the direction (which is the main information i want to get.
> Here's a piece of code.
> Thanks in advance.
>
> ncl_filedump gives :
>
> float DIR ( lv_OSEQD0, lat_0, lon_0 )
> center :US National Weather Service - NCEP (WMC)
> production_status :Operational products
> units :Degree True
>
> _FillValue :1e+20
> grid_type :Latitude/longitude
> parameter_template_discipline_category_number :( 0, 10, 0, 7 )
>
> level_type :Ordered Sequence of Data
> forecast_time :96
> forecast_time_units :hours
>
>
> what i've tried :
>
> outfile="out"
> grib_file="grib.grib2"
> fin = addfile(grib_file,"r")
>
> ; get variable:
>
> dir3d = fin->DIR
>
> dir = dir3d(0,:,:)
>
> wks = gsn_open_wks("ps",outfile) ; open wk station
>
>
> res = True
>
>
> res@vcGlyphStyle = "LineArrow"
>
>
> res@mpLimitMode="latlon"
> res@mpMinLonF = -33
>
> res@mpMaxLonF = 2
> res@mpMinLatF = 21
> res@mpMaxLatF = 37
>
> res@mpProjection = "LambertConformal"
>
>
> plot = gsn_csm_vector_scalar(wks, dir(:,:), dir(:,:), dir3d(:,0,0), res)
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Mar 18 11:22:25 2013

This archive was generated by hypermail 2.1.8 : Tue Mar 19 2013 - 16:31:18 MDT