Writers
HDF5
write_hdf5(fpath, dataset, *, dtype='f')
Write a Dataset to a grouped HDF5 file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fpath
|
str | Path
|
Output file path. |
required |
dataset
|
Dataset
|
Dataset to write. Flow is stored as a single
timestep under |
required |
dtype
|
str
|
NumPy dtype string for all datasets (default |
'f'
|
Returns:
| Type | Description |
|---|---|
Path
|
Path to the created file. |
Plot3D
write_plot3d(fpath, dataset, *, binary=True)
Write a Dataset grid to a Plot3D .x file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fpath
|
str | Path
|
Output file path. |
required |
dataset
|
Dataset
|
Dataset to write (only grid is used). |
required |
binary
|
bool
|
If |
True
|
Returns:
| Type | Description |
|---|---|
Path
|
Path to the created file. |
Tecplot ASCII
write_tecplot_ascii(fpath, dataset, *, title='cfd-io', zone_title='Zone 1')
Write a Dataset to a Tecplot ASCII .dat file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fpath
|
str | Path
|
Output file path. |
required |
dataset
|
Dataset
|
Dataset to write. |
required |
title
|
str
|
Tecplot TITLE string. |
'cfd-io'
|
zone_title
|
str
|
Tecplot ZONE T string. |
'Zone 1'
|
Returns:
| Type | Description |
|---|---|
Path
|
Path to the created file. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If grid is empty or missing |
TypeError
|
If the grid is not a |
Fortran Binary Sequential
FortranBinaryWriter
Write files containing Fortran unformatted sequential records.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fname
|
str | PathLike[str]
|
Path to the output file. |
required |
endianness
|
str
|
Byte order ( |
'<'
|
int_dtype
|
dtype
|
NumPy dtype for integer records. |
int32
|
real_dtype
|
dtype
|
NumPy dtype for real-valued records. |
float64
|
write_string_fixed(s, length=64, encoding='ascii')
Write a fixed-length string as one record, padded with spaces.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s
|
str
|
String to write. |
required |
length
|
int
|
Record length in bytes (padded or truncated). |
64
|
encoding
|
str
|
Character encoding. |
'ascii'
|
write_ints(values)
Write an integer record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
Iterable[int]
|
Integers to write as a single record. |
required |
write_reals(values)
Write a real-valued record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
Iterable[float]
|
Floats to write as a single record. |
required |
write_array_real(arr, *, fortran_order=True)
Write a real-valued array as one record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arr
|
ndarray
|
Array to write. |
required |
fortran_order
|
bool
|
If True, write in column-major (Fortran) order. |
True
|
close()
Close the underlying file.
Binary Direct (split format)
write_binary_direct(fpath, gpath, dataset)
Write a Dataset to binary files with corresponding header files.
Up to four files are created (grid-only or flow-only is allowed):
<fpath>: flow binary data (if flow is non-empty)<fpath>.cd: flow header file<gpath>: grid binary data (if grid is non-empty)<gpath>.cd: grid header file
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fpath
|
str | Path
|
Path for the flow binary file. |
required |
gpath
|
str | Path
|
Path for the grid binary file. |
required |
dataset
|
Dataset
|
Dataset to write. |
required |
Returns:
| Type | Description |
|---|---|
tuple[Path, Path]
|
Tuple of |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the grid is not a |
ValueError
|
If grid and flow are both empty, or array shapes are inconsistent. |