Re: calling fortran subroutine from NCL

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu Mar 28 2013 - 13:51:49 MDT

The stub file is incorrect. Specifically, the lines

         REAL, DIMENSION(51,51),INTENT(IN) ::A
         INTEGER:I,J

the
    REAL, DIMENSION(51,51),INTENT(IN) ::A
is totally f90. This is not f77 syntax

I am not quite sure what the following is :-)
    INTEGER:I,J
It is neither f90 or f77 syntax. f90 would require ::
=============================================
Further, I am not sure why the INTEGER I,J is present.
These are not being passed between NCL and the fortran code.

The following is f77 syntax

C NCLFORTSTART
         SUBROUTINE WFILE(A)
         REAL A(51,51)
C NCLEND

WRAPIT write_fil.stub write_fil.f90

should work just fine.

Good Luck
D

On 3/28/13 12:01 PM, Rick Brownrigg wrote:
> Hi,
>
> I can reproduce the error locally. I've got it narrowed down as to where it happens, but I don't know why yet. We'll look into it more.
>
> However, it looks like its somewhat benign, in that from the debugging trace (-d switch to WRAPIT), *your* files get compiled without error and a "write_fil.so" shared-library is produced. Have you tried running your ncl script to process your WRF file?
>
> Hope that helps,
> Rick
>
>
> On Mar 28, 2013, at 2:27 AM, sangeeta maharjan <sangeetamaharjan@gmail.com> wrote:
>
>> Hi all,
>> I am planning to write variable of wrf output file into text file. For
>> this I wrote subroutine in Fortran 90 format and ncl script too. They
>> are write_fil.f90, write_fil stub and write_fil.ncl.
>>
>> write_fil.f90
>>
>> SUBROUTINE WFILE(A)
>>
>> IMPLICIT NONE
>> REAL,DIMENSION(51,51),INTENT(IN)::A
>> INTEGER::I,J
>> OPEN(UNIT=12,FILE="STORE.TXT",STATUS="NEW",FORM="FORMATTED")
>> WRITE(12,'(51F15.4)')((A(I,J),I=1,51),J=51,1,-1)
>>
>>
>> END SUBROUTINE WFILE
>>
>>
>> write_fil.stub
>>
>> C NCLFORTSTART
>>
>> SUBROUTINE WFILE(A)
>> REAL, DIMENSION(51,51),INTENT(IN) ::A
>> INTEGER:I,J
>> C NCLEND
>>
>> write_fil.ncl
>>
>> external WRITE_FIL "./write_fil.so"
>>
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>>
>> begin
>>
>> f = addfile("/root/Desktop/TWAS/KTM_OUT/wrfout_d03_2012-04-26_00:00:00.nc",
>> "r")
>>
>> Zter = wrf_user_getvar(f,"ter",1)
>>
>> WRITE_FIL::WFILE(Zter)
>> end
>>
>>
>> On giving command,I got
>> [root@nepal WRF]# WRAPIT write_fil.stub write_fil.f90
>>
>> WRAPIT Version: 120209
>> A syntax error occurred while parsing: ,
>> COMPILING write_fil.f90
>> LINKING
>> END WRAPIT
>>
>> I would appreciate any help on this.
>>
>> Sangeeta Maharjan.
>> _______________________________________________
>> 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-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Mar 28 13:51:57 2013

This archive was generated by hypermail 2.1.8 : Tue Apr 02 2013 - 21:23:48 MDT