# How to make this paraview script is read by all mpi ranks so that at a time I can process many files. I want to eliminate for loop

**URL:** https://discourse.paraview.org/t/how-to-make-this-paraview-script-is-read-by-all-mpi-ranks-so-that-at-a-time-i-can-process-many-files-i-want-to-eliminate-for-loop/9046
**Category:** ParaView Support
**Tags:** python
**Created:** [February 23, 2022, 11:08am UTC](https://discourse.paraview.org/t/how-to-make-this-paraview-script-is-read-by-all-mpi-ranks-so-that-at-a-time-i-can-process-many-files-i-want-to-eliminate-for-loop/9046 "2022-02-23T11:08:44Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![maruthinh](https://discourse.paraview.org/user_avatar/discourse.paraview.org/maruthinh/32/3169_2.png) [@maruthinh](https://discourse.paraview.org/u/maruthinh)
#### Post date: [February 23, 2022, 11:08am UTC](https://discourse.paraview.org/t/how-to-make-this-paraview-script-is-read-by-all-mpi-ranks-so-that-at-a-time-i-can-process-many-files-i-want-to-eliminate-for-loop/9046/1 "2022-02-23T11:08:44Z")

</div>

```auto
# import the simple module from the paraview
from paraview.simple import *
import numpy as np

#############################################################
for i in range(102, 276, 2):
    ###############################################################
    
    # disable automatic camera reset on 'Show'
    #paraview.simple._DisableFirstRenderCameraReset()
    
    # create a new 'CSV Reader'
    payload_surfcsv = CSVReader(
        FileName=['./3d_surf_data/surface_data_'+str(i)+'.csv'])
    #payload_surfcsv = CSVReader(FileName=['/mnt/external_data/maruthi/payload/to_surf_data.csv'])
    #payload_surfcsv = CSVReader(FileName=['/mnt/external_data/maruthi/payload/payload_surf.csv'])
    
    print("read data")
    # Properties modified on payload_surfcsv
    payload_surfcsv.HaveHeaders = 0
    payload_surfcsv.FieldDelimiterCharacters = '" "'
    
    # create a new 'Table To Points'
    tableToPoints1 = TableToPoints(Input=payload_surfcsv)
    
    # Properties modified on tableToPoints1
    tableToPoints1.XColumn = 'Field 0'
    tableToPoints1.YColumn = 'Field 1'
    tableToPoints1.ZColumn = 'Field 2'
    
    # set active source
    # SetActiveSource(tableToPoints1)
    
    # create a new 'Transform'
    transform1 = Transform(Input=tableToPoints1)
    
    # Properties modified on transform1.Transform
    transform1.Transform.Rotate = [0.0, 0.0, 4.0]
    print("done transformation")
    
    # create a new 'Clip'
    clip1 = Clip(Input=transform1)
    clip1.ClipType = 'Box'
    # Properties modified on clip1.ClipType
    clip1.ClipType.Position = [-1.696043450844211, -54.8910389148131, -0.33203125]
    clip1.ClipType.Length = [471.2158891012069, 109.7879512755795, 0.33203125]
    
    #print("position", clip1.ClipType.Position)
    #clip1.ClipType.Position[2] = -0.33203125
    #clip1.ClipType.Length[2] = 0.33203125
    
    # create a new 'Clip'
    clip2 = Clip(Input=clip1)
    # Properties modified on clip2.ClipType
    clip2.ClipType.Normal = [0.0, -1.0, 0.0]
    print("clip2 done")
    
    # save data
    # SaveData('/mnt/external_data/maruthi/payload/clipped_surf_data_hello.csv',
    # proxy=clip2, PointDataArrays=['Field 3', 'Field 4'])
    SaveData('clipped_data/clipped_surf_data_'+str(i)+'.csv',
             proxy=clip2)

```
