tecio.cli.tecscale#
Scale and/or offset variable arrays in a Tecplot data file.
CFD solvers and experimental data sources frequently produce output in differing unit
systems, and converting between them (e.g.pressure in Pa to kPa, temperature in Kelvin
to Celsius or lengths in meters to feet) is a routine step before visualisation or
comparison. Performing these transformations would otherwise require loading the file
in Tecplot or writing a dedicated script. tecscale applies the linear transformation
to every value in a selected variable array, where \(s\) is the scale factor and \(b\) is the additive offset. The transformation can be restricted to a single zone and the output format is controlled by the output file extension, allowing unit conversion and format conversion to be performed in a single step.
- Usage:
tecscale [-h] -variable INDEX_OR_NAME [-scale FLOAT] [-offset FLOAT] [-zone INDEX]
[-o PATH] [-f] PATH
- Positional Arguments:
PATHPath to the input Tecplot binary file (
.pltor.szplt) to transform.
- Options:
-variable INDEX_OR_NAMEVariable to transform, specified as either a one-based integer index or a name string (case-insensitive). Required.
-scale FLOATMultiplicative scale factor \(s\). Defaults to
1.0.-offset FLOATAdditive offset \(b\) applied after scaling. Defaults to
0.0.-zone INDEXOne-based zone index to restrict the transformation to. If omitted, all zones are processed.
-o PATH,--output PATHOutput file path. The extension controls the output format:
.szplt,.plt, or.dat. Defaults to<stem>_scaled<ext>in the same directory as the input file.-f,--forceOverwrite the output file if it already exists. Without this flag the command exits with an error rather than silently clobbering an existing file.
- Returns:
A new Tecplot file written to the output path with the selected variable transformed in all processed zones. Exit code is
0on success and non-zero if the input file cannot be read, the variable cannot be resolved, or the output file already exists and--forceis not set.
Examples
Convert pressure from kPa to psi by index:
$ tecscale -variable 4 -scale 0.145038 flow.szplt
Same conversion using the variable name:
$ tecscale -variable Pressure -scale 0.145038 flow.szplt
Shift temperature from Kelvin to Celsius in zone 2 only:
$ tecscale -variable Temperature -offset -273.15 -zone 2 flow.szplt
Scale and offset in one step, writing to ASCII DAT:
$ tecscale -variable 3 -scale 0.3048 flow.szplt -o flow_ft.dat
Call directly from a Python session:
import tecio.cli.tecscale.main as tecscale
tecscale(["-variable", "Pressure", "-scale", "1e-3", "flow.szplt"])
See also
tecio.cli.teconvert: Convert between Tecplot file formats without applying
any variable transformation.
Functions
|
Scale and/or offset a variable in a Tecplot file. |