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

Home » Public Forums » archive » Re: what to make of read_interfile.pro ?
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: what to make of read_interfile.pro ? [message #63255 is a reply to message #63128] Wed, 29 October 2008 17:41 Go to previous message
Robbie is currently offline  Robbie
Messages: 165
Registered: February 2006
Senior Member
I did come up with an incredibly simplistic way to read a "flat"
interfile header.
I just use keywords to represent each entry.

; Example:
; interfile_readkey, '2001cntrate_13.s.hdr', STUDY_DATE_DD_MM_YRYR=a
pro interfile_readkey, filename, _REF_EXTRA=ex
openr, lun, filename, /GET_LUN
line = ""
while (~ EOF(lun)) do begin
readf, lun, line
if ((line ne '') && (STRMID(Line,0,1) ne ';')) then begin
if (STRMID(Line,0,1) eq '!') then line = STRMID(Line,1)
if (STRMID(Line,0,1) eq '%') then line = STRMID(Line,
1)
KeyEnd = STRPOS(Line, ":=")
if (KeyEnd ge 0) then begin
count = 0l
Kwd = strjoin(strsplit(strupcase(strtrim(stRMID(Line,
0,KeyEnd),2)),' [],=()/:',/EXTRACT),'_')
; print, kwd
if (n_elements(ex) gt 0) then $
inds = where(kwd eq ex,count)
if (count gt 0) then $
(SCOPE_VARFETCH(kwd, /REF_EXTRA)) = strtrim(stRMID(Line,
KeyEnd+2),2)
endif
endif
endwhile
free_lun, lun
end
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: array dimension change
Next Topic: About warp image on ENVI's pts file

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

Current Time: Wed Dec 03 09:17:50 PST 2025

Total time taken to generate the page: 0.31996 seconds