Re: error form WRAPIT the fortran90 routine

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Sat, 29 Aug 2009 07:28:30 -0600

Try the attached f77 syntax stub file. All declaractions
start in column 7 and the comments beginning with the
"!" have been removed.

Good Luck

Xuguang Sun wrote:
> Dear everyone,
>
> I want to read station data into NCL by wrapping a fortran routine in NCL script, according to the introduction to WRAPIT, I finished WRAPIT processes, however I encountered an error when I run the ncl script, that is,
>
>> ncl rotEOF.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.
> At line 20 of file read-sta.NCL.f90
> Fortran runtime error: Invalid argument
>
> I checked the read-sta.NCL.f90 carefully and found no syntax error in it, and even I could successfully execute that routine independently. I don't know why the error comes out, hope get your help. Thanks.
>
> The following is my fortran routine, .stub file and also ncl script.
>
> 1. read-sta.NCL.f90
>
> ! read station data (sequential format)
>
> subroutine read_sta(infile,nyr,nsta,xlat,xlon,xrain)
> implicit none
> character(len=80), intent(in) :: infile !file name
> integer, intent(in) :: nyr !number of years
> integer, intent(in) :: nsta !number of station
> real, intent(out) :: xlat(nsta) !station latitude
> real, intent(out) :: xlon(nsta) !station longitude
> real, intent(out) :: xrain(nsta,nyr) !station variable
> integer :: iyr,ista,nflag,nlev
> real :: tim
> character(len=8) :: xid !station id
>
> open(1,file=infile,status='old',form='unformatted')
>
> do iyr = 1, nyr
> do ista = 1, nsta
> read(1)xid,xlat(ista),xlon(ista),tim,nlev,nflag,xrain(ista,iyr)
> end do
> read(1)
> end do
>
> close(1)
>
> return
> end subroutine read_sta
>
> 2. read-sta.NCL.stub
>
> C NCLFORTSTART
> subroutine read_sta(infile,nyr,nsta,xlat,xlon,xrain)
> character*(*) infile !file name
> integer nyr !number of years
> integer nsta !number of station
> dimension xlat(nsta) !station latitude
> dimension xlon(nsta) !station longitude
> dimension xrain(nsta,nyr) !station variable
> C NCLEND
>
> 3. ncl script
>
> external READ_STA "./read-sta.NCL.so"
>
> begin
>
> num_sta = 160 ;160 stations
> num_year = 57 ;57 years, from 1951-2007
>
> ;-------------------------------------
> ; open file and read station data
> ;-------------------------------------
> ifile = "R16051-07AnoJJA.stn"
>
> xlat = new(num_sta,"float") ;predefine station latitude
> xlon = new(num_sta,"float") ;predefine station longitude
> xrain = new((/num_year,num_sta/),"float") ;predefine station variable
>
> READ_STA::read_sta(ifile,num_year,num_sta,xlat,xlon,xrain)
>
> end
>
> Best regards,
> Xuguang
>
>
> ___________________________________________________________
> 好玩贺卡等你发,邮箱贺卡全新上线!
> http://card.mail.cn.yahoo.com/
> _______________________________________________
> 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 Sat Aug 29 2009 - 07:28:30 MDT

This archive was generated by hypermail 2.2.0 : Thu Sep 03 2009 - 07:55:08 MDT