S5.Tecplot.TecplotData#
- class S5.Tecplot.TecplotData(filename=None)[source]#
Bases:
object
Represent a Tecplot File.
- title#
Title of the tecplot file.
- zone#
Tecplot zone header.
- data#
Data within the file as a Pandas DataFrame.
Examples
>>> motor = TecplotData("Motor.dat")
Methods
__init__
([filename])Check the zone detail matches the DataFrame.
readfile
(filename)Read the file and load populate self.data with the contents.
Update the zone detail assuming a 1d data structure.
write_tecplot
(filename[, datum])Write the TecplotData to a .dat file.
- check_zone() bool [source]#
Check the zone detail matches the DataFrame.
This is not an exhaustive check, but just a check to make sure that the number of rows matchs the produce of I*J*K in the Zone line.
- Returns:
True if the zone detail matches the total rows
Examples
>>> velocity = TecplotData("Velocity.dat") >>> if not velocity.check_zone(): >>> print("Zone detail mismatch!!")
- readfile(filename: str | PathLike) None [source]#
Read the file and load populate self.data with the contents. :param filename: Path to datafile in Tecplot format.
- Returns:
None, data from the file is loaded into the instance as the self.data attribute
Examples
>>> data = TecplotData() >>> data.readfile("Velocity.dat")
- update_zone_1d()[source]#
Update the zone detail assuming a 1d data structure.
Update the zone detail such that i = the size of the dataframe in self.data.
Examples
>>> velocity = TecplotData("Velocity.dat") >>> velocity.update_zone_1d()
- write_tecplot(filename, datum=False) None [source]#
Write the TecplotData to a .dat file.
- Parameters:
filename – Filename including extension (.dat)
datum – If DSW datum lines are written, default false
- Returns:
None
Examples
>>> velocity = TecplotData("Velocity.dat") >>> velocity.write_tecplot("Velocity.dat")