[ncl-talk] WRAPIT, error in the fortran code

Dennis Shea shea at ucar.edu
Fri Dec 30 13:02:15 MST 2016


Forgot: NCL has some binning functions

http://www.ncl.ucar.edu/Applications/

Under "Data Analysis" ... click "Binning"

See the examples. They use the following functions:

http://www.ncl.ucar.edu/Document/Functions/Built-in/bin_sum.shtml
http://www.ncl.ucar.edu/Document/Functions/Built-in/bin_avg.shtml

On Fri, Dec 30, 2016 at 12:31 PM, Dennis Shea <shea at ucar.edu> wrote:

> 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.
>
> WRAPIT does not understand fortran 'dynamic' 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.
>
> That sadi:
>
> I speculate that the issue is the 'nbin-1' id the array declarations.
> Maybe, add and 'nbin1' argument where
>      nbin1 = nbin-1
> and make the stub file be
>
> C NCLFORTSTART
>         subroutine wacftd(nxx,nyx,nkx,ntx,nbin,nbin1, wa,bfra)
>         integer nxx,nyx,nkx,ntx,nbin, nbin1
>         real wa(nxx,nyx,nkx,ntx)                    ! input variable
>
> c c c real bins(ntx,nbin),bcnt(ntx,nbin-1), bfra(ntx,nbin-1)
>         real  bfra(ntx,nbin1)                           ! return variable
> C NCLEND
> C WRAPIT will not look at the following.
>        integer npts
>        real bins(ntx,nbin), bcnt(ntx,nbin-1)    ! local  ... fortran
> compiler handles this
>
>        npts = nxx*nyx*nkx
>
> This would have to be added to the NCL script calling the subroutine as a
> shared object.
> Further, variable 'bins' is not being passed to-from the NCL script. I can
> an
>
> ---
> Re: PARAMETER statements
>
> WRAPIT  strictly looks at the arguments being passed between NCL (written
> in C) and the fortran subroutine. The types and sizes must match.
>
> C NCLFORTSTART
>         subroutine fooo(nxx,nyx,nkx,ntx,nbin, ........wa,.....)
>         integer nxx,nyx,nkx,ntx,nbin, nbin1
>         real wa(nxx,nyx,nkx,ntx)                    ! input variable
> C NCLEND
>         integer ii, jj                           ! WRAPIT does not care
> about the following
>         parameter (ii=30, jj=999)     ! baecause they are not passed into
> or out the subroutine
>         double precision work(ii,jj)
>
> ---
>
>
> You do not have to have a stub file. A minor rearrangement
>
>
> C NCLFORTSTART
>         subroutine wacftd(nxx,nyx,nkx,ntx,nbin,nbin1, wa,bfra)
>         integer nxx,nyx,nkx,ntx,nbin, nbin1
>         real wa(nxx,nyx,nkx,ntx)                    ! input variable
>         real  bfra(ntx,nbin1)                           ! return variable
> C NCLEND
>        real bins(ntx,nbin),bcnt(ntx,nbin-1)
>
>
>
> Good luck
>
>
>
>
>
>
> On Fri, Dec 30, 2016 at 11:33 AM, Ying Song <ysong4 at slu.edu> wrote:
>
>> Hello,
>>
>> I am using WRAPIT in NCL to calculate velocity frequency, following the
>> ex01. After running the command:
>> WRAPIT cftd.stub cftd.f
>> The error shows below:
>> ++++++++++++++++++++
>> WRAPIT Version: 120209
>> A syntax error occurred while parsing: 1
>> COMPILING cftd.f
>> LINKING
>> END WRAPIT
>> ++++++++++++++++++++
>> 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!
>>
>> cftd.f and cftd.stub are attached. Thank you very much!
>>
>> --
>> Ying Song, PhD, Post Doctoral Fellow
>> Department of Earth and Atmospheric Sciences
>> Saint Louis University
>>
>> ysong4 at slu.edu
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161230/1dae0e78/attachment.html 


More information about the ncl-talk mailing list