<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!--P{margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Dear all,</p>
<p>I have tried one example of ncl script for plotting surface wind (see below) to attach a shape file to a wrf output plot however with no success.</p>
<p>The shape file doesn't get attached to the two plots.</p>
<p>I will be glad if somebody moves me out from this state.</p>
<p>Thank you.<br>
</p>
<p><br>
</p>
<div id="Signature">
<div class="BodyFragment"><font size="2">
<div class="PlainText">Noah <br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"<br>
;load "./WRFUserARW.ncl"<br>
<br>
begin<br>
; ; This needs to have a ".nc" appended, so just do it.<br>
a = addfile("file","r")<br>
<br>
<br>
<br>
; We generate plots, but what kind do we prefer?<br>
type = "x11"<br>
;type = "pdf"<br>
;type = "ps"<br>
; type = "ncgm"<br>
wks = gsn_open_wks(type,"~/test")<br>
<br>
; Set some basic resources<br>
res = True<br>
<br>
res@MainTitle = "Surface wind 10m"<br>
<br>
<br>
mpres = True<br>
<br>
; Set some Basic Plot options<br>
res = True<br>
<br>
<br>
res@Footer = False<br>
<br>
mpres = True<br>
pltres = True ; Basic overlay plot options<br>
<br>
<br>
mpres@mpNationalLineColor = "Black"<br>
mpres@mpUSStateLineColor = "Black"<br>
;mpres@mpGridLineColor = "Black"<br>
mpres@mpLimbLineColor = "Black"<br>
mpres@mpPerimLineColor = "Black"<br>
mpres@mpGeophysicalLineThicknessF = 2.5<br>
;mpres@mpGridLineThicknessF = 2.0<br>
;mpres@mpLimbLineThicknessF = 2.5<br>
mpres@mpNationalLineThicknessF = 2.5<br>
mpres@mpDataBaseVersion = "MediumRes"<br>
<br>
mpres@mpFillBoundarySets ="AllBoundaries"<br>
mpres@mpOutlineBoundarySets = "National"<br>
<br>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br>
<br>
; What times and how many time steps are in the data set?<br>
times = wrf_user_getvar(a,"times",-1) ; get all times in the file<br>
ntimes = dimsizes(times) ; number of times in the file<br>
shp = new(ntimes,graphic)<br>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br>
<br>
do it = 0,ntimes-1,2 ; TIME LOOP<br>
<br>
print("Working on time: " + times(it) )<br>
res@TimeLabel = times(it) ; Set Valid time to use on plots<br>
<br>
<br>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br>
; First get the variables we will need <br>
<br>
slp = wrf_user_getvar(a,"slp",it) ; slp<br>
wrf_smooth_2d( slp, 3 ) ; smooth slp<br>
tc = wrf_user_getvar(a,"tc",it) ; 3D tc <br>
td = wrf_user_getvar(a,"td",it) ; 3D td <br>
u = wrf_user_getvar(a,"ua",it) ; 3D U at mass points<br>
v = wrf_user_getvar(a,"va",it) ; 3D V at mass points<br>
td2 = wrf_user_getvar(a,"td2",it) ; Td2 in C<br>
tc2 = wrf_user_getvar(a,"T2",it) ; T2 in Kelvin<br>
tc2 = tc2-273.16 ; T2 in C<br>
u10 = wrf_user_getvar(a,"U10",it) ; u at 10 m, mass point<br>
v10 = wrf_user_getvar(a,"V10",it) ; v at 10 m, mass point<br>
rh = wrf_user_getvar(a,"rh",it) ; <br>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; <br>
<br>
<br>
;tf2 = 1.8*tc2+32. ; Turn temperature into Fahrenheit<br>
tc2@description = "Surface Temperature"<br>
tc2@units = "~F34~0~F~C" <br>
;td_f = 1.8*td2+32. ; Turn temperature into Fahrenheit<br>
td2@description = "Surface Dew Point Temp" <br>
td2@units = "~F34~0~F~C"<br>
;u10 = u10*1.94386 ; Turn wind into knots<br>
;v10 = v10*1.94386<br>
u10@units = "m/s"<br>
v10@units = "m/s"<br>
<br>
<br>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br>
<br>
; Plotting options for T <br>
opts = res <br>
opts@cnFillOn = True <br>
opts@ContourParameters = (/ 0., 30., 5./)<br>
opts@gsnSpreadColorEnd = -3 ; End third from the last color in color map<br>
contour_tc = wrf_contour(a,wks,tc2,opts)<br>
<br>
delete(opts)<br>
<br>
<br>
; Plotting options for Td<br>
opts = res <br>
opts@cnFillOn = True <br>
opts@cnLinesOn = True<br>
opts@cnLineLabelsOn = True<br>
opts@ContourParameters = (/ 0., 30., 5./) <br>
opts@cnLineLabelBackgroundColor = -1<br>
opts@gsnSpreadColorEnd = -3 ; End third from the last color in color map<br>
contour_td = wrf_contour(a,wks,td2,opts)<br>
<br>
delete(opts)<br>
<br>
<br>
; Plotting options for SLP <br>
opts = res <br>
;opts@cnLineColor = "Blue"<br>
;opts@cnHighLabelsOn = True<br>
;opts@cnLowLabelsOn = True<br>
opts@ContourParameters = (/ 1000., 1200., 2. /)<br>
;opts@cnLineLabelBackgroundColor = -1<br>
;opts@gsnContourLineThicknessesScale = 2.0<br>
contour_psl = wrf_contour(a,wks,slp,opts)<br>
<br>
delete(opts)<br>
<br>
<br>
; Plotting options for Wind Vectors <br>
<br>
opts = res <br>
opts@FieldTitle = "Wind" ; overwrite Field Title<br>
opts@NumVectors = 47 ; wind barb density<br>
opts@vcRefAnnoOrthogonalPosF = 0.02 ; move ref vector up<br>
opts@vcWindBarbColor = "black" ; Draw wins barbs in white<br>
opts@vcRefMagnitudeF = 10.0 ; define vector ref mag<br>
opts@vcRefLengthF = 0.045 ; define length of vec ref<br>
opts@vcGlyphStyle = "CurlyVector" ; turn on curly vectors<br>
opts@vcMinDistanceF = 0.055 ; thin out windbarbs<br>
<br>
opts@vcRefAnnoOn =True<br>
opts@gsnFrame = False ; so we can draw time stamp<br>
opts@vcRefAnnoSide = "Right"<br>
vector = wrf_vector(a,wks,u10,v10,opts)<br>
<br>
delete(opts) <br>
<br>
<br>
; MAKE PLOTS <br>
<br>
plot = wrf_map_overlays(a,wks,(/contour_tc,contour_psl,vector/),pltres,mpres)
<br>
<br>
<br>
plot= wrf_map_overlays(a,wks,(/contour_td,vector/),pltres,mpres)<br>
;define shapefiles <br>
shp_filename = ("./shape.shp")<br>
;-- set shapefile resources<br>
shpres = True<br>
shpres@gsLineThicknessF = 3.9 ;-- increase line thickness<br>
shpres@gsLineColor = "Purple" ;-- line colorgsLineThicknessF<br>
<br>
shp= gsn_add_shapefile_polylines(wks,plot,shp_filename,shpres)<br>
draw(plot) <br>
frame(wks)<br>
end do ; END OF TIME LOOP<br>
<br>
end<br>
<br>
</div>
</font></div>
</div>
</body>
</html>