<div dir="ltr"><div><div><div><div>I would recommend:<br></div><div><br><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/regCoef_n.shtml">http://www.ncl.ucar.edu/Document/Functions/Built-in/regCoef_n.shtml</a><br><br></div><div>This is the most recent version. As noted in the documentation:<br>Note: with NCL V6.2.1 or later, you can use <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/regCoef_n.shtml"><strong>regCoef_n</strong></a>
to avoid having to reorder the arrays first:

<pre>   rc   = <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/regCoef_n.shtml"><strong>regCoef_n</strong></a>(x, y, 0, 0)
</pre>===<br></div><div><br></div>****PLease See: Example 2***<br><br><pre>rc   = <strong>regCoef_n</strong>(time, ts, 0, 0) ; <b>rc(nlat,mlon)</b></pre>copy_VarCoords(ts(0,:,),rc)<br></div>printVarSummary(rc)<br><br>=====<br></div>Using the original regCoef rather than regCoef_n may require the arrays to be reordered.<br><br><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/regCoef-1.shtml">http://www.ncl.ucar.edu/Document/Functions/Built-in/regCoef-1.shtml</a><br><br></div>****See: Examples 2 and 3***<br><br><pre>   rc   = <strong>regCoef</strong>(x, y(lat|:,lon|:,time|:) )    
</pre>If <em>y</em> has <a href="http://www.ncl.ucar.edu/Document/Language/cv.shtml">coordinate variables</a>
these may readily be assigned via NCL syntax: 
<pre>   rc!0   = &quot;lat&quot;    ; name dimensions
   rc!1   = &quot;lon&quot;
   rc&amp;lat = y&amp;lat    ; assign coordinate values to named dimensions
   rc&amp;lon = y&amp;lon
</pre><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 2, 2017 at 3:01 AM, Kunal Bali <span dir="ltr">&lt;<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@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><div>Dear NCL users,<br><br></div>I have the data with time steps &gt; 1000<br><br></div>I want to plot the spatial map of trend analysis of the given dataset. <br></div>So I tried the script given below for getting the desired plot but couldn&#39;t successed.<br><br></div><div>the given error is <br><b>fatal:regCoef: The rightmost dimension of x must be at least 2<br>fatal:[&quot;Execute.c&quot;:8567]:<wbr>Execute: Error occurred at or near line 32 in file trend.ncl<br></b><br> <br></div><div>Could anyone please help me out<br></div><br><br>  <br>   tmp  = a-&gt;SWTNTCLR<br>   ts   = tmp(time|:,lat|:,lon|:)       <wbr>        ; reorder variable<br><br>   delete(tmp)                   <wbr>               ; no longer needed<br><br>;*****************************<wbr>*******************<br>; create x and calculate the regression coefficients (slopes, trends)    <br>;*****************************<wbr>*******************<br>   time         = ts&amp;time                       ; days since 1850-01-01<br>   rc           = regCoef(time,ts)             <br>   <br>   rc@long_name = &quot;regression coefficient (trend)&quot;<br>   rc@units     = ts@units+&quot;/day&quot;    <br>;   copy_VarCoords(ts(:,:,0), rc)                ; copy lat,lon coords<br><br><br>;*****************************<wbr>*******************<br>; plotting parameters <br>;*****************************<wbr>*******************<br>   wks  = gsn_open_wks(&quot;ps&quot; ,&quot;regress&quot;) <br>   gsn_define_colormap(wks,&quot;<wbr>ViBlGrWhYeOrRe&quot;)    ; choose colormap<br>   <br>   res                       = True     <br>   res@gsnMaximize           = True             ; make large<br><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        =  -1.00           ; set min contour level<br>;   res@cnMaxLevelValF        =   1.00           ; set max contour level<br>   res@cnLevelSpacingF       =   0.10           ; set contour interval<br>;<br>   res@mpFillOn              = False            ; turn off default background gray<br> ;  res@mpCenterLonF          = 210<br>   <br>   res@tiMainString          = fili<br>   plot = gsn_csm_contour_map_ce(wks,rc,<wbr>res)    <br>  end<br><br><br>  <br><div><div><div><div><br><br><br><br><br></div><div>Regards<span class="HOEnZb"><font color="#888888"><br clear="all"></font></span></div><span class="HOEnZb"><font color="#888888"><div><div><div><div class="m_6420530442664993331gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Kunal Bali<br></div><br><div><br></div><div><br></div><div><p style="margin:0px;border-collapse:collapse;font-family:tahoma,verdana;font-size:12px"><font color="#1F497D"><br></font></p></div></div></div></div></div></div>
</div></div></font></span></div></div></div></div>
<br>______________________________<wbr>_________________<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/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>