[ncl-talk] Problem with trajectory (solid lines) plotting.....

Adam Phillips asphilli at ucar.edu
Sat Aug 29 08:09:35 MDT 2015


Hi Qudsia,
I have run a test here using gsLineDashPattern and the resource worked as
it is documented, so I am not sure why you are not seeing the desired
results. What version of NCL are you running? Are all the polylines dashed?
Are you seeing any error messages?

To answer your question about trajectories: No, there is no automatic way
to curl the end of polylines. You can add additional X and Y points into
gsn_polyline to get the desired effect though.

Finally, as we always tell everyone, please do not write individuals who
respond to ncl-talk inquiries directly unless directed to do so. Most
people who respond to ncl-talk are volunteering their time to assist others
and are not paid to do so. If your inquiry to ncl-talk has not been
answered within a day or so during normal weekday hours you can always
repost your inquiry to ncl-talk.

Assuming you have not figured out the issue please respond to ncl-talk
answering the questions above and including your ascii file and output
graphic. That way ncl-talk subscribers can better assist in solving your
issue.
Adam



On Fri, Aug 28, 2015 at 12:08 AM, qudsia zafar <missquaddus at gmail.com>
wrote:

> Hi all,
>
> I am trying to plot trajectories of 'solid lines' but i get 'dotted lines'
> every time upon looping gsn_polyline function. The resource
> 'gsLineThicknessF = 1' works but 'gsLineDashPattern = 0 does not.  Moreover
> is there a predefined function available to 'curl' the trajectories
> arriving the source location? Below is what i am working at:
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
> begin
>
>
>  fname = "tdump_750_JF.txt"
>  ncols = numAsciiCol(fname)
> ; print(ncols)
>
>  data = readAsciiTable(fname,ncols,"float",0)
> ; print(data)
>
>
>  delim= " "
>
>
> ;printVarSummary(data)
>
>
>  fld = str_get_field(data, 1, delim)
>
> ;print(fld)
>
>
>   dims = dimsizes(fld)
>   ntime = dims(0)
>
>
>
>
>  wks = gsn_open_wks("x11","traj")               ; open workstation
>
>   gsn_define_colormap (wks,"GMT_haxby")            ;  (amwg256")
>   cmap = gsn_retrieve_colormap (wks)
>
>   ;print(cmap)
>
>
>
>
> cnlevels = fspan(0,8263.2,26)                       ;   make 26 levels
>
>
>    res            = True                          ; map resources
>    res at gsnDraw    = False                         ; don't draw
>    res at gsnFrame   = False                         ; don't advance frame
>    res at vpWidthF   = 0.80                          ; make map bigger
>    res at vpHeightF  = 0.80
>    res at mpFillOn                    = False        ; turn off gray fill
>   res at mpOutlineBoundarySets       = "National"   ; turn on country
> boundaries
>   res at mpGeophysicalLineColor      = "Navy"       ; color of cont. outlines
>   res at mpGeophysicalLineThicknessF = 1.5          ; thickness of outlines
>    res at mpMaxLatF  = 60                           ; select subregion
>    res at mpMinLatF  = -20
>    res at mpMinLonF  = 40
>    res at mpMaxLonF  = 90
>
>
>    res at mpGridSpacingF = 10.0
>
>
>   res_lb                    = True
>    res_lb at vpWidthF           = 0.60
>    res_lb at vpHeightF          = 0.10
>    res_lb at lbPerimOn          = True; False            ; Turn off
> perimeter.
>    res_lb at lbOrientation      = "Horizontal"     ; Default is vertical.
>    res_lb at lbLabelStride      = 2
>    res_lb at lbLabelAlignment   = "InteriorEdges"  ; Default is "BoxCenters".
>    res_lb at lbFillColors       = cmap;rgb_array; cmap(1:,:)       ; Colors
> for boxes.
>    res_lb at cnLevels           = fspan(0,8263.2,26)
>    res_lb at lbMonoFillPattern  = True             ; Fill them all solid.
>    res_lb at lbLabelFontHeightF = 0.015
>
>
>    map = gsn_csm_map_ce(wks,res)                         ; create map
>   draw(map)
>
>
> ;*********************************************
> ; trajectory parameters
> ;*********************************************
>
> arr2=(/0,483,899,1352,1825,2309,2778,3262,3702,4186,4619,5030,5469,5890,6308,6770,7190,7615,8029,8492,8945,9429,9896,10380,10709,11009,11275/)
>    ; 5-d trajectories for 26 days. every element defines the end of each
> day...
>
>
>  aod = new(26,float)
>  aod = 0.0
>
>   do i = 0, 25
>
>  aod(i) = data(arr2(i),11)
>
>  end do
>
> print(aod)
>
>
>   ; traj = (/1,10,53,67,80/)          ; choose which trajectories to plot
> ;*********************************************
> ; some plot parameters
> ;*********************************************
>    pres                  = True               ; polyline resources
>    pres at gsLineThicknessF = 1
>
>    pres at gsLineDashPattern = 0
>
>
>    mres  = True                               ; marker resources
>    first = True                               ; start of traj resources
> ;********************************
>
>    do days = 0,25
>
>   ;   print(days)
>
>   do i = arr2(days),arr2(days+1)-1
>
>  ;print("qudsia"+i)
>
>   ndays = (arr2(days+1)-1)-arr2(days)
>
>    xpt = new(ndays,float)            ; allocate memory
>    ypt = new(ndays,float)
>  ; aod = new(ndays,float)
>    xpt = 0.0
>    ypt = 0.0
>  ;  aod = 0.0
>
>       ypt = data(i,9)                  ; extract lat from whole array
>       xpt = data(i,10)                  ; extract lon from whole array
>      aod = data(i,11)
>
>
>   pres at gsLineColor=GetFillColor(cnlevels,cmap,aod(days))   ; color each
> trajectory according to height.
>
>
>  do pt= 0, dimsizes(xpt)-2
>
>     gsn_polyline(wks,map,(/xpt(pt),xpt(pt+1)/),(/ypt(pt),ypt(pt+1)/),pres)
>
>   end do
>
>
> end do
>
>
>   delete(xpt)
>   delete(ypt)
>  ; delete(aod)
>
> end do
>   gsn_labelbar_ndc(wks,dimsizes(cnlevels)+1,cnlevels,0.30,0.30,res_lb)
>
>    frame(wks)
> end
>
>
> Any help would be appreciated.
>
> Qudsia
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>


-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150829/0cd8fb5e/attachment.html 


More information about the ncl-talk mailing list