This HTML automatically generated with rman for NEMO
Table of Contents

Name

unfio - access fortran unformatted I/O files

Synopsis

unfio in=input_file [parameter=value]

Description

unfio scans (and optionally dumps) a binary file, created with a FORTRAN program with the form=’unformatted’ OPEN statement.

It is currently only implemented for BSD-type fortran compilers with arbitrary endianism of the bytes (i.e. probably excluding VMS and Cray compilers). Depending on the compiler, the header size can be 8 instead of the classic 4. See header= below.

Parameters

The following parameters are recognized in any order if the keyword is also given:
in=
input file. No default.
out=
output file. Fortran headers and trailers have been stripped off. If you need ASCII output, this keyword should be left alone, use type=,format= to control how you want to "see" the numbers. Default: no output.
block=
which block to display (0=all, default: scan). By default it will scan the file and report the blocksize.
type=
Format (valid are: {int, float, double}) of the data-item. This assumes all data in a block has the same type.
select=
Which items to select in a block. The default is all. Any nemoinp(3NEMO) expression can be given. Default: all.
format=
The printf(3) format to use when displaying a block display [%d,%g].
count=t|f
A logical denoting if to display an element counter too?.
maxbuf=
buffersize in bytes, to read a block.
swap=
Swap bytes after low level read? This only applies to the header, not to the actual data. Programmers must still do this themselves. If using a specific block to display, the data bytes are swapped based on the data type given by type=.
header=|0|4|8
Size of the header uses in unformatted fortran data. This used to be 4, but modern compilers (e.g. gfortran) may very well use 8. By default it is not specified, and the value determined to be the correct one during install (UNFIO_HDR_SIZE) is used. This keyword can be used to force another value. 0 is also supported to read raw binary data.

Examples

Suppose we have a dataset that somebody dumped via fortran, and
unfio dump.dat
52
2400000
2400000
which after knowing from the author that there are 200,000 bodies in here, and positions and velocities are written seperately, we can decipher in the following way
unfio dump.dat - 2 f maxbuf=2400000 | tabtos - pos.snap nbody=200000 time=1

Here is an example of reading the frequency table of a miriad bandpass calibration file with 6 spectral windows, on an little endian architecture machine:

   % unfio vis/freqs header=0 maxbuf=152 format=%g block=1 count=1 swap=t
type=d
   % unfio vis/freqs header=0 maxbuf=152 format=%d block=1 count=t swap=t
type=i

Files

src/kernel/fortran    : code, plus example program to check default header size

See Also

bswap(1NEMO) , unfio(3NEMO) , bswap(3NEMO)

Author

Peter Teuben

Update History


9-Aug-95    V1.1 Documented     PJT
21-jun-97    V1.2 added select=    PJT
7-feb-98    V2.0 added out=        PJT
19-mar-99    V2.1 out= also uses select= now     PJT
1-mar-06    V2.2 added header=4|8    PJT
4-mar-06    V2.3 header=now blank value    PJT
8-may-08    V2.4 support header=0    PJT


Table of Contents