Re: Polylines in each panel plot

From: Rick Brownrigg <brownrig_at_nyahnyahspammersnyahnyah>
Date: Wed Dec 22 2010 - 09:25:58 MST

Hi,

I *think* the issue is that you need to draw the polylines explicitly on each plot. In:

> do j = 0,3
> dum(j)=gsn_add_polyline(wks,plots,xpts(j:j+1),ypts(j:j+1),resb)
> end do

"plots" is an array of size 6. I think you want to loop over plots, not points:

dum = new(6, graphic)
do j=0,5
  dum(j) = gsn_add_polyline(wks, plots(j), xpts, ypts, resb)
end do

Hope that helps.
Rick

On Dec 22, 2010, at 4:21 AM, Ibo Ze wrote:

> Hi All,
>
> I've been trying to plot polylines to be overlayed at each panel plot in a frame.
> But the polylines part of script gives gives following error:
>
> fatal:Number of elements of dimension (0) of argument (0) is (6) in function (NhlAddPrimitive), expected (1) elements
> fatal:Execute: Error occurred at or near line 3632 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl
>
> fatal:Execute: Error occurred at or near line 3897 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl
>
>
> Below is my script. I would appreciate if someone can help me to resolve this issue.
>
> thanks,
> Ibo
>
> 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"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>
> begin
>
> wks = gsn_open_wks("pdf","pkc") ; ps or x11 to save or visualize
> gsn_define_colormap(wks,"BlueDarkRed18")
>
> res = True ; No plot options set.
>
> res@gsnDraw = False
> res@gsnFrame = False
> res@cnFillOn = True
> res@cnInfoLabelOn = False
> res@gsnMaximize = True
> res@cnLevelSelectionMode = "ExplicitLevels" ; manually set cn levels
> res@cnMinLevelValF = -1 ; min level
> res@cnMaxLevelValF = 1 ; max level
> res@cnLevels = (/"-1.0","-0.9","-0.8","-0.7","-0.6","-0.5","-0.4","-0.3","-0.2",\
> "0.0","0.2","0.3","0.4","0.5","0.6","0.7","0.8","0.9","1.0"/)
> res@cnLinesOn = False ; Turn off contour lines
> res@gsnSpreadColors = True
> res@gsnAddCyclic = False
> res@lbLabelBarOn = False
>
> plots = new(6,graphic)
> do i=0,5
> j = i+5
> filename1 = "pkc."+sprinti("%0.2i",j)+".7906.wa.nc"
> f1 = addfile(filename1,"r")
> x1 = f1->pre
> ;print(x1)
> ;printVarSummary(x1)
> filename2 = "medd."+sprinti("%0.2i",j)+".7906.nc"
> f2 = addfile(filename2,"r")
> x2 = f2->pre(lat|:,lon|:,time|:)
> ;printVarSummary(x2)
> x2!0 = "lat"
> x2!1 = "lon"
> x2&lat@units = "degrees_north"
> x2&lon@units = "degrees_east"
> c = escorc(x1,x2)
> copy_VarCoords(x2,c)
> plots(i) = gsn_csm_contour_map_ce(wks,c(:,:),res)
>
> end do
>
> ypts = (/ 34, 34, 29.5, 29.5, 34/)
> xpts = (/ 69.3, 74.5, 74.5, 69.3, 69.3/)
>
> resb = True ; polyline mods desired
> resb@gsLineColor = "black" ; color of lines
> resb@gsLineThicknessF = 1.0 ; thickness of lines
>
> pres = True
> pres@gsnFrame = True
> pres@gsnPanelLabelBar = True
> pres@pmLabelBarWidthF = 0.8
> gsn_panel(wks,plots,(/3,2/),pres)
> dum = new(4,graphic)
>
> do j = 0,3
> dum(j)=gsn_add_polyline(wks,plots,xpts(j:j+1),ypts(j:j+1),resb)
> end do
> draw(plots)
> frame(wks)
> end
>
>
>
> _______________________________________________
> 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 Wed Dec 22 09:26:04 2010

This archive was generated by hypermail 2.1.8 : Wed Dec 22 2010 - 16:10:23 MST