Re: draw order for contour map (based on .nc file) and polylines (based on .shp file)

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Wed Feb 19 2014 - 11:17:16 MST

Hi Hanna,
I do not have much experience with the wrf* plotting functions, but I
think I see what the issue is with your code. I think you need to set
pltres@PanelPlot = False, which will result in the plot not being drawn
and the frame not being advanced. Those two conditions are required when
you use gsn_add_polyline. Finally, with the above change, you will need
to manually advance the frame at the end of your script with a
frame(wks) call after you call draw(plot)..

On a side note: Once NCL v6.2.0 gets released in the next few weeks, I
would highly recommend upgrading. (v6.0.0 is almost 2 years old.)

Hope that helps. If not, please respond to ncl-talk.
Adam

On 2/18/14, 12:44 AM, Hanna Ojrzyńska wrote:
> NCL-talk,
> I would like to draw contour map of SO2 concentration (data from .nc file with the use of wrf_contour) with the administrative boundaries of Poland (polylines add from .shp file with the use of gsn_add_polyline)
> When I draw it on x11 I receive 2 separate maps (enclosures x11_1 and x11_2), but on .pdf file only first. I suppose that is problem with draw order but I have the same results after "tfPolyDrawOrder" and "cnFillDrawOrder" changing. Could You tell me what's wrong with my script (below)? My ncl version is 6.0.0
>
> Thanks
> Hanna
>
> ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> begin
>
> a = addfile("/home/data/wrfout_d02_2010-01-02_00:00:00.nc","r")
> type="x11"
> wks=gsn_open_wks(type,"SO2")
> mpres=True
> pltres = True
>
>
> SO2 = wrf_user_getvar(a,"so2",0)
>
> opts = mpres
> opts@cnFillOn = True
> opts@cnFillDrawOrder="PreDraw"
> opts@gsnSpreadColorEnd = -3
> contour_SO2 = wrf_contour(a,wks,SO2(0,:,:),opts)
>
> plot = wrf_map_overlays(a,wks,contour_SO2,pltres,mpres)
>
> shape= addfile("/home/hano/Downloads/POL_adm1.shp","r")
>
> segments=shape->segments
> geometry=shape->geometry
> segsDims=dimsizes(segments)
> geomDims=dimsizes(geometry)
>
> geom_segIndex=shape@geom_segIndex
> geom_numSegs=shape@geom_numSegs
> segs_xyzIndex=shape@segs_xyzIndex
> segs_numPnts=shape@segs_numPnts
> numFeatures=geomDims(0)
>
> shres = True
> shres@gsLineColor="black"
> shres@tfPolyDrawOrder="PostDraw"
>
> lines = new(segsDims(0),graphic)
>
> numFeatures = geomDims(0)
>
> lon=shape->x
> lat=shape->y
> segNum=0
> do i=0, numFeatures-1
> startSegment=geometry(i, geom_segIndex)
> numSegments=geometry(i, geom_numSegs)
> do seg=startSegment, startSegment+numSegments-1
> startPT = segments(seg, segs_xyzIndex)
> endPT = startPT + segments(seg, segs_numPnts) - 1
> lines(segNum) = gsn_add_polyline(wks, plot, lon(startPT:endPT), lat(startPT:endPT), shres)
> segNum = segNum + 1
> end do
> end do
>
> draw(plot)
>
> 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 Feb 19 11:17:27 2014

This archive was generated by hypermail 2.1.8 : Wed Feb 19 2014 - 15:58:35 MST