I am having a read issue in Fortran 90. I am attempting to read 31488 rows of data. I am using the Portland Group Fortran 90 compiler.
My error message is this:
PGFIO-F-217/list-directed read/unit=14/attempt to read past end of file. File name = /import/c/w/username/WRFV3/SKILLSETS/Overestimations.txt formatted, sequential access record = 31489
The Fortran program thinks that I have an extra row. I do not know where that is indicated in the code.
I have attached the relevant part of the code... I have searched high and low through this part of the code, I have investigated the text file to see if the number of rows match. I absolutely do not see where the problem lies.
The compiler states that the error is located in the read statement... at read(14,*), that line of the code, within the do statements.
Please help. Thank you very much.
Program skillruss
! Purpose: to calculate skill scores
implicit none
integer :: i,j,nsite,ntime,iref,jj,csite
! nsite = number of observation sites, csites = number of chemical sites, ntime = number of hours
parameter(nsite=32,csite=1,ntime=984)
real :: Tob(nsite,ntime),RHo(nsite,ntime),diro(nsite,ntime)
real :: raino(nsite,ntime),swo(nsite,ntime),po(nsite,ntime)
real :: Tdo(nsite,ntime),vo(nsite,ntime)
real :: Ts(nsite,ntime),RHs(nsite,ntime),dirs(nsite,ntime)
real :: rains(nsite,ntime),sws(nsite,ntime),ps(nsite,ntime)
real :: Tds(nsite,ntime),vs(nsite,ntime)
real :: PMo(csite,ntime),PMs(csite,ntime)
real :: pers(csite,ntime)
real :: bias,rmse,sde,r,x,y,sx,sy,dw,isig
real :: countn
real :: nrmse,fac2,nstdev,mg,fb,nmse
real :: biast(ntime),rmset(ntime),sdet(ntime)
real :: rt(ntime),xt(ntime),yt(ntime)
real :: sxt(ntime),syt(ntime),isigt(ntime),countt(ntime),dt(ntime)
! Open file to read the observational data
open(14,file=&
"/import/c/w/username/WRFV3/SKILLSETS/Overestimations.txt",&
form="formatted",status="old")
Tob= -999.
RHo= -999.
vo= -999.
diro= -999.
raino= -999.
swo= -999.
po= -999.
Tdo= -999.
do i=1,nsite
do j=1,ntime
read(14,*) Tob(i,j),RHo(i,j),vo(i,j),diro(i,j),raino(i,j),swo(i,j),&
po(i,j),Tdo(i,j)
if(vo(i,j) <=0.)diro(i,j)=-999.
end do
end do
close(14)