Python Commands and Scripts for VisIt

Recipes and tips for VisIt software

  1. Batch rendering on Stampede
  2. Export session as a python script :​
  3. Reverse launch visit:​ 
  4. Force a filetype format via command line:    --assume_format NETCDF    Note: This is case sensitive
  5. Resize window in Interactive Mode: ResizeWindow(1, 310, 290)  ResizeWindow(2, 310, 290)
  6. Aggregate multiple files in a visit file
    .visit file format consists of list of files one per line they can be grouped (say 2 lines per data)
    !NBLOCKS 2 
    Explicit time can also be specified using 
    !TIME 0.15 !TIME 1.30
  7. Fly through splines in visit:
  8. DEM and globe rendering: 
  9. 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()): 
      #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)
        #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 = ()
        #Delete current plot
  10. Export database with multiple variables to a different format
    #Export multiple variables to silo format
    AddPlot("Pseudocolor", "P1", 1, 0) # You need to have a plot to export something
    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)