Apparently from what you wrote below about "24 bytes" you are not aware
that with every fortran unformatted write statement you aquire a 4 byte
header and footer surrounding your data which stores the size of that
record.  You need to tell dx to skip over that stuff.  I can tell you that
I currently write out a ".dx" file which describes the data (in fortran
records) in another file at run time.  This simplifies my life a great
deal.  You might give it a try.

Appendix B of the users guide (I think...) does a superb job of describing
this.  If you look through it you should be able to construct a .dx file
to describe your data in no time.

Tom


On Wed, 25 Apr 2001, José Luis Gómez Dans wrote:

> On Tue, Apr 24, 2001 at 12:51:28PM -0600, David Thompson wrote:
> > Our book has some information on this, but you can also find more
> > convoluted information in the Quickstart guide around page 87.
> 
>       Thank you for your answer, I had already had a look at the
> Quickstart guide and the User's Guide Appendix (B.1). However, I am
> still puzzled by the whole system. I have a binary file, written in
> Fortran. A simplified F95 code looks like this:
> 
> program dx_test
>   real, dimension(10,10)::a
>   call random_number(a)
>   
> open(unit=44,file="dxdata.dat",form="unformatted",status="new",action="write")
>   write(unit=44)10,10
>   write(unit=44)1.0,0.1,2.0,0.2
>   write(unit=44)a(:,:)
>   close(44)
> end program dx_test
> 
>       Hence, the file looks like this
> [grid_size1][grid_size2][xstart][xdelta][ystart][ydelta][a 10x10 array]
> The size of this file is 456 bytes (as expected, integers in Fortran are
> long), so that's quite correct.
> 
>       How is one suppossed to read the array whose dimensions and
> positions are defined in the 24 frist bytes? My first attempt is:
> file = ./dxdata.dat
> grid = 0,4,0,4
> format = msb ieee
> interleaving = record
> majority = row
> field = field0
> structure = scalar
> type = float
> dependency = positions
> positions = 8,4,8,4
> end
> 
>       This doesn't work (apparently, the number of dimensions between
> grid and positions is different).
>       
> 
>       I have tried having the "grid" and "positions" with the whole
> format string, to no avail (different error). I have tried having a
> header statement, again to no avail. Can anyone explain clearly how can
> this thing be done?
> 
>       Thanks for your time and help,
>       José
> 
> --
> José L Gómez Dans                     PhD student
> Tel: +44 114 222 5582                 Radar & Communications Group
> FAX; +44 870 132 2990                 Department of Electronic Engineering
>                                       University of Sheffield UK
> 

Reply via email to