[ncl-talk] 转发: 回复: Re: call Fortran in NCL
易路
dg1225033 at smail.nju.edu.cn
Mon Dec 8 20:22:15 MST 2014
----- 转发邮件 -----
发件人: 易路 <dg1225033 at smail.nju.edu.cn>
收件人: Dennis Shea <shea at ucar.edu>
已发送邮件: Tue, 09 Dec 2014 11:21:15 +0800 (CST)
主题: 回复: Re: [ncl-talk] call Fortran in NCL
Thanks very much for your remind of statements must starting in column 7, but it still show error:
A syntax error occurred while parsing:
COMPILING getlatlon.f90
END WRAPIT
would you please help me check it again? Thanks a lot!
----- 原始邮件 -----
发件人: Dennis Shea <shea at ucar.edu>
收件人: 易路 <dg1225033 at smail.nju.edu.cn>
抄送: ncl-talk at ucar.edu
已发送邮件: Tue, 09 Dec 2014 01:25:12 +0800 (CST)
主题: Re: [ncl-talk] call Fortran in NCL
Remember f77 requires that statements must start in column 7.
Your SUBROUTINE statement started befor column 7.
I've made a 2nd stub file to illustrate how to include
a more general CHARACTER declaration.
===> foo.stub
C NCLFORTSTART
SUBROUTINE getlatlon (infile,nx,ny,ii,iilat,iilon)
CHARACTER*80 infile
INTEGER nx,ny,ii
REAL iilat,iilon
C NCLEND
C NCLFORTSTART
SUBROUTINE getlatlon1(infile,nx,ny,ii,iilat,iilon)
CHARACTER*(*) infile
INTEGER nx,ny,ii
REAL iilat,iilon
C NCLEND
=====
WRAPIT foo.stub
WRAPIT Version: 120209
LINKING
END WRAPIT
On Mon, Dec 8, 2014 at 9:06 AM, 易路 <dg1225033 at smail.nju.edu.cn> wrote:
> Hi all,
> I want to call Fortran in NCL to read in data, but it shows errors while
> run WRAPIT, would you please help me find out the resons?
>
> error1 ,while WRAPTI getlatlon.stub getlatlon.f90,shows:
> A syntax error occurred while parsing:
> LINKING
> END WRAPIT
>
> erro2, while run ncl getlatlon.ncl
>
> warning:Could not find Init() in external file ./getlatlon.so, file
> not loaded
> warning:error at line 2 in file getlatlon.ncl
>
> fatal:syntax error: line 10 in file getlatlon.ncl before or near :
> GETLATLON_SO:
> ----------------^
>
> fatal:error in statement
> fatal:Syntax Error in block, block not executed
> fatal:error at line 16 in file getlatlon.ncl
> ***********fortran program**************
> subroutine getlatlon (infile,nx,ny,ii,iilat,iilon)
> implicit none
> character*80 infile
> integer:: nx,ny,ii,i,j
> real:: iilat, iilon
> real,allocatable::latlon(:,:)
>
> open(10,file=infile,status='old')
>
> allocate(latlon(nx,ny))
> do j=1,ny
> read(10,*)(latlon(i,j),i=1,nx)
> end do
>
> iilat=latlon(1,ii)
> iilon=latlon(2,ii)
>
> close(10)
> return
> end subroutine
> *************************stub file************************
> C NCLFORTSTART
> SUBROUTINE getlatlon (infile,nx,ny,ii,iilat,iilon)
> CHARACTER*80 infile
> INTEGER nx,ny,ii
> REAL iilat,iilon
> C NCLEND
>
> ********************NCL file********************************
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> external GETLATLON_SO "./getlatlon.so"
>
> begin
> infile ="./station.txt"
> nx=2
> ny=60
> do ii=1,ny
>
> GETLATLON_SO::getlatlon(infile,nx,ny,ii,iilat,iilon)
> print(iilat)
> print(iilon)
>
> end do
>
> end
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getlatlon.f90
Type: text/x-fortran
Size: 428 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141209/5a2df17f/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getlatlon.stub
Type: application/octet-stream
Size: 155 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141209/5a2df17f/attachment.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getlatlon.ncl
Type: application/octet-stream
Size: 256 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141209/5a2df17f/attachment-0001.obj
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: station.txt
Url: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141209/5a2df17f/attachment.txt
More information about the ncl-talk
mailing list