<div dir="ltr"><div>Ditto what Alan has written.<br></div><div>======================<br>If you are new to NCL, please read the &#39;Mini-Reference Manual&#39; at: <a href="http://www.ncl.ucar.edu/Document/Manuals/" target="_blank">http://www.ncl.ucar.edu/Document/Manuals/</a><br>
=======================<br>

<br></div><div>You must have had error message indicating that &#39;escar&#39; was undefined.<br></div><div>Error messages should be read, they often will tell you the exact problem.<br><br></div><div>That said:<br></div>


<div><br>[1] <br></div>The *autocorrelation* function &#39;esacr&#39; *may* be what you want to use. <br><div><div><br>      <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/esacr.shtml" target="_blank">https://www.ncl.ucar.edu/Document/Functions/Built-in/esacr.shtml</a><br>


<br></div><div>Please read the documentation. In particular, that associated with &#39;mxlag&#39;<br><br>-----<br><i>mxlag</i>
<p>A scalar integer. It is recommended that 0 &lt;= mxlag &lt;= N/4. This is because the 
correlation <br></p><p>algorithm(s) use N rather than (N-k) values in the denominator 
(Chatfield Chapter 4).</p><p>-----<br></p>REPLACE<br><br><div>      do LAG=0,dimsizes(indx_sst)-1<br>          crr_indx=escar(indx_sst,LAG)<br>          crr_DJF=escar(rr_DJF,LAG)<br>      end do</div>
<br></div><div>WITH (NOTE: *no do loop used* ; NCL is an array language; ;     again, please read documentation, carefully)<br><br></div><div>     LAGMX = dimsizes(indx_sst)/4</div><div>     acr_indx = esacr(indx_sst, LAGMX)<br>
     acr_DJF =esacr(rr_DJF, LAGMX)<br>

<br> **Use &#39;printVarSummary&#39; often and carefully look** at the dimensions sizes and <br>    shape of the resultant variables.</div><div><br></div><div>     printVarSummary(acr_indx)     ; acr_indx(LAGMX)<br></div>


<div>     printVarSummary(acr_DJF)     ; acr_DJF(nlat,mlon,LAGMX)<br>                                                      ;                  0     1         2<br></div><div>     print(acr_indx)<br><br>[2]<br></div><div>

**After you have carefully examined the output from the above statements**, you will note that <br>
the array shapes are different (one-dimension &amp; three-dimension).<br><br></div><div>You can not directly multiply 1D and 3D arrays. You must use the &#39;conform&#39; function:<br><br><a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/conform.shtml" target="_blank">     https://www.ncl.ucar.edu/Document/Functions/Built-in/conform.shtml</a><br>


<br></div><div>After reading the documentation including examples, you will do the following:<br></div><div><br></div><div>     acr_indx_3d = conform(acr_DJF, acr_indx, 2)   <br></div><div>     printVarSummary(acr_indx_3d)                         ; acr_indx_3d(nlat,mlon,LAGMX)<br>


<br><br></div><div>Now you want to sum the LAGMX auto-correlations  at each grid point. No &#39;do loop&#39; necessary.<br><br><a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_sum_n.shtml" target="_blank">    https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_sum_n.shtml</a><br>


<br></div><div>     c = dim_sum_n(acr_indx_3d*acr_DJF, 2)         <br></div><div>     printVarSummary(c)                                             ; c(nlat,mlon)<br></div><div><br>[3] <br><div>     d = 1+ 2*c                           <br>


</div><div>     printVarSummary(d)                                             ; d(nlat,mlon)<br><br></div><div>     df = dimsizes(indx_sst)/d<br></div><div>     printVarSummary(df)                                            ; df(nlat,mlon)<br>


</div><div>     print(&quot;df: min=&quot;+min(df)+&quot;   max=&quot;+max(df))        ; does this look reasonable?<br><br><br></div><div>rtest requires that the &#39;df&#39; to be integer<br><br>    <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/rtest.shtml" target="_blank">https://www.ncl.ucar.edu/Document/Functions/Built-in/rtest.shtml</a><br>


<br></div><div>Further, as previously noted, &#39;rtmp&#39; is nowhere to be seen, presumably    rtmp(nlat,mlon)<br></div><div><br>    r_test=rtest(rtmp, toint(df), 0)<span style="white-space:pre-wrap">     ; presumably &#39;rtmp&#39; is defined &#39;somewhere&#39;</span></div>


 <br>    printVarSummary(r_test)                                            ; r_test(nlat,mlon)<br>    print(&quot;r_test: min=&quot;+min(r_test)+&quot;   max=&quot;+max(dr_test))<br>                  </div></div><div class="gmail_extra">


<br><br><div class="gmail_quote">On Wed, Aug 13, 2014 at 7:59 AM, Alan Brammer <span dir="ltr">&lt;<a href="mailto:abrammer@albany.edu" target="_blank">abrammer@albany.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 style="word-wrap:break-word"><div><br></div><div>Marcia, </div><div><span style="white-space:pre-wrap">        </span>See some of my comments for each line below.  Next time send the list the specific error messages and/or the whole ncl code.  The error messages are usually very specific about the problem, which would save the list from trying to guess at the problem. <br>


<div><br></div><div><br></div><div>You may just have a typo with respect to esacr() / escar()  but the other comments I think are still valid. </div><div><div><br></div><div><br></div><br><blockquote type="cite">

<div>;====  rtest ====================================</div>
<div>
<div>;==== dimension : sst_DJF_anom(time,lat,lon), indx_sst(time)</div>
<div>;=============================================</div></div>
</blockquote><br></div><blockquote type="cite"><div>rr_DJF=sst_DJF_anom(lat|:,lon|:,time|:)</div>
<div> </div>
<div> </div>
<div>do LAG=0,dimsizes(indx_sst)-1<span style="white-space:pre-wrap">                        </span><font color="#000000">; Is this the whole code ? Where was indx_sst defined? </font><br> crr_indx=escar(indx_sst,LAG)<span style="white-space:pre-wrap">                        </span><font color="#000000">; Do you mean for crr_indx to just keep being over written ? </font><br>


 crr_DJF=escar(rr_DJF,LAG)<span style="white-space:pre-wrap">                                </span><font color="#000000">; Also what is escar()  It doesn’t appear to be an NCL supported function?</font><br></div></blockquote><span style="white-space:pre-wrap">                                                                        </span>  ; Do you mean to be using esccr ()  or esacr () ? <br>


<blockquote type="cite"><div>end do</div>
<div> </div>
<div>c =0<br>do i=1,dimsizes(indx_sst)<br> c= c+crr_indx*crr_DJF<span style="white-space:pre-wrap">                </span><font color="#000000">; Again is you’re just multiplying by 2 scalar values and incrementing c. Not sure what the point of this is.</font><br>


end do</div><div>
<div> </div>
<div>d = 1+ 2*c</div>
<div> </div>
<div> </div>
<div>df = dimsizes(indx_sst)/d</div>
<div> </div>
</div><div> r_test=rtest(rtmp, df, 0)<span style="white-space:pre-wrap">                </span><font color="#000000">;  Where was rtmp defined?   Was it defined ? </font><br></div></blockquote><div><br></div><div><br></div><div>Alan. </div>


<div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><br><div><span>##############################</span><br><span>Alan Brammer,</span><div>PhD candidate,</div><div><br></div><div>


Department of Atmospheric and Environmental Sciences,<br>University at Albany, State University of New York, Albany, NY, 12222<div><a href="mailto:abrammer@albany.edu" target="_blank">abrammer@albany.edu</a><br>##############################</div>


</div></div></div><br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div></div>