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

Home » Public Forums » archive » Re: problem reading Fortran binary file
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: problem reading Fortran binary file [message #70241] Thu, 25 March 2010 11:51
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Mar 25, 3:50 pm, pp <pp.pente...@gmail.com> wrote:
> This is what you were asking, but I think the way you are reading it,

I meant to say "this is not what you were asking".
Re: problem reading Fortran binary file [message #70242 is a reply to message #70241] Thu, 25 March 2010 11:50 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
This is what you were asking, but I think the way you are reading it,
your Nphot_tab will have the elements messed up in it. Both IDL and
Fortran are row major, so when you read the data, the leftmost
dimension should vary the fastest. Also I think you could use just:


nrej = 0L
n = 0L
my_file = 'bfile.bin'
openr,unit,myfile,/get_lun,/f77_unformatted
readu,unit, nrej,n
Nphot_tab = dblarr(nrej,n)
readu,unit,Nphot_tab
free_lun,unit

You should also make sure that the data types match. Is your fortran
array data made of 64-bit reals? Are the fortran nrej and n 32 bit
integers?
Re: problem reading Fortran binary file [message #70245 is a reply to message #70242] Thu, 25 March 2010 10:42 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
bing999 writes:

> Does anybody know what i did wrong? :)

Maybe you forgot the F77_UNFORMATTED keyword on
the OPENR statement .

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: problem reading Fortran binary file
Next Topic: outline keyword for bar_plot

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

Current Time: Sat Oct 11 14:30:02 PDT 2025

Total time taken to generate the page: 1.52030 seconds