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 #54493 is a reply to message #49280] Tue, 19 June 2007 09:10 Go to previous messageGo to previous message
Vince Oliver is currently offline  Vince Oliver
Messages: 8
Registered: June 2007
Junior Member
ok ... works seems to me. thanks for help. I copy paste the program
for the case somebody has similar problem


data = 'c:\users\\spectra10.bin'

OpenR, lun, data, /Get_Lun, /F77_UNFORMATTED

n=7323
nmod = 10

spectra = ASSOC(lun,{RecBegin:0L, data:FLTARR(2,n), RecEnd:0L})


for i = 0, nmod-1 do begin
openw, out, strcompress('test'+string(i)+'.dat'), /get_lun
spectrum = spectra[i]
for j = 0, (size(spectrum.data))[2]-1 do begin
printf, out, spectrum.data[0,j], spectrum.data[1,j]
endfor
close, out
free_lun, out
endfor


Close, lun
Free_Lun, lun







On Jun 19, 5:28 pm, Paul van Delst <Paul.vanDe...@noaa.gov> wrote:
> Vince Oliver wrote:
>> paul, when I do
>
>> spectra = ASSOC(lun,{RecBegin:0L, Data:FLTARR(2,n), RecEnd:0L})
>> spectrum = spectra[0]
>> print, spectrum
>
>> I endeed have:
>
>> SPECTRUM STRUCT = -> <Anonymous> Array[1]
>> { 58584 91.0000 2.04773e-023
>> 94.0000 5.73142e-023
>> 96.0000 1.12218e-022
>> 98.0000 2.17056e-022
>> 100.000 4.00652e-022
>> ...}
>
>> How to get these elements?
>
> The structure components? Use the "." operator to resolve them. Try,
>
> IDL> help, spectrum.data
>
> For example:
>
> IDL> spectrum={rb:-999L, data:findgen(5)+10.0, re:-999L}
> IDL> print, spectrum
> { -999 10.0000 11.0000 12.0000 13.0000 14.0000
> -999}
> IDL> help, spectrum
> SPECTRUM STRUCT = -> <Anonymous> Array[1]
> IDL> help, spectrum.data
> <Expression> FLOAT = Array[5]
> IDL> print, spectrum.data
> 10.0000 11.0000 12.0000 13.0000 14.0000
> IDL> print, spectrum.rb, spectrum.re
> -999 -999
>
> Check your IDL help for much more info on IDL structures.
>
> cheers,
>
> paulv
>
> --
> Paul van Delst Ride lots.
> CIMSS @ NOAA/NCEP/EMC Eddy Merckx- Hide quoted text -
>
> - Show quoted text -
[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 05:10:18 PDT 2025

Total time taken to generate the page: 0.56061 seconds