write_binary#

pytwin.write_binary(filepath, vec)#

Write a binary snapshot file on the disk.

Parameters:
filepathstr

Path of the binary file to be written.

vecnp.ndarray

N-dimensional Numpy array of snapshot data to be written in binary file.

Returns:
bool

Return True if the binary file is successfully written.

Examples

>>> from pytwin import write_binary
>>> scalar_field = np.ndarray([1.0, 2.0, 3.0, 5.0])
>>> write_binary('snapshot_scalar.bin', scalar_field)
>>> vector_field = np.ndarray([[1.0, 1.0, 0.0], [1.0, 2.0, 3.0], [5.0, 3.0, 3.0], [5.0, 5.0, 6.0]])
>>> write_binary('snapshot_vector.bin', vector_field)