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

Home » Public Forums » archive » Re: Lots of files
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: Lots of files [message #53136 is a reply to message #53040] Sat, 17 March 2007 20:59 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Lasse Clausen writes:

> Well thanks, that works, however it did not bring the speed boost I
> had hoped for. So I had another thought: Actually, all data is one
> line, not in one line per station as I said earlier. But I know that
> each data set is 1440 characters long, so here is the outline of my
> code, after I opened all the files:
>
> info = file_info(input_filename)
> lines = info.size/1440L
>
> for i=0L, lines-1L do begin
> point_lun, fin, i*1440L
> readf, fin, line, format='(A1440)'
> ; extracting station name
> hstat = strlowcase(strmid(line, 12, 3))
> ; find correct file unit
> tmp = where(stats eq hstat)
> printf, tmp[0]+1, line
> endfor

Well lots of string processing and WHERE's going
on here, which I think is what is slowing things
down. How about something like this:

theLines = Assoc(lun, BytArr(1440))
maxYear = Max(stats)
for I=0L, lines-1L do begin
aLine = theLines[I]
; extracting station name
hstat = String(aLine[12:15])
; find correct file unit
printf, (maxYear-hstat)+1, String(aLine)
endfor

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
Previous Topic: Re: mosaic_doit : the ghost
Next Topic: replicating arrays

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

Current Time: Sat Oct 18 02:04:42 PDT 2025

Total time taken to generate the page: 2.31991 seconds