# [ncl-talk] A question about "return" from WRAPIT

Barry Lynn barry.h.lynn at gmail.com
Tue Jul 11 13:21:19 MDT 2017

I realize that the background information was a bit vague.

In any case, thank you for confirming what I thought.

I was able to verify that the fortran code executed until the "return."
However, it doesn't proceed to write a print statement in the NCL script
immediately after the call to the WRAPIT fortran program. Hence, my thought
that it was *not* "returning."

I will double check the code (perhaps simplify it), since you noted that
the code should return.

Barry

On Tue, Jul 11, 2017 at 9:20 PM, Dennis Shea <shea at ucar.edu> wrote:

> The question is a bit vague on details.
>
> Yes, the fortran code 'returns' to the NCL calling environment.
> You can put print statements in the fortran code to see what has executed.
>
>
>
> C NCLFORTSTART
>       implicit none
>       integer nq              ! input
>       real a, b, c, x(nq)     ! input
>       real quad(nq)           ! output; must be pre-allocated in NCL
> C NCLEND
> C
> C  Calculate quadratic polynomial values.
> C
>
>       print *,"Before do loop"    ! DEBUG
>
>       do i=1,nq
>          quad(i) = a*x(i)**2 + b*x(i) + c
>       end do
>       print *,"Before return: Done!"    ! DEBUG
>       return
>       end
>
> =====
>
>
> ====
>
> NCL script: example.ncl
> ===
>
>
>
> begin
> ;
> ; Calculate three values of a quadratic equation
> ;
>    nump = 3
>    x    = (/ -1., 0.0, 1.0 /)
>    qval = new(nump,float)                  ; create memory for the 'return' values
>    QUAD::cquad(-1., 2., 3., nump, x, qval) ; Call the NCL version of
>    print("Polynomial value = " + qval)     ; Should be (/0,3,4/)
>
> end
>
> ====
>
> %> ncl  example.ncl
>
>
> On Tue, Jul 11, 2017 at 9:11 AM, Barry Lynn <barry.h.lynn at gmail.com>
> wrote:
>
>> Hello:
>>
>> I wrote a fortran program that I can from an ncl program.
>>
>> I have a "return" at the end of the fortran program, linked with WRAPIT.
>>
>> However, my ncl program does not go beyond the call to the
>> WRAPIT fortran program call.
>>
>> Am I missing something?  I would expect the ncl program to return
>> and continue from there.
>>
>> Thank you,
>>
>> Barry
>>
>> --
>> Barry H. Lynn, Ph.D
>> Senior Lecturer,
>> The Institute of the Earth Science,
>> The Hebrew University of Jerusalem,
>> Givat Ram, Jerusalem 91904, Israel
>> Tel: 972 547 231 170
>> Fax: (972)-25662581
>>
>> C.E.O, Weather It Is, LTD
>> Weather and Climate Focus
>> http://weather-it-is.com
>> Jerusalem, Israel
>> Local: 02 930 9525
>> Cell: 054 7 231 170
>> Int-IS: x972 2 930 9525
>> US 914 432 3108 <(914)%20432-3108>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>

--
Barry H. Lynn, Ph.D
Senior Lecturer,
The Institute of the Earth Science,
The Hebrew University of Jerusalem,
Givat Ram, Jerusalem 91904, Israel
Tel: 972 547 231 170
Fax: (972)-25662581

C.E.O, Weather It Is, LTD
Weather and Climate Focus
http://weather-it-is.com
Jerusalem, Israel
Local: 02 930 9525
Cell: 054 7 231 170
Int-IS: x972 2 930 9525
US 914 432 3108
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170711/3d535ff9/attachment.html