<DIV>
<DIV>Hi all:</DIV>
<DIV>&nbsp;&nbsp; I am trying to plot precipitation with wrfout data and try to add .shp on the <FONT color=#006091>plot.</FONT></DIV>
<DIV><FONT color=#006091>But error happened:</FONT></DIV>
<DIV>ERROR 4: Unable to open /public/home/huanglei/map/shaanxi_diqu.shx or /public/home/huanglei/map/shaanxi_diqu.SHX.<BR>fatal:Failed to open OGR file: <BR>fatal:/public/home/huanglei/map/shaanxi_diqu.shp<BR>fatal:Could not open (/public/home/huanglei/map/shaanxi_diqu.shp)</DIV>
<DIV>I have changed different shp file,but the errors are same.<BR>My NCL version is 6.2.0.</DIV>
<DIV>&nbsp;How can I slove the problem?</DIV>
<DIV>
<DIV><SPAN style="LINE-HEIGHT: 24px"><FONT style="LINE-HEIGHT: 30px" size=2>&nbsp;<FONT size=4>&nbsp;&nbsp;</FONT></FONT></SPAN><SPAN style="LINE-HEIGHT: 24px"><FONT size=4>&nbsp;&nbsp; This is my script:</FONT></SPAN></DIV>
<DIV><SPAN style="LINE-HEIGHT: 24px">;&nbsp;&nbsp; Example script to produce plots for a WRF real-data run,<BR>;&nbsp;&nbsp; with the ARW coordinate dynamics option.</SPAN></DIV>
<DIV><SPAN style="LINE-HEIGHT: 24px">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<BR>load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"<BR>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" <BR>begin<BR>;<BR>; The WRF ARW input file.&nbsp; <BR>; This needs to have a ".nc" appended, so just do it.<BR>&nbsp; a = addfile("/public/home/huanglei/wrfdata/5km/wrfout_d03_2015-08-02_12:00:00.nc","r")</SPAN></DIV>
<DIV><SPAN style="LINE-HEIGHT: 24px">; We generate plots, but what kind do we prefer?<BR>&nbsp;; type = "x11"<BR>&nbsp;type = "pdf"<BR>; type = "ps"<BR>; type = "ncgm"<BR>&nbsp; wks = gsn_open_wks(type,"plt_Precip_5km0802")</SPAN></DIV><SPAN style="LINE-HEIGHT: 24px">
<DIV><BR>; Set some basic resources<BR>&nbsp; res = True<BR>&nbsp; <A href="mailto:res@MainTitle">res@MainTitle</A> = "REAL-TIME WRF"</DIV>
<DIV>&nbsp; mpres&nbsp; = True&nbsp; ; Map resources<BR>&nbsp; <A href="mailto:mpres@mpOutlineOn">mpres@mpOutlineOn</A> = False&nbsp; ; Turn off map outlines<BR>&nbsp; <A href="mailto:mpres@mpFillOn">mpres@mpFillOn</A>&nbsp;&nbsp;&nbsp; = False&nbsp; ; Turn off map fill<BR>&nbsp; <A href="mailto:mpres@mpGridAndLimbOn">mpres@mpGridAndLimbOn</A> = True<BR>&nbsp;;res@mpProjection&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = "Lambert"<BR>&nbsp; pltres = True ; Plot resources<BR>&nbsp; <A href="mailto:pltres@PanelPlot">pltres@PanelPlot</A>&nbsp; = True&nbsp;&nbsp; ; Tells wrf_map_overlays not to remove overlays</DIV>
<DIV><BR>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<BR>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</DIV>
<DIV>; What times and how many time steps are in the data set?<BR>&nbsp; FirstTime = True<BR>&nbsp; times = wrf_user_getvar(a,"times",-1)&nbsp; ; get all times in the file<BR>&nbsp; ntimes = dimsizes(times)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; number of times in the file</DIV>
<DIV>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</DIV>
<DIV>&nbsp; do it = 0,24,3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; TIME LOOP</DIV>
<DIV>&nbsp;&nbsp;&nbsp; print("Working on time: " + times(it) )<BR>&nbsp;&nbsp;&nbsp; <A href="mailto:res@TimeLabel">res@TimeLabel</A> = times(it)&nbsp;&nbsp; ; Set Valid time to use on plots</DIV>
<DIV>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<BR>; First get the variables we will need&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </DIV>
<DIV><BR>&nbsp; ; Get non-convective, convective and total precipitation of 5km&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; rain_exp = wrf_user_getvar(a,"RAINNC",it)<BR>&nbsp;&nbsp;&nbsp; rain_con = wrf_user_getvar(a,"RAINC",it)<BR>&nbsp;&nbsp;&nbsp; rain_tot = rain_exp + rain_con<BR>&nbsp;&nbsp;&nbsp; <A href="mailto:rain_tot@description">rain_tot@description</A> = "Total Precipitation"</DIV>
<DIV><BR>&nbsp;;calculate the precipitation <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( it .eq. 0 ) then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rain_exp_save = rain_exp<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rain_con_save = rain_con<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rain_tot_save = rain_tot</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rain_exp_save = wrf_user_getvar(a,"RAINNC",it-1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rain_con_save = wrf_user_getvar(a,"RAINC",it-1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rain_tot_save = rain_exp_save + rain_con_save</DIV>
<DIV><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; times_sav = times(it-1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end if<BR>&nbsp;&nbsp;&nbsp; rain_tot_tend = rain_tot - rain_tot_save</DIV>
<DIV>&nbsp;&nbsp;&nbsp; <A href="mailto:rain_tot_tend@description">rain_tot_tend@description</A> = "Precipitation of 5km"</DIV>
<DIV>&nbsp; ; Bookkeeping, just to allow the tendency at the next time step<BR>&nbsp;&nbsp;&nbsp; rain_exp_save = rain_exp<BR>&nbsp;&nbsp;&nbsp; rain_con_save = rain_con<BR>&nbsp;&nbsp;&nbsp; rain_tot_save = rain_tot</DIV>
<DIV>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</DIV>
<DIV><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; Plotting options for Precipitation<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; opts_r = res&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="mailto:opts_r@UnitLabel">opts_r@UnitLabel</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = "mm"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="mailto:opts_r@cnLevelSelectionMode">opts_r@cnLevelSelectionMode</A> = "ExplicitLevels"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="mailto:opts_r@cnLevels">opts_r@cnLevels</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = (/ .1, .2, .4, .8, 1.6, 3.2, 6.4, \<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 12.8, 25.6, 51.2, 102.4/)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="mailto:opts_r@cnFillColors">opts_r@cnFillColors</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = (/"White","White","DarkOliveGreen1", \<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "DarkOliveGreen3","Chartreuse", \<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "Chartreuse3","Green","ForestGreen", \<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "Yellow","Orange","Red","Violet"/)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="mailto:opts_r@cnInfoLabelOn">opts_r@cnInfoLabelOn</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = False<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="mailto:opts_r@cnConstFLabelOn">opts_r@cnConstFLabelOn</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = False<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="mailto:opts_r@cnFillOn">opts_r@cnFillOn</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = True<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="mailto:opts_r@gsnDraw">opts_r@gsnDraw</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&nbsp; False&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="mailto:opts_r@gsnFrame">opts_r@gsnFrame</A>&nbsp;&nbsp;&nbsp;&nbsp; =&nbsp; False<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; Precipitation Tendencies<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(it .gt. 0)then <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="mailto:opts_r@SubFieldTitle">opts_r@SubFieldTitle</A> = "from " + times(it-3) + " to " + times(it)<BR>&nbsp;&nbsp;&nbsp; end if<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; contour_tend = wrf_contour(a,wks, rain_tot_tend,opts_r) ; total (color)</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; delete(opts_r)</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; MAKE PLOTS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; plot = wrf_map_overlays(a,wks,contour_tend,pltres,mpres)</DIV>
<DIV><BR>&nbsp; <BR>;&gt;============================================================&lt;<BR>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; add China map<BR>;&gt;------------------------------------------------------------&lt;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp; shp_name1&nbsp;&nbsp;&nbsp; = "/public/home/huanglei/map/shaanxi_diqu.shp"</DIV>
<DIV>&nbsp; lnres&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = True<BR>&nbsp; <A href="mailto:lnres@gsLineColor">lnres@gsLineColor</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = "gray25"<BR>&nbsp; <A href="mailto:lnres@gsLineThicknessF">lnres@gsLineThicknessF</A> = 0.5&nbsp;&nbsp; </DIV>
<DIV>&nbsp;id = gsn_add_shapefile_polylines(wks,plot,shp_name1,lnres)<BR>&nbsp;; shp_name2&nbsp;&nbsp;&nbsp; = "/home/huanglei/map/China/cnmap/cnhimap.shp"</DIV>
<DIV>;&nbsp; prres=True<BR>&nbsp;; <A href="mailto:prres@gsLineThicknessF">prres@gsLineThicknessF</A> = 2.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>;&nbsp; <A href="mailto:prres@gsLineColor">prres@gsLineColor</A> = "black"<BR>&nbsp;; plotcn3 = gsn_add_shapefile_polylines(wks,plot,shp_name2,prres)<BR>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</DIV>
<DIV>&nbsp;draw(plot)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; This will draw the map and the shapefile outlines.<BR>&nbsp; frame(wks)<BR>&nbsp; end do&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; END OF TIME LOOP</DIV>
<DIV>end<BR></SPAN></DIV></DIV></DIV>