<div dir="ltr"><div class="gmail_default"><font face="arial, helvetica, sans-serif" size="4">I'm not sure what the question is. You said:</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" size="4"><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" size="4"><i>...<span style="line-height:30px">but after I write the script according the function above and try to run it, it just calculated the sreh and has no errors warning and wanted pictures appeared.</span></i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" size="4"><i><span style="line-height:30px"><br></span></i></font></div><div style="line-height:23px"><font size="4"><span style="line-height:24px"><font style="line-height:30px" face="arial, helvetica, sans-serif"><div class="gmail_default" style="display:inline">After you run the script, do you have a PDF file called "</div></font></span><span style="font-family:'lucida Grande',Verdana,'Microsoft YaHei';line-height:30px">plt_</span><span style="font-family:'lucida Grande',Verdana,'Microsoft YaHei';line-height:30px">lightningindex<div class="gmail_default" style="display:inline">.pdf"? If did, does it not look correct? </div></span></font></div><div style="line-height:23px"><font size="4"><span style="font-family:'lucida Grande',Verdana,'Microsoft YaHei';line-height:30px"><div class="gmail_default" style="display:inline"><br></div></span></font></div><div style="line-height:23px"><font size="4"><span style="font-family:'lucida Grande',Verdana,'Microsoft YaHei';line-height:30px"><div class="gmail_default" style="display:inline">If you are not sure "lindex" is being calculated properly, it helps if you use procedures like "printVarSummary" to see what the variable looks like, and "printMinMax" to print the min and max of the variables. </div></span></font></div><div style="line-height:23px"><font size="4"><span style="font-family:'lucida Grande',Verdana,'Microsoft YaHei';line-height:30px"><div class="gmail_default" style="display:inline"><br></div></span></font></div><div style="line-height:23px"><span style="font-family:'lucida Grande',Verdana,'Microsoft YaHei';font-size:large;line-height:30px">Please be more specific about what the problem is.</span><br></div><div style="line-height:23px"><br></div><div style="line-height:23px"><br></div><div style="line-height:23px"><font size="4"><span style="font-family:'lucida Grande',Verdana,'Microsoft YaHei';line-height:30px"><div class="gmail_default" style="display:inline">--Mary</div></span></font></div><div style="line-height:23px"><font size="4"><span style="font-family:'lucida Grande',Verdana,'Microsoft YaHei';line-height:30px"><div class="gmail_default" style="display:inline"><br></div></span></font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 23, 2014 at 2:50 AM, grace <span dir="ltr"><<a href="mailto:313695096@qq.com" target="_blank">313695096@qq.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><table style="width:99.8%"><tbody><tr><td style="background:url(https://res.mail.qq.com/zh_CN/htmledition/images/xinzhi/bg/a_04.jpg) repeat-x #cdede2;min-height:550px;padding:100px 55px 200px"><div><span style="font-family:'lucida Grande',Verdana,'Microsoft YaHei';font-size:14px;background-color:rgb(255,255,255)"><font size="4" style="line-height:30px">Hi,all:</font></span><div style="font-family:'lucida Grande',Verdana,'Microsoft YaHei';font-size:14px;line-height:23px;background-color:rgb(255,255,255)"><span style="line-height:24px"><font size="4" style="line-height:30px"> I am calculating a index and try to plot it.</font></span></div><div style="background-color:rgb(255,255,255)"><font face="lucida Grande, Verdana, Microsoft YaHei" size="4"><span style="line-height:30px"> lindex=abs(sreh)*(qgsum+qisum+qssum)<span style="line-height:0px"></span></span></font></div><div style="font-family:'lucida Grande',Verdana,'Microsoft YaHei';font-size:14px;line-height:23px;background-color:rgb(255,255,255)"><span style="line-height:24px"><font size="4" style="line-height:30px"> but after I write the script according the function above and try to run it,it just calculated the sreh and has no errors warning and wanted pictures appeared.</font></span></div><div style="font-family:'lucida Grande',Verdana,'Microsoft YaHei';font-size:14px;line-height:23px;background-color:rgb(255,255,255)"><span style="line-height:24px"><font size="4" style="line-height:30px">The bash window and script:</font></span></div><div style="font-family:'lucida Grande',Verdana,'Microsoft YaHei';font-size:14px;line-height:23px;background-color:rgb(255,255,255)"><br></div><div style="font-family:'lucida Grande',Verdana,'Microsoft YaHei';font-size:14px;line-height:23px;background-color:rgb(255,255,255)"><img src="cid:D21A0106@AB695143.71342154.jpg"></div><div style="background-color:rgb(255,255,255)"><font face="lucida Grande, Verdana, Microsoft YaHei" size="4"><span style="line-height:30px"><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" </div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" </div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"</div><div><br></div><div>begin</div><div>;</div><div>; The WRF ARW input file. </div><div>; This needs to have a ".nc" appended, so just do it.</div><div> a = addfile("/home/Huanglei/data/d032"+".nc","r") </div><div><br></div><div><br></div><div>; We generate plots, but what kind do we prefer?</div><div> type = "pdf"</div><div>; type = "pdf"</div><div>; type = "ps"</div><div>; type = "ncgm"</div><div> wks = gsn_open_wks(type,"plt_lightningindex")</div><div><br></div><div> gsn_define_colormap(wks,"precip_11lev")</div><div>; Set some basic resources</div><div> res = True</div><div> res@MainTitle = "REAL-TIME WRF"</div><div> ; res@gsnDraw = False </div><div> ;res@gsnFrame = False</div><div><br></div><div> mpres = True ; Map resources</div><div> mpres@mpOutlineOn = False ; Turn off map outlines</div><div> mpres@mpFillOn = False ; Turn off map fill</div><div> mpres@mpGridAndLimbOn = True</div><div> ;res@mpProjection = "Lambert"</div><div> pltres = True ; Plot resources</div><div> pltres@PanelPlot = True ; Tells wrf_map_overlays not to remove overlays</div><div><br></div><div><br></div><div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div><div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div><div><br></div><div>; What times and how many time steps are in the data set?</div><div> times = wrf_user_getvar(a,"times",-1) ; get all times in the file</div><div> ntimes = dimsizes(times) ; number of times in the file</div><div><br></div><div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div><div><br></div><div> do it =1, ntimes-1,1 ; TIME LOOP</div><div><br></div><div> print("Working on time: " + times(it) )</div><div> res@TimeLabel = times(it) ; Set Valid time to use on plots</div><div> sreh = wrf_user_getvar(a,(/"helicity","3000"/),it) <span style="white-space:pre-wrap">        </span>; here 3km is specifically set - same as above</div><div><br></div><div> cnres = res</div><div> cnres@cnFillOn = True</div><div> cnres@cnSmoothingOn = True</div><div> cnres@cnSmoothingDistanceF = .005</div><div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div><div>; First get the variables we will need </div><div> if(isfilevar(a,"QGRAUP"))</div><div><span style="white-space:pre-wrap">        </span> qgraup = wrf_user_getvar(a,"QGRAUP",it )</div><div> qgraup = qgraup*1000.</div><div> qgraup@units = "g/kg" </div><div> end if</div><div><br></div><div> if(isfilevar(a,"QICE"))</div><div><br></div><div><span style="white-space:pre-wrap">        </span> qice = wrf_user_getvar(a,"QICE",it )</div><div> qice = qice*1000.</div><div> qice@units = "g/kg" </div><div> end if</div><div><br></div><div> if(isfilevar(a,"QSNOW"))</div><div><span style="white-space:pre-wrap">        </span> qsnow = wrf_user_getvar(a,"QSNOW",it )</div><div> qsnow = qsnow*1000.</div><div> qsnow@units = "g/kg" </div><div> end if</div><div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div><div><br></div><div> </div><div> opts = res</div><div> opts@cnFillOn = True</div><div> opts@gsnSpreadColors = False</div><div> opts@ContourParameters = (/ 1, 19, 2 /)</div><div><span style="white-space:pre-wrap">        </span> opts@gsnDraw = False </div><div> opts@gsnFrame = False</div><div><br></div><div><br></div><div> if (isvar("qgraup"))</div><div> qgs = qgraup(13 + (/0,1,2,3,4,5,6/),:,:)</div><div> qgsum = dim_sum_n_Wrap(qgs, 0)</div><div> end if</div><div><br></div><div><span style="white-space:pre-wrap">        </span> if (isvar("qice"))</div><div> qis = qice(13 + (/0,1,2,3,4,5,6/),:,:)</div><div> qisum = dim_sum_n_Wrap(qis, 0)</div><div> end if</div><div><br></div><div><span style="white-space:pre-wrap">        </span> if (isvar("qsnow"))</div><div> qss = qsnow(13 + (/0,1,2,3,4,5,6/),:,:)</div><div> qssum = dim_sum_n_Wrap(qss, 0)</div><div> end if</div><div><br></div><div> lindex=abs(sreh)*(qgsum+qisum+qssum)</div><div> contour = wrf_contour(a,wks,lindex,opts)</div><div> plot = wrf_map_overlays(a,wks,(/contour/),pltres,mpres)</div><div>;>============================================================<</div><div>; add China map</div><div>;>------------------------------------------------------------<</div><div><br></div><div> </div><div> shp_name1 = "/home/Huanglei/map/China/diquJie_polyline.shp"</div><div><br></div><div> lnres = True</div><div> lnres@gsLineColor = "gray25"</div><div> lnres@gsLineThicknessF = 0.5 </div><div><br></div><div> id = gsn_add_shapefile_polylines(wks,plot,shp_name1,lnres)</div><div> shp_name2 = "/home/Huanglei/map/China/cnmap/cnhimap.shp"</div><div><br></div><div> prres=True</div><div> prres@gsLineThicknessF = 2.0 </div><div> prres@gsLineColor = "black"</div><div> plotcn3 = gsn_add_shapefile_polylines(wks,plot,shp_name2,prres)</div><div><br></div><div> txres2 = True</div><div> txres2@txFont = 10</div><div> txres2@txFontHeightF =0.01</div><div> txres2@txFontColor = "Blue"</div><div> txdum1 =gsn_add_text(wks, plot, "Chengdu", 104.06,30.67, txres2)</div><div><br></div><div> draw(plot) ; This will draw the map and the shapefile outlines.</div><div> frame(wks)</div><div> delete(opts)</div><div><br></div><div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div><div><br></div><div> end do ; END OF TIME LOOP </div><div><br></div><div>end<span style="line-height:0px"></span></div></span></font></div><div style="font-family:'lucida Grande',Verdana,'Microsoft YaHei';font-size:14px;line-height:23px;background-color:rgb(255,255,255)"><span style="line-height:24px"><font size="4" style="line-height:30px"><br></font></span></div><div style="font-family:'lucida Grande',Verdana,'Microsoft YaHei';font-size:14px;line-height:23px;background-color:rgb(255,255,255)"><span style="line-height:24px"><font size="4" style="line-height:30px"> Do you guys have some advice?</font></span></div><div style="font-family:'lucida Grande',Verdana,'Microsoft YaHei';font-size:14px;line-height:23px;background-color:rgb(255,255,255)"><span style="line-height:24px"><font size="4" style="line-height:30px"> any information will be appreciated</font></span></div></div><div><span style="line-height:24px"><font size="4" style="line-height:30px"><span style="line-height:0px"></span><br></font></span></div></td></tr></tbody></table><br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>