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

Home » Public Forums » archive » Re: reading past leading and training bytes
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 past leading and training bytes [message #49217 is a reply to message #49204] Thu, 06 July 2006 11:20 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
glaciologist wrote:
> I'm using readu to read a 101 X 55 (2D) binary file
>
> The file has leading and trailing 4 byte tags ( 00 00 56 CC in
> hexadecimal).
>
> How to skip past these??!
>
> I use this code, which successfully reads in array, but first column
> gets scrambled!~
>
> readu,1,data
> byteorder,data,/xdrtof ; byteswap needed
>
> data are output by Linux Fedora 4 Portland Group FORTRAN executable
> with -byteswapio flag set on compile

Without seeing the actual OPEN() statement in your Fortran code (or your IDL code for that
matter), what happens if you use the /f77_unformatted flag in your IDL open? (If you're
not doing it already).

I'm guessing that the 4byte "tags" you're seeing are actually the record markers that
sequential, unformatted Fortran files generally contain to mark the begin and end of
variable length records (with the actual value being the record length).

So try
OPEN, lun, file, /get_lun, /f77_unformatted

You might also need the /swap_endian keyword as well depending on the platform on which
you are reading the byteswapped files. If the linux box that created the files is
little-endian, then the PGI -byteswapio option will produce big-endian files (or vice versa).

paulv

--
Paul van Delst Ride lots.
CIMSS @ NOAA/NCEP/EMC Eddy Merckx
Ph: (301)763-8000 x7748
Fax:(301)763-8545
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Reading data from file
Next Topic: Re: IVolume/isosurface

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

Current Time: Tue Dec 02 14:05:40 PST 2025

Total time taken to generate the page: 0.96241 seconds