[ncl-talk] Fortran 90 extension with wrapit

Mary Haley haley at ucar.edu
Fri Dec 1 08:45:20 MST 2017


Hi Marston,

A tip: you can add the "-d" option to WRAPIT to get some really verbose
output. This helped me see that it was this step that was causing the
warning:

wrapit77 < binning_statsF90.stub > WRAPIT.c

I took a look at binning_statsF90.stub and saw two issues.
[1] There are certain rules about a stub file used with WRAPIT. One is that
the "C NCLFORTSTART" and "C NCLEND" lines must start in the first column:

C NCLFORTSTART
       subroutine bin_stats(sf,nlat,nlon,missing,tb_bins,ntb_bins,
. . .
C NCLEND


[2] The "+" continuation character is starting in column 7. These have to
be in column 6. This is a Fortran 77 rule. To fix, simply remove one space
before the "+":

C NCLFORTSTART
       subroutine bin_stats(sf,nlat,nlon,missing,tb_bins,ntb_bins,
     +     ntb_binsc,lat_bins,nlat_bins,nlat_binsc,gbin,lsm,
     +     lat2d,outbin,outbin2)
       integer j,tb,la,jl,jk
       integer nlat_bins,ntb_bins,nlat_binsc,ntb_binsc
       integer tb_bins(ntb_bins)
       integer lat_bins(nlat_bins)
       integer nlat,nlon,sf
       real    missing
       real    gbin(nlat,nlon),lsm(nlat,nlon),lat2d(nlat,nlon)
       real    outbin(sf,ntb_binsc),
     + outbin2(sf,nlat_binsc,ntb_binsc)
C NCLEND

--Mary

On Fri, Dec 1, 2017 at 5:59 AM, Marston Ward <marston.johnston at gu.se> wrote:

> Hi,
>
> I’ve written a F90 routine to do some heavy calculations within NCL.
> I’ve followed the instructions on how to write the “stub” file:
> https://www.ncl.ucar.edu/Document/Tools/WRAPIT.shtml#FixingCommonProblems
> ,
> how to make sure there are no stray characters in code, as well as made
> sure the routine compiles as a standalone.
> However, when I run WRAPIT -in  stubfile myfile.F90 I get the following,
> despite that the SO file is created. I’ve not yet check the SO file but
> wanted to
> check with the NCL experts with experience in F90 routines and WRAPIT.
> My files are attached and here is the error message when compiling (which
> is not much to go on):
>
> $ WRAPIT -in binning_statsF90.stub binning_stats.F90
>
> WRAPIT Version: 120209
> /software/apps/comp_wrapper/intel/ifort
> A syntax error occurred while parsing:
> COMPILING binning_stats.F90
> LINKING
> END WRAPIT
>
> Would appreciate some thoughts on what’s going on. Just to reiterate a
> bit. I’ve gone through the trouble shooting part of the doc and made sure
> I’ve not made some mistakes that WRAPIT can’t handle, but fortran can.
>
> /M
>
> *Marston S. Ward*
>
> _______________________________________________
> 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/20171201/59b2f0db/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: binning_statsF90_fixed.stub
Type: application/octet-stream
Size: 528 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171201/59b2f0db/attachment.obj>


More information about the ncl-talk mailing list