<div dir="ltr"><div><div><div><div>Remember f77 requires that statements must start in column 7.<br><br></div>Your SUBROUTINE statement started befor column 7.<br></div>I've made a 2nd stub file to illustrate how to include<br></div>a more general CHARACTER declaration.<br><br></div>===> foo.stub<br><div><div><div><div><div><br>C NCLFORTSTART<br> SUBROUTINE getlatlon (infile,nx,ny,ii,iilat,iilon)<br> CHARACTER*80 infile<br> INTEGER nx,ny,ii<br> REAL iilat,iilon<br>C NCLEND<br>C NCLFORTSTART<br> SUBROUTINE getlatlon1(infile,nx,ny,ii,iilat,iilon)<br> CHARACTER*(*) infile<br> INTEGER nx,ny,ii<br> REAL iilat,iilon<br>C NCLEND<br><br>=====<br><br>WRAPIT foo.stub<br> <br>WRAPIT Version: 120209<br>LINKING<br>END WRAPIT<br><br><br></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 8, 2014 at 9:06 AM, 易路 <span dir="ltr"><<a href="mailto:dg1225033@smail.nju.edu.cn" target="_blank">dg1225033@smail.nju.edu.cn</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
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?<br>
<br>
error1 ,while WRAPTI getlatlon.stub getlatlon.f90,shows:<br>
A syntax error occurred while parsing:<br>
LINKING<br>
END WRAPIT<br>
<br>
erro2, while run ncl getlatlon.ncl<br>
<br>
warning:Could not find Init() in external file ./getlatlon.so, file not loaded<br>
warning:error at line 2 in file getlatlon.ncl<br>
<br>
fatal:syntax error: line 10 in file getlatlon.ncl before or near :<br>
GETLATLON_SO:<br>
----------------^<br>
<br>
fatal:error in statement<br>
fatal:Syntax Error in block, block not executed<br>
fatal:error at line 16 in file getlatlon.ncl<br>
***********fortran program**************<br>
subroutine getlatlon (infile,nx,ny,ii,iilat,iilon)<br>
implicit none<br>
character*80 infile<br>
integer:: nx,ny,ii,i,j<br>
real:: iilat, iilon<br>
real,allocatable::latlon(:,:)<br>
<br>
open(10,file=infile,status='old')<br>
<br>
allocate(latlon(nx,ny))<br>
do j=1,ny<br>
read(10,*)(latlon(i,j),i=1,nx)<br>
end do<br>
<br>
iilat=latlon(1,ii)<br>
iilon=latlon(2,ii)<br>
<br>
close(10)<br>
return<br>
end subroutine<br>
*************************stub file************************<br>
C NCLFORTSTART<br>
SUBROUTINE getlatlon (infile,nx,ny,ii,iilat,iilon)<br>
CHARACTER*80 infile<br>
INTEGER nx,ny,ii<br>
REAL iilat,iilon<br>
C NCLEND<br>
<br>
********************NCL file********************************<br>
<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
external GETLATLON_SO "./getlatlon.so"<br>
<br>
begin<br>
infile ="./station.txt"<br>
nx=2<br>
ny=60<br>
do ii=1,ny<br>
<br>
GETLATLON_SO::getlatlon(infile,nx,ny,ii,iilat,iilon)<br>
print(iilat)<br>
print(iilon)<br>
<br>
end do<br>
<br>
end<br>
_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote></div><br></div>