[ncl-talk] Using Wrapit

Mary Haley haley at ucar.edu
Mon Oct 24 13:16:42 MDT 2016


​Barry,

Please see the WRAPIT documentation at:

http://www.ncl.ucar.edu/Document/Tools/WRAPIT.shtml

There are several examples there to help you get started.

The issue is that the line:

C NCLFORTSTART

needs to be *before* the SUBROUTINE line.

Also, I suggest putting the "C NCLEND" line before all your local variables:

C NCLFORTSTART


      SUBROUTINE sort(n,arr,arr_i,arr_j)
      INTEGER n
      REAL arr(n)
      INTEGER arr_i(n),arr_j(n)
C NCLEND


      INTEGER M,NSTACK
      PARAMETER (M=7,NSTACK=50)
      INTEGER i,ir,j,jstack,k,l,istack(NSTACK)
      REAL a,temp,b,c,a_i,a_j,temp_i,temp_j

Finally, I caution against calling your subroutine "sort". This is a common
name for a function / procedure in many languages, and could cause a
conflict.  I suggest renaming it to something unique, like "mysort".

--Mary
​

On Mon, Oct 24, 2016 at 12:44 PM, Barry Lynn <barry.h.lynn at gmail.com> wrote:

> Hi:
>
> I believe that I have followed the instructions in trying use wrapit and
> in adding the external statement to sort.so
>
> Copyright (C) 1995-2014 - All Rights Reserved
>  University Corporation for Atmospheric Research
>  NCAR Command Language Version 6.2.1
>  The use of this software is governed by a License Agreement.
>  See http://www.ncl.ucar.edu/ for more details.
> *warning:Could not find Init() in external file ./sort.so, file not loaded*
> warning:error at line 8 in file ./wrf_loop_radar_1.3km.ncl
>
>
> Here is the top of the sort program
>
>       SUBROUTINE sort(n,arr,arr_i,arr_j)
> C NCLFORTSTART
>       INTEGER n
>       REAL arr(n)
>       INTEGER arr_i(n),arr_j(n)
>       INTEGER M,NSTACK
>       PARAMETER (M=7,NSTACK=50)
>       INTEGER i,ir,j,jstack,k,l,istack(NSTACK)
>       REAL a,temp,b,c,a_i,a_j,temp_i,temp_j
> C NCLEND
>
> Here is what I get when I run WRAPIT sort.f
>
> [wrf at mn03 NCL-TEMP3]$ WRAPIT sort.f
>
> WRAPIT Version: 120209
> A* syntax error occurred while parsing: n  (Not sure what this error
> message is).*
> COMPILING sort.f
> LINKING
> END WRAPIT
>
> [wrf at mn03 NCL-TEMP3]$ ls -ltr *.so
> -rwxr-xr-x. 1 wrf games 6507 Oct 24 20:34 sort.so
> [wrf at mn03 NCL-TEMP3]$
>
> Here is the top of my ncl program.
>
> ;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> ;load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> ;load "WRFOptions.ncl"     ; set basic plot options here
> ;load "gsn_code.ncl"
> ;load "WRFPlot.ncl"
> ;load "WRFUserARW.ncl"
> ;load "SkewTFunc.ncl"
> *external SORT "./sort.so"*
>  begin
>
>
> Thank you.
>
> --
> 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
>
> _______________________________________________
> 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/20161024/6507758f/attachment.html 


More information about the ncl-talk mailing list