tecio.cli.tecslice

tecio.cli.tecslice#

Slice a Tecplot data file along IJK indices and/or solution time.

Structured CFD datasets frequently contain more spatial resolution or time steps than are necessary for a given analysis. Reducing the data to a relevant subset (like every other grid point, a specific index range along one axis, or a window of solution times) would otherwise require loading the full file in Tecplot or writing a dedicated script. tecslice applies these reductions directly to the file using a compact colon-notation that mirrors Python slice syntax, supporting both structured (ordered) zone thinning along IJK axes and time-step windowing across all zone types.

All slice arguments use the form start:end:skip, where any component may be omitted. IJK indices are one-based and inclusive at both ends; solution-time start and end are float values, and skip is an integer stride applied after the time window is filtered.

Slice notation reference#

Input

Equivalent

Meaning

5

[5:]

From index 5 to end

:10

[:10]

From start to index 10

::2

[::2]

Every 2nd point or step

2:10

[2:10]

Index 2 through 10 inclusive

2:10:3

[2:10:3]

Every 3rd point from index 2 through 10

::-1

[::-1]

Reverse the axis (e.g. mirror)

Usage:

tecslice [-h] -o PATH [-f] [-i [start]:[end]:[skip]] [-j [start]:[end]:[skip]] [-k
         [start]:[end]:[skip]] [-t [start]:[end]:[skip]] [--strand-id ID] FILE
Positional Arguments:
FILE

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

Options:
-o PATH, --output PATH

Output file path. Required. The extension controls the output format: .szplt, .plt, or .dat.

-f, --force

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

-i [start]:[end]:[skip]

Slice along the I axis of ordered zones. Any component may be omitted. skip may be negative to reverse the axis.

-j [start]:[end]:[skip]

Slice along the J axis of ordered zones. Any component may be omitted. skip may be negative to reverse the axis.

-k [start]:[end]:[skip]

Slice along the K axis of ordered zones. Any component may be omitted. skip may be negative to reverse the axis.

-t [start]:[end]:[skip]

Slice solution times. start and end are float time values (inclusive); skip is an integer stride applied after the time window is filtered. Strand-0 zones are always written unchanged.

--strand-id INT

Restrict time slicing to a single strand ID. Defaults to all strands with ID greater than zero.

Returns:

A new Tecplot file written to the output path containing only the requested subset of grid points and/or time steps. Exit code is 0 on success and non-zero if the input file cannot be read, an invalid slice is supplied, or the output file already exists and --force is not set.

Examples

Thin a structured grid to every other I point:

$ tecslice -i ::2 -o thinned.szplt flow.szplt

Extract a sub-block: I=2..10, J up to 5:

$ tecslice -i 2:10 -j :5 -o sub.szplt flow.szplt

Reverse the I axis:

$ tecslice -i ::-1 -o mirrored.szplt flow.szplt

Extract a solution time window:

$ tecslice -t 0.5:2.0 -o window.szplt transient.szplt

Keep every 3rd time step of strand 1 only:

$ tecslice -t ::3 --strand-id 1 -o sparse.szplt transient.szplt

Call directly from a Python session:

import tecio.cli.tecslice.main as tecslice

tecslice(["-i", "::2", "-o", "thinned.szplt", "flow.szplt"])

See also

  • tecio.cli.tecextract: Extract a subset of zones or variables by index rather than by positional slice.

  • tecio.cli.tecsplit: Split a file into separate grid and solution files.

  • tecio.cli.tecmerge: Merge zones from multiple files into a single output.

Functions

main([argv])

Slice a Tecplot file along IJK indices and/or solution time.

Classes

IjkSliceSpec

Parsed IJK slice: 1-based inclusive integer start/end, integer skip.

TimeSliceSpec

Parsed time slice: float start/end, integer skip.