Re: Help: How to add line and makers on the Zoomed domain of WRF output

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Fri Sep 17 2010 - 10:23:14 MDT

Hi Kekuan,
I think the plot is getting drawn and the frame is being advanced when
you call wrf_map_overlays, which is not what you want. gsn_add_polyline
/ gsn_add_polymarker require you to not draw the plot before calling
those functions.

According to the documentation:
http://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_map_overlays.shtml
by default the plot is drawn and the frame is advanced. I'd try 2 things:
1) Set pltres@gsnDraw = False and pltres@gsnFrame = False
(I am not sure if wrf_map_overlays accepts these resources.)

if that doesn't work:
2) set pltres@gsnPanelPlot = True , which supposedly will not draw the
plot nor advance the frame.

One of those 2 options should work. If not, let the group know..
Adam

On 09/17/2010 06:53 AM, Kekuan Chu wrote:
> Hello everyone:
> I tried to plot a small area of the WRF domain, and then add some
> line and makers on it.
> However, the fields, line and makers were drawn on separated graphs.
> How to plot them on one graph?
> Thank you very much.
>
> The script is:
> ; Refer to wrf_Zoom.ncl etc.
>
> 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/wrf/WRFUserARW.ncl"
>
> begin
> ;********************************************************
> ;
> xp = new((/6,13/),float) ; allocate memory
> yp = new((/6,13/),float)
>
> ;001 cntl
> yp(0,:) =
> (/17.0,17.8,18.5,19.2,19.7,20.1,20.5,20.9,20.8,21.0,21.3,21.6,22.1/)
> xp(0,:) =
> (/125.1,125.1,125.0,124.6,124.3,124.3,124.4,124.2,124.1,124.5,124.6,124.5,124.5/)
>
> ;********************************************************
>
> ; open file
> a = addfile("./wrfinput.nc","r")
>
> ; We generate plots, but what kind do we prefer?
> wks = gsn_open_wks("x11","plt_Zoom")
>
> ; Set the color map
> gsn_define_colormap(wks,"ViBlGrWhYeOrRe"); select color map
>
> ; Set some Basic Plot options
> res = True
> res@MainTitle = "Typhoon"
> pltres = True
> mpres1 = True
>
> var = wrf_user_getvar(a,"U",0)
>
> dims = dimsizes(var)
> ; define the zoomed domain
> x_start = 22
> x_end = 60
> y_start = 0
> y_end = 40
>
> mpres1@ZoomIn = True
> mpres1@Xstart = x_start
> mpres1@Ystart = y_start
> mpres1@Xend = x_end
> mpres1@Yend = y_end
>
> var_zoom = var(:,y_start:y_end,x_start:x_end)
> var_zoom@description = var@description
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> opts = res
>
> opts@cnFillOn = True ; turn on color
> opts@cnLinesOn = False ; turn contour lines
> opts@gsnSpreadColors = True ; use entire color map
> opts@lbLabelAutoStride = True ; let NCL determine
> label spacing
>
> opts@cnLevelSelectionMode = "ManualLevels" ; manual
> contour levels
> opts@cnMinLevelValF = -6. ; set min
> contour level
> opts@cnMaxLevelValF = 6. ; set max
> contour level
> opts@cnLevelSpacingF = 1. ; contour interval
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> ;plot var in zoom area
> contour = wrf_contour(a,wks,tc_zoom(var,:,:),opts)
> plot = wrf_map_overlays(a,wks,(/contour/),pltres,mpres1)
>
> ; Add trajectory lines.
> pres = True ; polyline resources
> pres@gsLineThicknessF = 3.0 ; line thickness
> pres@gsLineColor = "black"
> line = gsn_add_polyline(wks,plot,xp(0,:),yp(0,:),pres) ; draw
> the traj
>
> ; Add markers to the trajectories.
> mres = True ; marker resources for best track
> mres@gsMarkerIndex = 16 ; marker style (filled circle)
> mres@gsMarkerSizeF = 8.0 ; marker size
> mres@gsMarkerColor = "black" ; maker color
> markers = gsn_add_polymarker(wks,plot,xp(0,:),yp(0,:),mres)
> draw(plot)
> frame(wks)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> end
>

-- 
__________________________________________________
Adam Phillips 
asphilli@ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
Climate and Global Dynamics Division         fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Sep 17 10:23:19 2010

This archive was generated by hypermail 2.1.8 : Mon Sep 20 2010 - 15:45:07 MDT