#!/usr/local/paraview-3.4.0-Linux-x86_64/bin/pvpython # vtsCombine v. 0.1 # Reads in Gale pvts data and combines it into a single # vts file that can be read by vts2matlab # Requires paraview to be installed. The top line will need # to be changed depending on where pvpython is installed. # # # Depending on the resolution of the model you will need to # change this line which is for 128x8x128 grid: # extract.VOI=(0, 128, 1, 8, 0, 128) # Written by Mark Fleharty, University of New Mexico # fleharty@gmail.com. 8/20/2009 import glob from paraview.servermanager import * Connect() files = glob.glob('fields*.pvts') n = 0 files.sort() for file in files: print file reader = sources.XMLPStructuredGridReader(FileName=file) extract= filters.ExtractGrid(Input=reader) extract.VOI=(0, 128, 1, 8, 0, 128) extract_writer=writers.XMLStructuredGridWriter(Input=extract, FileName="surface" + str(n).zfill(5) + ".vts") n = n+1 extract_writer.DataMode=0 extract_writer.UpdatePipeline()