Python Commands and Scripts for VisIt

Recipes and tips for VisIt software

  1. Batch rendering on Stampedehttp://seedme.org/node/25907
  2. Export session as a python script : http://visitusers.org/index.php?title=WriteScript​
  3. Reverse launch visit: http://www.visitusers.org/index.php?title=Using_VisIt_in_an_mxterm​ 
  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:  http://visitusers.org/index.php?title=Fly_through
  8. DEM and globe rendering: http://visitusers.org/index.php?title=Climate_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()): 
      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()
    
  10. 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)