[ncl-talk] Problem with trajectory (solid lines) plotting.....
qudsia zafar
missquaddus at gmail.com
Fri Aug 28 00:08:25 MDT 2015
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150828/2ccc9119/attachment.html
More information about the ncl-talk
mailing list