>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/
>------------------------------------------------------------------------


This particular data set is a lousy exemplar to copy. It comes from a data
set which follows neither C nor FORTRAN array serialization conventions (C
is Z fastest, Y, then X; FORTRAN is the opposite; temperature.dx is Y
fastest, Z, then X: note the delta vectors).

What you should consider is this:
write 1 header file in ASCII so you can read it
write n data files in binary

The n data files will be pointed to by "data file filename" references in
the header file. Example:
object 1 class array type float rank 0 items 2800 msb ieee data file
time_000.bin,0

Other than fixing the delta vectors, you can otherwise use the header
portion of temperature.dx as the exemplar for a single field (time step).
Each data file will be used to construct a field of X*Y*Z (or i*j*k if you
prefer) items, so yes the object header line is correct for a single field
which would be a single time step.

Then when you collect the n fields together into a "series" object (also in
the same header file, at the end of all the individual field definitions):
object "my_data_series" class series
member 0 value "time step 0"
member 1 value "time step 1" .... (assuming you named time steps similar to
this previously)

you will have all in one header file the complete description of all time
steps,  yet when you Import this .dx file, you will have the choice of
importing all steps, or a range (including 1 step at a time), for playback
with Sequencer, that being generally desirable to show animation over time.

Look at Users Guide Appendix B-2 for examples of series or "series.dx" in
the examples directory.

Chris Pelkie
Vice President/Scientific Visualization Producer
Conceptual Reality Presentations, Inc.
30 West Meadow Drive
Ithaca, NY 14850
[EMAIL PROTECTED]

Reply via email to