error form WRAPIT the fortran90 routine

From: Xuguang Sun <sunxg007_at_nyahnyahspammersnyahnyah>
Date: Sat, 29 Aug 2009 06:10:08 -0700 (PDT)

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 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


  do iyr = 1, nyr
   do ista = 1, nsta
   end do
  end do


end subroutine read_sta

2. read-sta.NCL.stub

  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

3. ncl script

external READ_STA "./"


  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



Best regards,

ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
Received on Sat Aug 29 2009 - 07:10:08 MDT

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