tecio.cli.tecstats

tecio.cli.tecstats#

Print per-variable statistics for a Tecplot data file.

Verifying that simulation output is physically reasonable, falls within expected bounds, or that a variable has not collapsed to a constant is a routine step in CFD post-processing. Extracting these figures from a binary file would otherwise require opening it in Tecplot or writing a dedicated script. tecstats reports the minimum, maximum, mean, and standard deviation for every variable in every zone directly to the terminal, with optional CSV output for further analysis or archival. Passive and shared variables are noted but skipped. Used alongside tecfix, this tool provides a lightweight diagnostic layer for validating file contents before and after any corrective operation.

Usage:

tecstats [-h] [-zone INDEX] [-variable INDEX] [-csv] [-f] PATH
Positional Arguments:
PATH

Path to the input Tecplot file (.plt, .szplt, or .dat) to analyse.

Options:
-zone INDEX

Restrict output to the zone at the given one-based index. If omitted, all zones are reported.

-variable INDEX

Restrict output to the variable at the given one-based index. If omitted, all variables are reported.

-csv

Write statistics to a CSV file in addition to the terminal output. The filename is derived automatically from the input file stem with a _stats suffix, preceded by optional _zone_N and _var_N segments when the corresponding filters are active. For example:

Command

Output filename

tecstats -csv flow.szplt

flow_stats.csv

tecstats -csv -zone 2 flow.szplt

flow_zone_2_stats.csv

tecstats -csv -variable 3 flow.szplt

flow_var_3_stats.csv

tecstats -csv -zone 2 -variable 3 flow.szplt

flow_zone_2_var_3_stats.csv

-f, --force

Overwrite the output CSV file if it already exists. Without this flag the command exits with an error rather than silently clobbering an existing file.

Returns:

Statistics are written to standard output. If -csv is set, a CSV file is also written to the same directory as the input file with an automatically derived name. Exit code is 0 on success and non-zero if the input file cannot be read, an invalid index is supplied, or the CSV file already exists and --force is not set.

Examples

Print statistics for all zones and variables:

$ tecstats flow.szplt

Restrict to zone 2 only:

$ tecstats -zone 2 flow.szplt

Restrict to variable 3 across all zones:

$ tecstats -variable 3 flow.szplt

Write results to a CSV file:

$ tecstats -csv flow.szplt

Call directly from a Python session:

import tecio.cli.tecstats.main as tecstats

tecstats(["-zone", "2", "-variable", "3", "flow.szplt"])

See also

  • tecio.cli.tecdump: Inspect the full contents and metadata of a file, including auxiliary data and raw variable arrays.

  • tecio.cli.tecfix: Rewrite a file with invalid variable arrays set to

    passive once bad values have been identified via statistics.

Functions

main([argv])

Print per-variable statistics for a Tecplot file.