open

open(filename, **kwargs)

Open a dfs/mesh file (and read the header)

The typical workflow for small dfs files is to read all data with mikeio.read instead of using this function. For big files, however, it can be convenient to open the file first with dfs=mikeio.open(…) to inspect it’s content (items, time and shape) and then decide what to read using dfs.read(…)

Parameters

Name Type Description Default
filename str | Path full path and file name to the dfs file. required
type str Dfs2 only. Additional information about the file, e.g. "spectral" for spectral dfs2 files. By default: None. required

See also

mikeio.read - read data from a dfs file

Examples

>>> dfs = mikeio.open("wl.dfs1")
>>> dfs = mikeio.open("HD2D.dfsu")
>>> ds = dfs.read(items="Salinity", time="2016-01")
>>> dfs = mikeio.open("pt_spectra.dfs2", type="spectral")