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

Home » Public Forums » archive » IDL/FORTRAN File Reading
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: IDL/FORTRAN File Reading [message #66782 is a reply to message #66690] Mon, 08 June 2009 19:47 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Jun 4, 2:04 pm, robparke...@googlemail.com wrote:
> This might be a bit of a strange request but I'm hoping we have some
> multi-skilled people here who might be able to help.
>
> I have a file written by some fortran code as a "f77_unformatted"
> file.
>
> I've managed to figure out how to read this in in IDL and I've done as
> follows:
>
> header = strarr(80,1)
> openr,unit,filename, /f77_unf,/get_lun
>
> i=0
> while ~ eof(unit) do begin
>
> readu,unit,header
> b = 0.0d0
> c = 0.0d0
> e = 0.0d0
> f = 0L
> g = 0.0
> readu,unit,b,c,e,f,nlo
>
> if f EQ -99 then break
>
> a=dblarr(f,1)
> readu,unit,a
>
> case i of
> 0: BEGIN
> data=a
> END
> data=[data, a]
> END
> endcase
>
> i=1
> endwhile
>
> close, unit
> free_lun, unit
>
> This reads in b,c,d,e,f and then f is used to determine how big a is
> and then that chunk of data is read in. It then repeats with a new
> value of f being read in which defines a new chunk of a and so on
> until the EOF.
>
> That's probably a lot simpler than I described it.
>
> Anyway my problem is that whilst I can do this in IDL, ironically I
> can't figure out how to do it in FORTRAN. As i'm just about at the
> "hello world" stage that's not surprising but I thought it would
> simply be a case of defining my variables as the correct type and then
> just using the fortran READ command but that spits out the wrong
> values. I was hoping that someone capable in both IDL and FORTRAN
> might be able to "translate" between the two for me.

Your description seems to be sufficient, but it would be easier if
there was a sample of the kind of file to read.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: huge image file.
Next Topic: using mesh_obj,4

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

Current Time: Fri Oct 10 09:51:20 PDT 2025

Total time taken to generate the page: 0.64030 seconds