[ncl-talk] WRAPIT error : Syntax error occured while parsing

Alan Brammer abrammer at albany.edu
Wed Jan 17 20:56:04 MST 2018


Hi Sai,

I've gone through and made edits as I've detailed below.  I haven't tried
to work out what the code is doing, so go through and double check the
differences between my files and your originals, to both learn for the next
time and to check I didn't make a silly mistake.

The stub has to be formatted a little different to how you have it.
There's extensive docs on each aspect here:
https://www.ncl.ucar.edu/Document/Tools/WRAPIT.shtml#SpecialConsiderations

Firstly you only need the variables that NCL will deal with in the stub, so
you can cut out half the lines straight away.
You also want to drop the intents and go to a more simplistic F77 style of
declaring variables.
Lastly and most difficult to fix, you want to change the Array indexing of
the input and output variables.
See here:
https://www.ncl.ucar.edu/Document/Tools/WRAPIT.shtml#ArrayIndexing

I set up a quick driver subroutine at the bottom of the F90 file which
calls the original now renamed subroutine.
To get around the array indexing issue, I've added three variables to the
list of arguments which you can see in the stub or in the short subroutine
at the bottom.
The alternate way would be to edit the original code so the loops are all 1
to dimension length, but there's a probably a reason to not do that.

external hb01 "./HBFILTER.so"

original call  e.g.
      hb01::hbfilter (input,output,nmax, start_z,end_z,  ids,ide, jds,jde,
ims,ime, jms,jme )

new call e.g.
      hb01::hbfilter (input,output,nmax, start_z,end_z, (end_z-start_z),
 ids,ide, jds,jde, ims,ime,(ime-ims), jms,jme, (jme-jms) )


Big disclaimer, I'm not a fortran expert but have wrapped many programs
like this into NCL so have some experience.


Good luck,

Alan

On Wed, Jan 17, 2018 at 6:16 PM, Prashanth Bhalachandran via ncl-talk <
ncl-talk at ucar.edu> wrote:

> Hello NCL’ers,
>
> I have a Fortran 90 subroutine (attached to this email) that I am trying
> to wrap and use in NCL here. However, I am getting the following error
> before it proceeds to create the .so file. I must confess that I am not
> very good with Fortran and I’m simply unable to spot where this error is
> stemming from. I am afraid it’s one of the F90 syntaxes that I am unaware
> of. Can one of you please guide me and tell me how to get this to compile
> without any errors?
>
>
>
> Thank you,
>
> Sai
>
>
>
> Error message:
>
> WRAPIT HBFILTER.stub  HBFILTER.F90
>
> WRAPIT Version: 120209
>
> A syntax error occurred while parsing: ,
>
> COMPILING HBFILTER.F90
>
> LINKING
>
> END WRAPIT
>
>
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows 10
>
>
>
> _______________________________________________
> 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/20180117/cfeb11b5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HBFILTER.stub
Type: application/octet-stream
Size: 574 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180117/cfeb11b5/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HBFILTER.F90
Type: application/octet-stream
Size: 3959 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180117/cfeb11b5/attachment-0001.obj>


More information about the ncl-talk mailing list