Adding a Box

From: Baode Chen <bdchen_at_nyahnyahspammersnyahnyah>
Date: Fri, 08 Dec 2006 11:44:19 -0500

Hi, ALL

I tried to add a box in each plot for a group of plots. But I got the error
message as followings

warning:TransformPostDraw: tfPolyDrawList element 0 is invalid
warning:TransformPostDraw: tfPolyDrawList element 0 is invalid
warning:TransformPostDraw: tfPolyDrawList element 0 is invalid
warning:TransformPostDraw: tfPolyDrawList element 0 is invalid
warning:TransformPostDraw: tfPolyDrawList element 0 is invalid
warning:prXArray isn't a resource in this object
warning:prYArray isn't a resource in this object
warning:prPolyType isn't a resource in this object
warning:prGraphicStyle isn't a resource in this object
Segmentation fault

The following is my script

;************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
;************************************************
begin
prp = new((/6,180,360/),"float")
in = "ITCZ.comp3.dat"
do i = 0, 5
prp(i,:,:) = fbinrecread(in,i,(/180,360/),"float")
end do
lon = fspan(0.5,359.5,360)
lat = fspan(89.5,-89.5,180)
at = new(6,"string")
at(0) = "South ITCZ"
at(1) = "Equator ITCZ"
at(2) = "Double ITCZ"
at(3) = "North ITCZ"
at(4) = "Full ITCZ"
at(5) = "Weak ITCZ"
p = new(6,graphic)
prp!1="lat"
prp&lat = lat
prp!2="lon"
prp&lon = lon
prp&lat_at_units = "degree_north"
prp&lon_at_units = "degree_east"
prp@_FillValue = -999.0
   wks = gsn_open_wks("x11","SP3")
   gsn_define_colormap(wks,"wh-bl-gr-ye-re")
   d = NhlNewColor(wks,0.8,0.8,0.8)
   res = True
   res_at_gsnDraw = False ; don't draw
   res_at_gsnFrame = False ; don't advance frame
   res_at_cnInfoLabelOn = False ; turn off cn info label
   res_at_cnLinesOn = False
   res_at_cnFillOn = True ; turn on color
   res_at_cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
   res_at_cnMinLevelValF = 1. ; set min contour level
   res_at_cnMaxLevelValF = 15. ; set max contour level
   res_at_cnLevelSpacingF = 0.5 ; set contour spacing
   res_at_gsnSpreadColors = True ; spread out color table
   res_at_gsnAddCyclic = True ; plotted dataa are not cyclic
   res_at_mpFillOn = False ; turn off map fill
   res_at_lbLabelAutoStride = True
   res_at_gsnSpreadColorEnd = -3 ; don't use added gray
   res_at_mpCenterLonF = 180
   res_at_mpCenterLonF = 180
   res_at_mpMaxLatF = 35.0 ; area to zoom in on
   res_at_mpMinLatF = -35.
   res_at_mpMinLonF = 100.
   res_at_mpMaxLonF = 250.
   res_at_gsnMaximize = True

   res_at_lbLabelBarOn = False ; turn off individual cb's
   res_at_pmTickMarkDisplayMode = "Always"; use NCL default lat/lon labels
   res_at_lbOrientation = "Vertical" ; vertical label bar
   res_at_cnFillDrawOrder = "PreDraw" ; draw contours before continents
   res_at_gsnMaximize = True
   res_at_gsnPaperOrientation = "landscape"

   do i = 0, 5
   res_at_tiMainString = at(i)
   p(i) = gsn_csm_contour_map_ce(wks,prp(i,:,:),res)
   end do

; add the box
   ypts = (/ 10.0, 10.0, -10. , -10., 10.0/)
   xpts = (/ 130., 210.0, 210.0, 130.0,130.0/)
   do i = 0, 4
   print(xpts(i)+" "+ypts(i))
   end do

   resb = True
   resb_at_gsLineColor = "red" ; color of lines
   resb_at_gsLineThicknessF = 2.0
   p1=new(6,graphic)
   do j = 0, 5
   p1(j) = gsn_add_polygon (wks,p(j),xpts,ypts,resb)
   end do
   delete(p1)
   delete(resb)
   resP = True
   resP_at_gsnPanelLabelBar = True ; add common colorbar
   gsn_panel(wks,p,(/3,2/),False)
end
.

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Dec 08 2006 - 09:44:19 MST

This archive was generated by hypermail 2.2.0 : Sun Dec 10 2006 - 19:25:38 MST