<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="gmail_extra"><br><div class="gmail_quote">On Tue, May 17, 2016 at 6:07 PM, Adam Phillips <span dir="ltr"><<a href="mailto:asphilli@ucar.edu" target="_blank">asphilli@ucar.edu</a>></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 class=""><div><span style="font-size:12.8px">x = f->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'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->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 class="HOEnZb"><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 class="">On Tue, May 17, 2016 at 1:09 PM, Adv <span dir="ltr"><<a href="mailto:advita6@gmail.com" target="_blank">advita6@gmail.com</a>></span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><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:["NclFile.c":2103]:Subscript out of range, error in subscript #2<br>fatal:["Execute.c":8575]:Execute: Error occurred at or near line 51 in file regress_dennis.ncl<br>load "./contributed.ncl_beta_640"<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 = "x11"<br> pltName = "regress"<br> pltTitle = "Globe: "+(ymStrt/100)+"-"+(ymLast/100)<br><br>;************************************************<br>; Read from netCDF file: variable is type short...unpack<br>;************************************************<br> version= "v2" ; "v2", "v2c"<br><br> diri = "./"<br>; fili = "air.sig995.mon.mean."+version+".nc"<br> fili = "<a href="http://air.sig995.mon.mean.nc" target="_blank">air.sig995.mon.mean.nc</a>"<br> f = addfile(diri+fili,"r")<br><br> YYYYMM = cd_calendar( f->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&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&year = year<br> xann@long_name = "Annual Air Temperature ("+version+": sigma=0.995)"<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 = "Trend"<br>rc@units = "degC/"+nyrs+"_year"<br> printMinMax(rc,0)<br><br><br>;************************************************<br>; plotting parameters <br>;************************************************<br> wks = gsn_open_wks("x11","regress_4_"+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 = "RasterFill"<br><br> res@cnLevelSelectionMode = "ManualLevels" ; 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)+"-"+year(nyrs-1)<br><br> res@tiMainString = "20th Century Reanalysis ("+version+"): sig995" ; 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 = "trend: ("+toint(LAT)+","+toint(LON)+")"<br> rcTest@long_name = "trend:"<br> rcTest@units = "degC/year"<br> rcTest = rcTest*nyrs ; (C/year)*(nyrs)<br> rcTest@units = "degC/"+nyrs+"_year"<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 = (/"Markers","Lines"/); choose which have markers<br> resxy@xyMarkerColors = (/"Red", "Blue" /); 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 = (/ "blue" , "black" /)<br> resxy@tmYLFormat = "f" ; not necessary but nicer labels <br><br> ;;resxy@trXMinF = min(year)<br> resxy@trXMaxF = max(year)<br> resxy@tiMainString = "regline: 20th Renalysis ("+version+"): trend="+sprintf("%5.2f", rcTest)<br><br> ;---Make legend smaller and move into plot<br> resxy@pmLegendDisplayMode = "Always" ; turn on legend<br> resxy@pmLegendSide = "Top" ; 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 = (/"data" , "regline" /)<br> plot = gsn_csm_xy (wks,year,pltarry,resxy) ; create plot<br><br> end<br><br></div>
<br></div></div><span class="">_______________________________________________<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 class=""><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">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>
</span></div>
</blockquote></div><br></div>