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

From: Kekuan Chu <kchu_at_nyahnyahspammersnyahnyah>
Date: Fri Sep 17 2010 - 06:53:41 MDT

  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

-- 
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
Received on Fri Sep 17 06:54:12 2010

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