imod.tec - Read Tecplot ASCII data

Read Tecplot ASCII data.


Get the Tecplot ASCII header as a dictionary, variables=None, times=None, kwargs={})[source]

Read a Tecplot ASCII data file to an xarray Dataset.

Reads the data from a Tecplot ASCII file (.TEC or .DAT), as outputted by iMODSEAWAT, into an xarray Dataset. If there are valid coordinates x, y and z present in the Tecplot file, these will be returned as coordinates (time, z, y, x). If the Tecplot file does not provide coordinate values, only indices, then the dataset is returned with dimensions: layer, row, column, time.

  • path (str or Path) – path to .TEC file

  • variables (str, list, or tuple; optional) – Which variables to read into the xarray dataset, e.g: [‘head’, ‘conc’, ‘vx’, ‘vy’, ‘vz’]. Defaults to all variables.

  • times (integer, list, or slice; optional) – Which timesteps to read. The Tecplot file starts numbering at 0.0, and the numbers function solely as index. Defaults to all timesteps.

  • kwargs (dict) – Dictionary containing the pandas.read_csv() keyword arguments used for reading the Tecplot ASCII file (e.g. {“delim_whitespace”: True}).


read contents into an xarray dataset:

>>> ds =

read only head and conc data:

>>> ds =, ['head','conc'])

read only vx data for the first and last timestep:

>>> ds =, 'vx', times=[0,-1])

For the first 20 timesteps, once every four steps:

>>> ds =, 'vx', times=slice(0, 20, 4))

Or for every tenth timestep:

>>> ds =, 'vx', times=slice(None, None, 10))

See also the documentation for slice().