Python Commands and Scripts for VisIt

Recipes and tips for VisIt software

  1. Batch rendering on Stampedehttp://seedme.org/node/25907
  2. Assorted python scripts: http://www.visitusers.org/index.php?title=Python_examples
  3. Export session as a python script : http://visitusers.org/index.php?title=WriteScript​
  4. Colormap opaque via Python: http://www.visitusers.org/index.php?title=Creating_a_color_table
  5. Colormap transparent via Python: https://elist.ornl.gov/mailman/htdig/visit-users/2009-March/003180.html
  6. Colormap transparency via xml: https://elist.ornl.gov/mailman/htdig/visit-users/2013-February/013635.html
  7. Reverse launch visit: http://www.visitusers.org/index.php?title=Using_VisIt_in_an_mxterm​ 
  8. Force a filetype format via command line:    --assume_format NETCDF    Note: This is case sensitive
  9. Resize window in Interactive Mode: ResizeWindow(1, 310, 290)  ResizeWindow(2, 310, 290)
  10. 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
  11. Fly through splines in visit:  http://visitusers.org/index.php?title=Fly_through
  12. DEM and globe rendering: http://visitusers.org/index.php?title=Climate_Rendering 
  13. 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()
    
  14. 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)