<div dir="ltr"><div>Forgot: NCL has some binning functions<br><br><a href="http://www.ncl.ucar.edu/Applications/">http://www.ncl.ucar.edu/Applications/</a><br><br></div><div>Under &quot;Data Analysis&quot; ... click &quot;Binning&quot;<br><br></div><div>See the examples. They use the following functions:<br></div><div><br><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/bin_sum.shtml">http://www.ncl.ucar.edu/Document/Functions/Built-in/bin_sum.shtml</a><br><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/bin_avg.shtml">http://www.ncl.ucar.edu/Document/Functions/Built-in/bin_avg.shtml</a><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 30, 2016 at 12:31 PM, Dennis Shea <span dir="ltr">&lt;<a href="mailto:shea@ucar.edu" target="_blank">shea@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>WRAPIT is not a complete fortran-77 parser. WRAPIT  strictly looks at the arguments being passed between NCL 
(written in C) and the fortran subroutine. The types and sizes must 
match. <br><br>WRAPIT does not understand fortran &#39;dynamic&#39; array sizing. Also, WRAPIT does not allow things like redefining the array extent such as: foo(-N:N). A stub file or is one way of addressing these limitations. NOTE: the stub file could be a valid fortran subroutine containing the NCL delimeters [ C NCLFORTSTART and C NCLEND ] that handles assorted issues in the fortran world.<br></div><div><br></div><div>That sadi:<br><br></div><div>I speculate that the issue is the &#39;nbin-1&#39; id the array declarations. Maybe, add and &#39;nbin1&#39; argument where <br></div><div>     nbin1 = nbin-1<br></div><div>and make the stub file be<br></div><div><br>C NCLFORTSTART<br>        subroutine wacftd(nxx,nyx,nkx,ntx,nbin,nb<wbr>in1, wa,bfra)<br>        integer nxx,nyx,nkx,ntx,nbin, nbin1<br>        real wa(nxx,nyx,nkx,ntx)           <wbr>         ! input variable<br><br>c c c real bins(ntx,nbin),bcnt(ntx,nbin-1<wbr>), bfra(ntx,nbin-1)<br>        real  bfra(ntx,nbin1)               <wbr>            ! return variable<br>C NCLEND<br></div><div>C WRAPIT will not look at the following. <br></div><div>       integer npts<br></div><div>       real bins(ntx,nbin), bcnt(ntx,nbin-1)    ! local  ... fortran compiler handles this<br><br></div><div>       npts = nxx*nyx*nkx<br></div><div><br></div><div>This would have to be added to the NCL script calling the subroutine as a shared object.<br></div><div>Further, variable &#39;bins&#39; is not being passed to-from the NCL script. I can an<br></div><div><br>---<br></div><div>Re: PARAMETER statements<br><br></div><div>WRAPIT  strictly looks at the arguments being passed between NCL (written in C) and the fortran subroutine. The types and sizes must match.<br><br>C NCLFORTSTART<br>        subroutine fooo(nxx,nyx,nkx,ntx,nbin, ........wa,.....)<br>        integer nxx,nyx,nkx,ntx,nbin, nbin1<br>        real wa(nxx,nyx,nkx,ntx)           <wbr>         ! input variable<br></div><div>C NCLEND<br></div><div>        integer ii, jj                           ! WRAPIT does not care about the following<br></div><div>        parameter (ii=30, jj=999)     ! baecause they are not passed into or out the subroutine<br></div><div>        double precision work(ii,jj)<br></div><div><br>---<br><br><br></div><div>You do not have to have a stub file. A minor rearrangement <br><br><br>C NCLFORTSTART<br>        subroutine wacftd(nxx,nyx,nkx,ntx,nbin,nb<wbr>in1, wa,bfra)<br>        integer nxx,nyx,nkx,ntx,nbin, nbin1<br>        real wa(nxx,nyx,nkx,ntx)           <wbr>         ! input variable<br>        real  bfra(ntx,nbin1)               <wbr>            ! return variable<br>C NCLEND<br>       real bins(ntx,nbin),bcnt(ntx,nbin-1<wbr>)<br><br><br></div><div><br></div><div>Good luck<br></div><div><br><br></div><div><br><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Fri, Dec 30, 2016 at 11:33 AM, Ying Song <span dir="ltr">&lt;<a href="mailto:ysong4@slu.edu" target="_blank">ysong4@slu.edu</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 class="h5"><div dir="ltr">Hello,<div><br></div><div>I am using WRAPIT in NCL to calculate velocity frequency, following the ex01. After running the command: </div><div>WRAPIT cftd.stub cftd.f</div><div>The error shows below:<br></div><div>++++++++++++++++++++</div><div><div>WRAPIT Version: 120209</div><div>A syntax error occurred while parsing: 1</div><div>COMPILING cftd.f</div><div>LINKING</div><div>END WRAPIT</div><div>++++++++++++++++++++</div><div>I think there are some problems in my cftd.f script but I can not find it. So I write this email asking for help!</div><div><br></div><div>cftd.f and cftd.stub are attached. Thank you very much! </div><span class="m_-5771820590071887262HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="m_-5771820590071887262m_-7294998241295014218gmail_signature"><div dir="ltr"><div>Ying Song, PhD, Post Doctoral Fellow </div><div>Department of Earth and Atmospheric Sciences</div><div>Saint Louis University</div><div><br></div><div><a href="mailto:ysong4@slu.edu" target="_blank">ysong4@slu.edu</a></div><div><br></div></div></div>
</font></span></div></div>
<br></div></div><span class="">______________________________<wbr>_________________<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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></span></blockquote></div><br></div>
</blockquote></div><br></div>