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

Home » Public Forums » archive » Reading binary files made by Python
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: reading binary files [message #54500 is a reply to message #49280] Tue, 19 June 2007 07:47 Go to previous messageGo to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Vince Oliver wrote:
> we are maybe on the good way. I wrote this
>
>
> OpenR, lun, data, /Get_Lun, /F77_UNFORMATTED
>
> specnr=2
> nlen=7323
> n=2*nlen
> specoff=(n+1)*specnr*4l ; this is letter L not number 1
> spectra = Assoc(lun, Fltarr(n),specoff)

what about something like,

spectra = ASSOC(lun,{RecBegin:0L, Data:FLTARR(2,n), RecEnd:0L})
spectrum = spectra[0]

?

Do the spectrum.data contain the correct info? Additionally, are the values of
spectrum.recbegin and spectrum.recend the same as 2*n*4?

Remember that *each* output record (for Fortran sequential access, unformatted) has a
marker both at the beginning *and* the end specifying the record length (hopefully in
bytes, not "words").

ASSOC is most often used for direct access, unformatted; but there's no reason you can't
use it here also.

>> I assume here that the data is: DWORD|fltarr(n)|DWORD|fltarr(n)...

Nope, it should be

RECLEN1|fltarr(2,n)|RECLEN1|RECLEN2|fltarr(2,n)|RECLEN2....

One of the reasons for the terminating record length marker (what I called "RecEnd" in the
structure above) is so that the Fortran BACKSPACE command works for sequential access files.

cheers,

paulv

--
Paul van Delst Ride lots.
CIMSS @ NOAA/NCEP/EMC Eddy Merckx
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: extracting specific substrings from a text-file
Next Topic: Re: Error: X does not support locale C.

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

Current Time: Fri Oct 10 04:45:53 PDT 2025

Total time taken to generate the page: 0.48819 seconds