<div dir="ltr">Hello,<div>That error message usually tells you exactly what is wrong: &quot;<span style="font-size:12.8px">Subscript out of range, error in subscript #2&quot;  and &quot;</span><span style="font-size:12.8px">Error occurred at or near line 51&quot;</span></div><div>Based on what you sent ncl-talk, I do not think you sent the complete script. Can you tell ncl-talk what specific line the error is occurring?</div><div>As always, please respond to the ncl-talk email list only.</div><div>Adam </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 17, 2016 at 1:09 PM, Adv <span dir="ltr">&lt;<a href="mailto:advita6@gmail.com" target="_blank">advita6@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi,<br></div><div>I am getting this error. Could someone help me to fix this bug?<br><br></div><div>Thanks<br><br></div>fatal:[&quot;NclFile.c&quot;:2103]:Subscript out of range, error in subscript #2<br>fatal:[&quot;Execute.c&quot;:8575]:Execute: Error occurred at or near line 51 in file regress_dennis.ncl<br>load &quot;./contributed.ncl_beta_640&quot;<br><br>begin<br><br>;************************************************<br>; Specify geographical region and time span (year-month start and end<br>;************************************************<br><br>  latS     = 40<br>;  latS     = 0               <br>  latN     =  49<br>  lonL     =  -116<br>  lonR     = -90<br><br>  ymStrt   = 195101<br>  ymLast   = 201012<br><br>  pltType  = &quot;x11&quot;<br>  pltName  = &quot;regress&quot;<br>  pltTitle = &quot;Globe: &quot;+(ymStrt/100)+&quot;-&quot;+(ymLast/100)<br><br>;************************************************<br>; Read from netCDF file: variable is type short...unpack<br>;************************************************<br>   version= &quot;v2&quot;         ; &quot;v2&quot;, &quot;v2c&quot;<br><br>   diri   = &quot;./&quot;<br>;   fili   = &quot;air.sig995.mon.mean.&quot;+version+&quot;.nc&quot;<br>   fili   = &quot;<a href="http://air.sig995.mon.mean.nc" target="_blank">air.sig995.mon.mean.nc</a>&quot;<br>   f      = addfile(diri+fili,&quot;r&quot;)<br><br>   YYYYMM = cd_calendar( f-&gt;time, -1)<br>yyy   = yyyymm/100<br><br>   dimx = dimsizes(x)<br>   ntim = dimx(0)                ; all years and months<br>   nlat = dimx(1)<br>   mlon = dimx(2)<br><br>   year  = ispan(yyyy(0), yyyy(ntim-1), 1)<br>   nyrs  = dimsizes(year)<br><br>;************************************************<br>; Areal averages: cos(lat) is good enough<br>;************************************************<br> wgt   = cos(0.01745329*x&amp;lat)<br>   xann  = month_to_annual(x , 1)                 ; [year| 60]x[lat| 91]x[lon| 180]<br>  xavg  = wgt_areaave_Wrap(xann , wgt, 1.0, 1)   ; [year| 110]      <br><br>   xann&amp;year  = year<br>   xann@long_name = &quot;Annual Air Temperature (&quot;+version+&quot;: sigma=0.995)&quot;<br>   printVarSummary(xann)<br>   printMinMax(xann,0)<br>;return<br>;************************************************<br>; Calculate the regression coefficients (slopes)    <br>;************************************************<br>   rc           = regCoef(year,xann(lat|:,lon|:,year|:))           <br><br>   rc@long_name = &quot;Trend&quot;<br>rc@units     = &quot;degC/&quot;+nyrs+&quot;_year&quot;<br>   printMinMax(rc,0)<br><br><br>;************************************************<br>; plotting parameters <br>;************************************************<br>   wks  = gsn_open_wks(&quot;x11&quot;,&quot;regress_4_&quot;+version)       ; specifies a ps plot<br><br>   res                       = True<br>   res@gsnMaximize           = True             ; make large<br>   res@cnFillOn              = True             ; turn on color<br>   res@cnLinesOn             = False            ; turn off contour lines<br>   res@cnLineLabelsOn        = False            ; turn off contour line labels<br> ;;res@cnFillMode            = &quot;RasterFill&quot;<br><br>   res@cnLevelSelectionMode  = &quot;ManualLevels&quot;   ; set manual contour levels<br>;   res@cnMinLevelValF        =  -2.0            ; set min contour level<br>   res@cnMinLevelValF        =  -3.0            ; set min contour level<br>;   res@cnMaxLevelValF        =   2.0            ; set max contour level<br>   res@cnMaxLevelValF        =   5.0            ; set max contour level<br>;   res@cnLevelSpacingF       =   0.2            ; set contour interval<br>   res@cnLevelSpacingF       =   0.5            ; set contour interval<br>  res@mpFillOn              = False            ; turn off default background gray<br>  ;res@mpCenterLonF          = 180<br><br>   res@gsnCenterString       = year(0)+&quot;-&quot;+year(nyrs-1)<br><br>   res@tiMainString          = &quot;20th Century Reanalysis (&quot;+version+&quot;): sig995&quot;    ; fili<br>   plot = gsn_csm_contour_map_ce(wks,rc,res)<br><br><br>;************************************************<br>; Perform linear regression on selected annual mean<br>;************************************************<br><br><br>   rcTest = regline_stats(year, xavg)           ; degC/year<br>;   rcTest@long_name = &quot;trend: (&quot;+toint(LAT)+&quot;,&quot;+toint(LON)+&quot;)&quot;<br>   rcTest@long_name = &quot;trend:&quot;<br>   rcTest@units     = &quot;degC/year&quot;<br>   rcTest           = rcTest*nyrs                       ; (C/year)*(nyrs)<br>   rcTest@units         = &quot;degC/&quot;+nyrs+&quot;_year&quot;<br><br>   pltarry      = new ( (/2,nyrs/), typeof(xann))<br>   pltarry(0,:) = xavg              ; use markers<br>   pltarry(1,:) = rcTest@Yest                           ; regression values<br><br>   resxy                     = True                   ; plot mods desired<br>   resxy@xyMarkLineModes     = (/&quot;Markers&quot;,&quot;Lines&quot;/); choose which have markers<br> resxy@xyMarkerColors      = (/&quot;Red&quot;, &quot;Blue&quot;    /); choose which have markers<br>   resxy@xyMarkers           = 16                     ; choose type of marker <br>   resxy@xyMarkerSizeF       = 0.0075                 ; Marker size (default 0.01)<br><br>   resxy@xyDashPatterns      = 0                      ; solid line <br>   resxy@xyLineThicknesses   = (/2,3/)<br>   resxy@xyLineColors        = (/ &quot;blue&quot; , &quot;black&quot; /)<br>   resxy@tmYLFormat          = &quot;f&quot;                    ; not necessary but nicer labels <br><br> ;;resxy@trXMinF                =  min(year)<br>   resxy@trXMaxF                =  max(year)<br>   resxy@tiMainString           = &quot;regline: 20th Renalysis (&quot;+version+&quot;):  trend=&quot;+sprintf(&quot;%5.2f&quot;, rcTest)<br><br> ;---Make legend smaller and move into plot<br>   resxy@pmLegendDisplayMode    = &quot;Always&quot;            ; turn on legend<br>   resxy@pmLegendSide           = &quot;Top&quot;               ; Change location of <br>   resxy@pmLegendParallelPosF   = 0.225               ; move units Leftt<br>   resxy@pmLegendOrthogonalPosF = -0.30               ; move units down<br>   resxy@pmLegendWidthF         = 0.10                ; Change width and<br>   resxy@pmLegendHeightF        = 0.100               ; height of legend.<br>   resxy@lgPerimOn              = True                ; turn off/on box around<br> resxy@lgLabelFontHeightF     = .015                ; label font height<br>   resxy@xyExplicitLegendLabels = (/&quot;data&quot; , &quot;regline&quot; /)<br>   plot                       = gsn_csm_xy (wks,year,pltarry,resxy)           ; create plot<br><br>   end<br><br></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist,  </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a>   </font></span><span><font color="#888888">303-497-1726 </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</div>