<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">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>