<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Grace,</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">NCL tells you that you have tried to access "times" beyond its boundary.</div><div class="gmail_default" style="font-family:verdana,sans-serif">Add line:</div><div class="gmail_default" style="font-family:verdana,sans-serif">printVarSummary(times)</div><div class="gmail_default" style="font-family:verdana,sans-serif">before line 49 to make sure that "times" has dimension 137 or more.</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Wei</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><font face="tahoma, sans-serif">================================================</font><div><font face="tahoma, sans-serif">1850 Table Mesa Dr.</font></div><div><font face="tahoma, sans-serif">Boulder, CO 80307</font></div><div><font face="tahoma, sans-serif">Phone: 303-497-8924</font></div></div></div></div>
<br><div class="gmail_quote">On Thu, Jan 8, 2015 at 1:01 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"><div><div>Hello:</div><div> I want to add lightning data on a plot,which is drawn with wrfout data,but it report errors as fellow:</div><div>fatal:Subscript out of range, error in subscript #0<br>fatal:An error occurred
reading times<br>fatal:["Execute.c":8567]:Execute: Error occurred at or near
line 49 in file /home/Huanglei/wrf_Cloudgraup_add_L.ncl<span style="line-height:0px"></span><br></div><div>Here is my script,could you guys give me some tips?Any information will be appreciated.</div><div>; Example script to produce plots for a WRF real-data run,</div><div>; with the ARW coordinate dynamics option.</div><div><br></div><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/wrfoutd032013080521"+".nc","r") </div><div><br></div><div><br></div><div>; We generate plots, but what kind do we prefer?</div><div> ; type = "eps"</div><div> type = "pdf"</div><div>; type = "ps"</div><div>; type = "ncgm"</div><div> wks = gsn_open_wks(type,"20130806plt_Cloudgraup1020")</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> 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> it = 136</div><div> print("Working on time: " + times(it) )</div><div> res@TimeLabel = times(it) ; Set Valid time to use on plots</div><div> ; print(it + (/0,1,2,3,4,5,6,7,8,9,10,11,12,13,14/))</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> qi = wrf_user_getvar(a,"QGRAUP",it )</div><div> qi = qi*1000.</div><div> qi@units = "g/kg" </div><div> end if</div><div><br></div><div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div><div><br></div><div> do level = 13,15,2 ; LOOP OVER LEVELS</div><div><br></div><div> display_level = level + 2</div><div> opts = res</div><div> opts@cnFillOn = True</div><div> opts@gsnSpreadColors = False</div><div> opts@ContourParameters = (/ 1, 19, 2 /)</div><div> opts@PlotLevelID = "Eta Level " + display_level</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("qi"))</div><div> qis = qi(level + (/0,1,2,3,4,5,6/),:,:)</div><div> qisum = dim_sum_n_Wrap(qis, 0)</div><div> contour = wrf_contour(a,wks,qisum,opts)</div><div> plot = wrf_map_overlays(a,wks,(/contour/),pltres,mpres)</div><div><br></div><div> delete(contour)</div><div> end if</div><div>;>============================================================<</div><div>; add 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><br></div><div><br></div><div> delete(opts)</div><div><div style="line-height:21px">;>============================================================<</div><div style="line-height:21px">; add lightning</div><div style="line-height:21px">;>------------------------------------------------------------<<span style="line-height:0px"></span></div></div><div>ascii_filename = "/home/Huanglei/data/20130806/utc11.txt"</div><div> seismic = asciiread(ascii_filename,(/183,3/),"float") </div><div> </div><div> y = seismic(:,0) ; Column 1 of file contains X values.</div><div> x = seismic(:,1) ; Column 2 of file contains Y values.</div><div> z = seismic(:,2) ; Column 3 of file contains Z values.</div><div> txres2 = True</div><div> txres2@txFont = 0.01</div><div> txres2@txFontHeightF =0.01</div><div> txres2@txFontColor = "Red"</div><div> idx = ind(z .gt. 0)</div><div> print(idx)</div><div>if .not. all(ismissing(idx))</div><div> str = new(dimsizes(idx), "string")</div><div> str = "+"</div><div> txdum1 = gsn_add_text(wks, plot, str, x(idx),y(idx), txres2)</div><div>end if</div><div><br></div><div>txres2@txFontColor = "Blue"</div><div><br></div><div>idx := ind(z .lt. 0)</div><div>if .not. all(ismissing(idx))</div><div> str := new(dimsizes(idx), "string")</div><div> str = "-" </div><div> txdum2 = gsn_add_text(wks, plot, str, x(idx),y(idx), txres2)</div><div>end if</div><div> draw(plot) </div><div> frame(wks)</div><div> end do ; END OF LEVEL LOOP</div><div><br></div><div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div><div><br></div><div>; end do ; END OF TIME LOOP </div><div><br></div><div>end</div></div><div><span style="line-height:0px"></span><br></div><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>