Skip to content

write_file

write_file(fpath, dataset, *, grid_file=None, dtype='f')

Write data, dispatching by extension.

Parameters:

Name Type Description Default
fpath str | Path

Output path (flow file for split formats).

required
dataset Dataset

Dataset to write.

required
grid_file str | Path | None

Output path for the grid file (required for split formats; ignored for HDF5).

None
dtype str

NumPy dtype for HDF5 datasets (default "f" = float32).

'f'

Returns:

Type Description
Path

Path to the created output file (the primary file when split).

Raises:

Type Description
ValueError

If the file extension is not recognized.