I am new both to tecplot and python. I have a lot of .dat files to process by doing repetitive calculations on them. I have written a small script for this reason.
The question that I have arises in the following way: For each .dat file (that I plot as a XY plot) I want to alter a variable V5, by dividing it with a constant IMax that differs for each .dat file, then overwriting the old V5.
The problem is that I cannot find a way to loop through each one of my .dat files and perform this operation.
Sorry if it is not clear, I will edit it on demand. Thank you in advance
EDIT: This is part of the script i have written
#!/usr/bin/env python
import tecplot as tp
import tecplot
import os
import re
from tecplot.constant import *
from tecplot.exception import *
from tecplot.tecutil import _tecutil
from tecplot.constant import ValueLocation
tecplot.session.connect()
working_dir = os.getcwd()
for filename in os.listdir(working_dir):
if filename.endswith("Cl.dat"):
datafile = os.path.join(working_dir, filename)
dataset = tecplot.data.load_tecplot(datafile)
frame = tecplot.active_frame()
#get IMax from data set information and divide V5 with c=IMax
zone = dataset.zone(1)
current_dataset = tecplot.active_frame().dataset
c = int(zone.dimensions[0])
tecplot.data.operate.execute_equation("{V5}=V5/c", zones= [current_dataset.zone(1)])
tp.save_layout(os.path.splitext(filename)[0] + "_plot_fft.lay",
include_data=True,
include_preview=False)
tecplot.export.save_png(os.path.splitext(filename)[0] + "_plot_fft.png",
width=1162,
region=ExportRegion.AllFrames,
supersample=1,
convert_to_256_colors=False)
tecplot.new_layout()
The problem is that I need to have c changing inside the execute equation