Hi, I see that you've already received two responses to this question, but I thought I would chime in as well... In my experience trying to mix binary and ascii data output in fortran code can be a real headache. I'd suggest that you follow the advice of the others (Chris & Lloyd) and write the header to another file. For historical reasons my data output files are in fortran unformatted records, though my code is in c. If you'd like an example header file I can send you one. I would highly recomend that you download a copy of the dx userguide in pdf format and read appendix B. There is an example in there of how to write the header file and a script for displaying it. (A quick way to get started.)
Tom On Wed, 23 Aug 2000, Thomas Ruedas wrote: >This is probably quite trivial, but anyway, here goes: >My FORTRAN 77 program stores the spatial distribution of temperature on >a regular orthogonal grid in a 3D array t(i,j,k), and I want to change >my code in such a way that it writes this array every n time steps in >DX's native file format in one file which includes both header and data. >Looking at the DX example file temperature.dx suggests that the header >is written formatted, but the data unformatted, if binary output is >selected (which I would strongly prefer). >So my trivial question is: is there anywhere an example of FORTRAN code >where such kind of header+data output is generated? Is it possible at >all? The point is that I couldn't figure out how to do that, because one >can't write formatted and unformatted data to the same file, and >tricking around with reopening didn't seem to work either. The only way >seems to be to write 2 files and cat them together, but that couldn't be >done by the program itself, which thus is not very practical. > >The other question is about the items flag in >object 1 class array type float rank 0 items 2800 msb ieee data 0 >In this example items is the total number of grid points; however, I am >writing a series of n such datasets. It didn't become quite clear to me >from the user guide if I would have to set items to n times the number >of grid points then, and if it is possible (and sensible) at all to put >all n datasets in the same file. > >I will be most grateful for some information about this, as well as for >pointers to additional online/downloadable references especially >concerning the data format. >-- >------------------------------------------------------------------------ >Thomas Ruedas >Institute of Meteorology and Geophysics, J.W.Goethe University Frankfurt >e-mail: [EMAIL PROTECTED] >http://www.geophysik.uni-frankfurt.de/~ruedas/ >------------------------------------------------------------------------ >
