<div dir="ltr"><div class="gmail_default" style="font-size:small">The error is telling you what to do:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">    &quot;<span style="font-size:12.8px">You may want to set the gsnAddCyclic resource to False to avoid a </span><span style="font-size:12.8px">warning message from the spline function.&quot;</span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px"><br></span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px">When you plot regional data, you don&#39;t want to add a longitude cyclic point.</span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px"><br></span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px">Try setting:</span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px">  </span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px">  res@gsnAddCyclic = False</span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px"><br></span></div><div class="gmail_default"><span style="font-size:12.8px">--Mary</span></div><div class="gmail_default"><span style="font-size:12.8px"><br></span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px"><br></span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 18, 2016 at 10:14 AM, 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><div><div>Hi,<br><br></div>I still get error. <br><br></div>Output of PrintVarSummary command. <br>Variable: xt<br>Type: float<br>Total Size: 128943360 bytes<br>            32235840 values<br>Number of Dimensions: 3<br>Dimensions and sizes:    [time | 1968] x [lat | 91] x [lon | 180]<br>Coordinates: <br>            time: [447048..1883904]<br>            lat: [90..-90]<br>            lon: [ 0..358]<br>Number Of Attributes: 19<br>  cell_methods :    time: mean (monthly from 6-hourly values)<br>  long_name :    Monthly Air Temperature at sigma level 0.995<br>  units :    degK<br>  precision :    2<br>  GRIB_id :    11<br>  GRIB_name :    TMP<br>  var_desc :    Air temperature<br>  dataset :    NOAA-CIRES 20th Century Reanalysis version 2c Monthly Averages<br>  level_desc :    sigma level 0.995<br>  statistic :    Ensemble Mean<br>  parent_stat :    Individual Obs<br>  standard_name :    air_temperature<br>  missing_value :    -9.96921e+36<br>  valid_range :    ( 100, 500 )<br>  statistic_method :    Ensemble mean is calculated by averaging over all 56 ensemble members at each time step and then averaging mean over all time steps in a month<br>  GridType :    Cylindrical Equidistant Projection Grid<br>  datum :    wgs84<br>  actual_range :    ( 215.7992, 318.2858 )<br>  _FillValue :    -9.96921e+36<br><br></div>Now I get error ::::::<br><br><div><div>(0)    gsn_add_cyclic: Warning: The range of your longitude data is not 360.<br>(0)    You may want to set the gsnAddCyclic resource to False to avoid a<br>(0)    warning message from the spline function.<br>warning:_NhlCreateSplineCoordApprox: Attempt to create spline approximation for X axis failed: consider adjusting trXTensionF value<br>warning:IrTransInitialize: error creating spline approximation for trXCoordPoints; defaulting to linear<br><br><br></div><div>There is shift in the region too.<br><br></div><div>Please help me to fix this.<br><br></div><div>Thank you<br></div><div><br></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 17, 2016 at 6:07 PM, Adam Phillips <span dir="ltr">&lt;<a href="mailto:asphilli@ucar.edu" target="_blank">asphilli@ucar.edu</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>Hello,</div>Please remember to always include ncl-talk on any responses, as that way other users can assist. <div><br></div><div>You responded to me stating that the error message occurs at this line:<span><div><span style="font-size:12.8px">x      = f-&gt;air(iStrt:iLast,{latS:latN}</span><span style="font-size:12.8px">,{lonL:lonR}) ;;;;;{line 51}:::::::::::</span><br></div><div><span style="font-size:12.8px"><br></span></div></span><div><span style="font-size:12.8px">The error message stated that the 2nd subscript is out of range. Thus, your specified lonL and lonR coordinate subscripts are not within the range of air&#39;s longitudes. You are setting </span><span style="font-size:12.8px">lonL =  -116 and </span><span style="font-size:12.8px">lonR     = -90. A common ncl-talk phrase is to always look at your data.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Try this:</span></div><div><span style="font-size:12.8px">xT</span><span style="font-size:12.8px"> = f-&gt;air</span></div><div><span style="font-size:12.8px">printVarSummary(xT)</span></div><div><span style="font-size:12.8px">With printVarSummary you will see the coordinate variables and their range. I am guessing that your longitudes run from 0-360. Thus, when coordinate subscripting you should specify longitudes from 0-360. (You might want to check the latitude order as well, do they run from south to north or north to south?)</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Now try this:</span></div><div><span style="font-size:12.8px">lonL = 244</span></div><div><span style="font-size:12.8px">lonR = 270</span></div><div><span style="font-size:12.8px">x = xT(iStrt:iLast,{latS:latN}</span><span style="font-size:12.8px">,{lonL:lonR})</span></div><div><span style="font-size:12.8px">delete(xT)</span></div><div><span style="font-size:12.8px">printVarSummary(x)</span></div><div><br></div><div><span style="font-size:12.8px">Hopefully that all answers your query. If not, please respond to the ncl-talk email list.</span></div><span><font color="#888888"><div><span style="font-size:12.8px">Adam</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div><div><br></div><div><br></div></font></span></div></div><div class="gmail_extra"><br><div class="gmail_quote"><span>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></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><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></div></div><span>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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></span></blockquote></div><span><br><br clear="all"><div><br></div>-- <br><div><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"><a href="tel:303-497-1726" value="+13034971726" target="_blank">303-497-1726</a> </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>
</span></div>
</blockquote></div><br></div>
</div></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></div>