I made a Fortan routine to read a weather file into my program. This file contains 2 header lines and then lines of data for every 10 minutes and is therefor 52562 lines long.
When reading the file with the code below it returns the error Fortran runtime error: End of file
for i = 52548
in the do
-loop.
bdst=600
allocate(clidat(int(3.1536d7/bdst),15))
open(2001,file='church_10m.cli',action='read')
read(2001,*); read(2001,*)
do i=1,size(clidat,1)
read(2001,*) clidat(i,:)
enddo
close(2001);
The file used can be found using this public dropbox link: church_10m.cli. I checked and the file does contain the 52562 lines. The line corresponding to i = 52548
is the last line of the file. The line corresponding to i=1
is the third line of the file (which starts with 0). So I suspect that some lines are skipped in between. Any thoughts why this happens?
If a line doesn't contain 15 values (the size of clidat
) the read statement just goes to the next line and reads the next values. There were a couple of lines in the church_10m.cli
file that didn't have enough values. (for example line 1957
).
This was a result of the conversion from an excel file to a txt file.