Export database variables as different files
#Export each variable as a bov file
#Open a sequence of files as listed in *.visit
OpenDatabase("path/test.visit", 0)
#Walk through all timesteps/dumps
for state in range(TimeSliderGetNStates()):
SetTimeSliderState(state)
#Export each variable as a bov file
for variable in ("PP","QN","QP","QV","U", "V", "W"):
#We need to have an active plot of variable to export the data
AddPlot("Pseudocolor", variable, 1, 1)
DrawPlots()
#Create a padded string
dumpNo = str(14 + state*14).zfill(3)
print ("Exporting " + variable + " at dump " + dumpNo )
#Set export parameters
ExportDBAtts = ExportDBAttributes()
ExportDBAtts.db_type = "BOV"
ExportDBAtts.filename = "00450_" + dumpNo + "_" + variable
ExportDBAtts.dirname = "path/data"
ExportDBAtts.variables = variable
ExportDBAtts.opts.types = ()
ExportDatabase(ExportDBAtts)
#Delete current plot
DeleteActivePlots()
Export database with multiple variables to a different format
#Export multiple variables to silo format
OpenDatabase("path/input/tecfl300-1quad.plt")
AddPlot("Pseudocolor", "P1", 1, 0) # You need to have a plot to export something
DrawPlots()
ExportDBAtts = ExportDBAttributes()
ExportDBAtts.db_type = "Silo"
ExportDBAtts.filename = "tecfl300-export"
ExportDBAtts.dirname = "path/exported"
#specify export variables
ExportDBAtts.variables = ("P", "P1", "P2", "P3", "P4", "T1", "T2", "T3", "T4")
ExportDBAtts.opts.types = () ExportDatabase(ExportDBAtts)