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

From: Kekuan Chu <kchu_at_nyahnyahspammersnyahnyah>
Date: Fri Sep 24 2010 - 08:35:50 MDT

  Hi, Mary:
     Thank you very much for your prompt response and help.
     Following your suggestion, I add the following two lines, and it works:

   pltres@FramePlot = False
   pltres@PanelPlot = True

Kekuan

On 9/24/2010 10:01 AM, Mary Haley wrote:
> Hi Kekuan,
>
> The wrf_xxxx scripts by default advance the frame, so once you call
> wrf_map_overlays,
> anything you draw after this will be on the second page.
>
> The other thing that wrf_map_overlays does is remove anything that
> you've overlaid
> onto the map. When you call "draw" on the plot, then, you will only
> get the map,
> and no contours.
>
> You can trick the wrf_map_overlays into not removing anything, and
> tell it not to
> advance the frame by setting:
>
> opts@FramePlot = False
> opts@PanelPlot = True
>
> I will update the documentation page to mention this.
>
> --Mary
>
> On Sep 24, 2010, at 6:33 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.
>> Has anyone met the similar problems?
>> 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
>> --
>> Kekuan Chu
>>
>> College of Marine Science,
>> University of South Florida
>> 727-553-3358(office)
>> 727-238-1462(cell)
>>
>> School of Atmospheric Sciences,
>> Key Laboratory of Mesoscale Severe Weather (LMSWE)
>> Nanjing University, Nanjing, 210093
>> P. R. China
>> kkchu@nju.edu.cn
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

-- 
Kekuan Chu
College of Marine Science,
University of South Florida
727-553-3358(office)
727-238-1462(cell)
School of Atmospheric Sciences,
Key Laboratory of Mesoscale Severe Weather (LMSWE)
Nanjing University, Nanjing, 210093
P. R. China
kkchu@nju.edu.cn
Received on Fri Sep 24 08:36:22 2010

This archive was generated by hypermail 2.1.8 : Mon Oct 04 2010 - 08:55:55 MDT