comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: read multiple files with varying names
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: read multiple files with varying names [message #66643 is a reply to message #66601] Fri, 29 May 2009 06:15 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
sophie.hoss@gmail.com writes:

> Jean, thanks for that, but I'm still stuck with the same problem no
> matter how I do it. I cut the code short to
>
> CD, 'filepath'
> ci_files = FILE_SEARCH('ci*', COUNT=3Dnum_ci_files_found)
>
> for i = 0,(num_ci_files_found-1) do begin
>
> file = ci_files(i)
> rows = File_Lines(file)
> OpenR, lun, file, /Get_Lun
> header = StrArr(34)
> ReadF, lun, header
> Point_Lun, -lun, currentLocation
> data = strarr(12, rows-(n_elements(header))); i know there's 12 cols
> readF, lun, data
>
> ; from here on I want to extract one column only and
> save this column (radiation data from one station for one month) in a
> file where I later add values from all other stations for this
> specific month, then take the average from all stations over the whole
> month)
>
> --> READF: End of file encountered.

What this means is that you are trying to read data past the
end of the file. In other words, you are trying to read more
data than is actually in the file. In practical terms, it is
likely the number of rows is wrong, as you seem sure about the
number of columns.

Programs that count the number of rows in a file, such as FILE_LINES,
actually just counts the number of "end of line" characters found in
the file. This is an inexact science. Your data file may not have
an end-of-line character on the last line of the file. In which case,
FILE_LINES will report one less line that you actually have in the
file (not your problem here). Or, there may be extra, blank lines,
in the file (usually at the end of the file). Then, FILE_LINES would
report *more* lines than there are lines with actual data on them.
In which case you would try to read more data that exists and you
would get this error. This seems the most likely explanation to me. :-)

It may be you have to do some "conditioning" of your data files before
you try to read them.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Am I having a blackout?
Next Topic: How to extract latitude and longitude information from HDF file?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 06:11:31 PDT 2025

Total time taken to generate the page: 0.00196 seconds