imod.tec - Read Tecplot ASCII data

Read Tecplot ASCII data.

imod.tec.header(path)[source]

Get the Tecplot ASCII header as a dictionary

imod.tec.read(path, 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. The Tecplot file provides no coordinate values, exclusively indices. The dataset is returned with dimensions: layer, row, column, time.

Parameters
  • 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}).

Examples

read contents into an xarray dataset:

>>> ds = imod.tec.read(path)

read only head and conc data:

>>> ds = imod.tec.read(path, ['head','conc'])

read only vx data for the first and last timestep:

>>> ds = imod.tec.read(path, 'vx', times=[0,-1])

For the first 20 timesteps, once every four steps:

>>> ds = imod.tec.read(path, 'vx', times=slice(0, 20, 4))

Or for every tenth timestep:

>>> ds = imod.tec.read(path, 'vx', times=slice(None, None, 10))

See also the documentation for slice().