Dennis,
After the codes/script is modified according to
your suggestion, it works well.
(1) variable typing consistence
(2) lower/upper case
Yongzuo
________________________________________
From: Dennis Shea [shea@ucar.edu]
Sent: Wednesday, July 04, 2012 2:04 PM
To: Li, Yongzuo
Cc: ncl-talk@ucar.edu
Subject: Re: WRAPIT ncl fortran
[0] You are using NCL v5.1. This is 3+ years old.
Please upgrade to the v6.0.0 or, better, v6.1.0-beta
WRAPIT has changed.
--- I think there *is* an issue even with 6.1.0 and 6.1.0-beta [1] WRAPIT understands fortran's default typing (i,j,l,m,n => int) [2] The NCLFORTSTART an NCLEND delimeters should include *only* the variables being passed between NCL and fortran. Your stub file (NCLhwrf2sws90.stub) had C NCLFORTSTART subroutine NCLhwrf2sws(ny,mx,nsws,glon,glat,u,v,lon,lat,sws,uv) integer ny,mx,nsws integer j,i,m,jmin,imin real dsmin,dx,dy,ds,rad2deg dimension glon(ny,mx),glat(ny,mx),u(ny,mx),v(ny,mx) dimension lon(nsws),lat(nsws),sws(nsws),uv(nsws) C NCLEND The variables in the .stub file integer ny,mx,nsws integer j,i,m,jmin,imin are not being passed so they should not be listed. No harm is done but it is not clean. Since NCL understands fortran default typing, the following f77 stub is not consistent with the f90 declaration WRAPIT treats the following as integer due to fortran default typing dimension lon(nsws),lat(nsws),sws(nsws),uv(nsws) The f90 has real, intent(in) ::lon(nsws),lat(nsws),sws(nsws) The .stub file should be C NCLFORTSTART subroutine NCLhwrf2sws(ny,mx,nsws,glon,glat,u,v,lon,lat,sws,uv) integer ny,mx,nsws dimension glon(ny,mx),glat(ny,mx),u(ny,mx),v(ny,mx) real lon(nsws),lat(nsws),sws(nsws),uv(nsws) C NCLEND or, even better C NCLFORTSTART subroutine NCLhwrf2sws(ny,mx,nsws,glon,glat,u,v,lon,lat,sws,uv) implicit none integer ny,mx,nsws real glon(ny,mx),glat(ny,mx),u(ny,mx),v(ny,mx) real lon(nsws),lat(nsws),sws(nsws),uv(nsws) C NCLEND ===== Still, the above is *not* the issue. The issue seems to be with the mixed case (NCLhwrf2sws*) subroutine naming. NCL is upper and hwrf2sws is lower case. Not sure why!!! Fortran is not case sensitive so it must be with the information generated by the C interface created by WRAPIT. Note: This refers to the code, not the file names. Changing the following solves the problem: -- .stub file and .f90 subroutine NCLhwrf2sws ==> subroutine nclhwrf2sws -- NCL script external EX01 "./nclhwrf2sws90.so" EX01::NCLhwrf2sws(ny,mx,nsws,glon,glat,u,v,lon,lat,sws,uv) to EX01::nclhwrf2sws(ny,mx,nsws,glon,glat,u,v,lon,lat,sws,uv) --- Note that the file names do not have to change, just the internal naming: %> WRAPIT NCLhwrf2sws90.stub NCLhwrf2sws.f90 %> ncl ncl_fortran Good Luck On 7/3/12 5:37 PM, Li, Yongzuo wrote: > Hi, > > Attached is a Fortran 90 subroutine to be called by > ncl scrpit. > NCLhwrf2sws.so is created well. > > But the error is > > [yli@cirrus SFMR]$ ncl ncl_fortran.ncl > Copyright (C) 1995-2009 - All Rights Reserved > University Corporation for Atmospheric Research > NCAR Command Language Version 5.1.1 > The use of this software is governed by a License Agreement. > See http://www.ncl.ucar.edu/ for more details. > fatal:syntax error: procedure NCLhwrf2sws is not defined in package EX01 > > fatal:error at line 7 in file ncl_fortran.ncl > > fatal:Syntax Error in block, block not executed > fatal:error at line 10 in file ncl_fortran.ncl > > Any suggestion is welcome. > > Yongzuo > > > > _______________________________________________ > ncl-talk mailing list > List instructions, subscriber options, unsubscribe: > http://mailman.ucar.edu/mailman/listinfo/ncl-talk _______________________________________________ ncl-talk mailing list List instructions, subscriber options, unsubscribe: http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Wed Jul 4 13:48:25 2012
This archive was generated by hypermail 2.1.8 : Mon Jul 09 2012 - 10:45:32 MDT