[gradsusr] writing out data in fortran

Meg Sutton mcs2214 at columbia.edu
Fri Aug 26 10:23:20 EDT 2011


Hi gradusers,
I am trying to write out my .tsv file to a format grads can read. The program is:

PROGRAM y
 INTEGER, PARAMETER  :: m1=21 ! - number of longitudes -
 INTEGER, PARAMETER  :: m2=31 ! - number of latitudes -
 INTEGER, PARAMETER  :: n=3  ! - number of years -
 REAL :: x(m1,m2,n)
 OPEN (UNIT=31,FILE='file1.txt',FORM='formatted')
 READ (UNIT=31,FMT=*)
 READ (UNIT=31,FMT=*)
 DO k=1,n
    READ (UNIT=31,FMT=*)
    READ (UNIT=31,FMT=*)
    READ (UNIT=31,FMT=*) ((x(j,i,k),j=1,m1),i=1,m2)
 END DO
 CLOSE (UNIT=31)
 OPEN (UNIT=31,FILE='file2',ACCESS='direct',RECL=m1*m2*4,FORM='unformatted')
 DO k=1,n
    WRITE (UNIT=31,REC=k) ((x(j,i,k),j=1,m1),i=1,m2)
 END DO
 CLOSE (UNIT=31)
END PROGRAM y


when I run it and try to write it out it gives me the following error on line 12
"fortran runtime error: Bad real number in item 1 of list input" 

Does anyone have any ideas?

Best, 
Meg







More information about the gradsusr mailing list