Paraview 5.9.1 (and pvpython) does not recognize changes made in the python script

Hello,

I have created a python script using the trace. The script works in python shell, pvpython and pvbatch. My problem is that I tried to modify some things within the script such as size or for example Arrow to Cone but when I run the script with pvpython or in the python shell, I don’t see any changes.
Is this meant to be this way or there is some issue with this. I tried also for example to switch the variable from u to v just to see if its recognized but still nothing happened.
One more thing, for example number of points in the StreamTracer filter was not recorded by the tracing mechanism, is that also meant to be that way? I modified the tracing box to trace everything I do.
I am asking this because this script needs to be universal in a way and then additionally modified according to data file.
Thank you.
I am quite new to this so I am sorry if the questions are trivial.

please share your non working script.

Every filter should be traced correctly.

Hello again,

So I’ve been double checking the script, and regarding the problem with changing Arrow to Sphere in glyphs I messed it up in vim editor so that is ok now.
But how do I change the number of streamlines within the sphere (the number of points seed points is 100 here)?

# trace generated using paraview version 5.9.1

#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()

# create a new 'NetCDF Reader'
interpolatednc = NetCDFReader(registrationName='interpolated.nc', FileName=['/home/interpolation/interpolated.nc'])
interpolatednc.Dimensions = '(z, y, x)'

# get animation scene
animationScene1 = GetAnimationScene()

# update animation scene based on data timesteps
animationScene1.UpdateAnimationUsingDataTimeSteps()

# Properties modified on interpolatednc
interpolatednc.SphericalCoordinates = 0
interpolatednc.OutputType = 'Image'

# get active view
renderView1 = GetActiveViewOrCreate('RenderView')

# show data in view
interpolatedncDisplay = Show(interpolatednc, renderView1, 'UniformGridRepresentation')

# trace defaults for the display properties.
interpolatedncDisplay.Representation = 'Outline'
interpolatedncDisplay.ColorArrayName = [None, '']
interpolatedncDisplay.SelectTCoordArray = 'None'
interpolatedncDisplay.SelectNormalArray = 'None'
interpolatedncDisplay.SelectTangentArray = 'None'
interpolatedncDisplay.OSPRayScaleArray = 'terrain'
interpolatedncDisplay.OSPRayScaleFunction = 'PiecewiseFunction'
interpolatedncDisplay.SelectOrientationVectors = 'None'
interpolatedncDisplay.ScaleFactor = 143.6
interpolatedncDisplay.SelectScaleArray = 'None'
interpolatedncDisplay.GlyphType = 'Arrow'
interpolatedncDisplay.GlyphTableIndexArray = 'None'
interpolatedncDisplay.GaussianRadius = 7.18
interpolatedncDisplay.SetScaleArray = ['POINTS', 'terrain']
interpolatedncDisplay.ScaleTransferFunction = 'PiecewiseFunction'
interpolatedncDisplay.OpacityArray = ['POINTS', 'terrain']
interpolatedncDisplay.OpacityTransferFunction = 'PiecewiseFunction'
interpolatedncDisplay.DataAxesGrid = 'GridAxesRepresentation'
interpolatedncDisplay.PolarAxes = 'PolarAxesRepresentation'
interpolatedncDisplay.ScalarOpacityUnitDistance = 5.170266879832471
interpolatedncDisplay.OpacityArrayName = ['POINTS', 'terrain']
interpolatedncDisplay.SliceFunction = 'Plane'
interpolatedncDisplay.Slice = 60
#interpolatedncDisplay.InputVectors = [None, '']

# init the 'Plane' selected for 'SliceFunction'
interpolatedncDisplay.SliceFunction.Origin = [719.0, 719.0, 119.5]

# reset view to fit data
renderView1.ResetCamera()

# get the material library
materialLibrary1 = GetMaterialLibrary()

# update the view to ensure updated data information
renderView1.Update()

# set scalar coloring
ColorBy(interpolatedncDisplay, ('POINTS', 'terrain'))

# rescale color and/or opacity maps used to include current data range
interpolatedncDisplay.RescaleTransferFunctionToDataRange(True, False)

# show color bar/color legend
interpolatedncDisplay.SetScalarBarVisibility(renderView1, True)

# get color transfer function/color map for 'terrain'
terrainLUT = GetColorTransferFunction('terrain')

# get opacity transfer function/opacity map for 'terrain'
terrainPWF = GetOpacityTransferFunction('terrain')

# change representation type
interpolatedncDisplay.SetRepresentationType('Volume')

# invert the transfer function
terrainLUT.InvertTransferFunction()

# invert the transfer function
terrainLUT.InvertTransferFunction()

# Apply a preset using its name. Note this may not work as expected when presets have duplicate names.
terrainLUT.ApplyPreset('X Ray', True)

# Apply a preset using its name. Note this may not work as expected when presets have duplicate names.
terrainLUT.ApplyPreset('X Ray', True)

# Apply a preset using its name. Note this may not work as expected when presets have duplicate names.
terrainLUT.ApplyPreset('X Ray', True)

# Apply a preset using its name. Note this may not work as expected when presets have duplicate names.
terrainLUT.ApplyPreset('X Ray', True)

# invert the transfer function
terrainLUT.InvertTransferFunction()

# create a new 'NetCDF Reader'
v_5nc = NetCDFReader(registrationName='v_5.nc', FileName=['/home/interpolation/v_5.nc'])
v_5nc.Dimensions = '(z, y, x)'

# Properties modified on v_5nc
v_5nc.SphericalCoordinates = 0
v_5nc.OutputType = 'Image'

# show data in view
v_5ncDisplay = Show(v_5nc, renderView1, 'UniformGridRepresentation')

# trace defaults for the display properties.
v_5ncDisplay.Representation = 'Outline'
v_5ncDisplay.ColorArrayName = [None, '']
v_5ncDisplay.SelectTCoordArray = 'None'
v_5ncDisplay.SelectNormalArray = 'None'
v_5ncDisplay.SelectTangentArray = 'None'
v_5ncDisplay.OSPRayScaleArray = 'u'
v_5ncDisplay.OSPRayScaleFunction = 'PiecewiseFunction'
v_5ncDisplay.SelectOrientationVectors = 'None'
v_5ncDisplay.ScaleFactor = 143.6
v_5ncDisplay.SelectScaleArray = 'None'
v_5ncDisplay.GlyphType = 'Arrow'
v_5ncDisplay.GlyphTableIndexArray = 'None'
v_5ncDisplay.GaussianRadius = 7.18
v_5ncDisplay.SetScaleArray = ['POINTS', 'u']
v_5ncDisplay.ScaleTransferFunction = 'PiecewiseFunction'
v_5ncDisplay.OpacityArray = ['POINTS', 'u']
v_5ncDisplay.OpacityTransferFunction = 'PiecewiseFunction'
v_5ncDisplay.DataAxesGrid = 'GridAxesRepresentation'
v_5ncDisplay.PolarAxes = 'PolarAxesRepresentation'
v_5ncDisplay.ScalarOpacityUnitDistance = 5.170266879832471
v_5ncDisplay.OpacityArrayName = ['POINTS', 'u']
v_5ncDisplay.SliceFunction = 'Plane'
v_5ncDisplay.Slice = 60
#v_5ncDisplay.InputVectors = [None, '']

# init the 'PiecewiseFunction' selected for 'ScaleTransferFunction'
v_5ncDisplay.ScaleTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 7.755956649780273, 1.0, 0.5, 0.0]

# init the 'PiecewiseFunction' selected for 'OpacityTransferFunction'
v_5ncDisplay.OpacityTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 7.755956649780273, 1.0, 0.5, 0.0]

# init the 'Plane' selected for 'SliceFunction'
v_5ncDisplay.SliceFunction.Origin = [719.0, 719.0, 119.5]

# update the view to ensure updated data information
renderView1.Update()

# create a new 'Python Calculator'
pythonCalculator1 = PythonCalculator(registrationName='PythonCalculator1', Input=v_5nc)
pythonCalculator1.Expression = ''

# Properties modified on pythonCalculator1
pythonCalculator1.Expression = 'make_vector(u,v,w)'
pythonCalculator1.ArrayName = '3d_velocity'

# show data in view
pythonCalculator1Display = Show(pythonCalculator1, renderView1, 'UniformGridRepresentation')

# trace defaults for the display properties.
pythonCalculator1Display.Representation = 'Outline'
pythonCalculator1Display.ColorArrayName = [None, '']
pythonCalculator1Display.SelectTCoordArray = 'None'
pythonCalculator1Display.SelectNormalArray = 'None'
pythonCalculator1Display.SelectTangentArray = 'None'
pythonCalculator1Display.OSPRayScaleArray = '3d_velocity'
pythonCalculator1Display.OSPRayScaleFunction = 'PiecewiseFunction'
pythonCalculator1Display.SelectOrientationVectors = '3d_velocity'
pythonCalculator1Display.ScaleFactor = 143.6
pythonCalculator1Display.SelectScaleArray = '3d_velocity'
pythonCalculator1Display.GlyphType = 'Arrow'
pythonCalculator1Display.GlyphTableIndexArray = '3d_velocity'
pythonCalculator1Display.GaussianRadius = 7.18
pythonCalculator1Display.SetScaleArray = ['POINTS', '3d_velocity']
pythonCalculator1Display.ScaleTransferFunction = 'PiecewiseFunction'
pythonCalculator1Display.OpacityArray = ['POINTS', '3d_velocity']
pythonCalculator1Display.OpacityTransferFunction = 'PiecewiseFunction'
pythonCalculator1Display.DataAxesGrid = 'GridAxesRepresentation'
pythonCalculator1Display.PolarAxes = 'PolarAxesRepresentation'
pythonCalculator1Display.ScalarOpacityUnitDistance = 5.170266879832471
pythonCalculator1Display.OpacityArrayName = ['POINTS', '3d_velocity']
pythonCalculator1Display.SliceFunction = 'Plane'
pythonCalculator1Display.Slice = 60
#pythonCalculator1Display.InputVectors = ['POINTS', '3d_velocity']

# init the 'PiecewiseFunction' selected for 'ScaleTransferFunction'
pythonCalculator1Display.ScaleTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 7.755956649780273, 1.0, 0.5, 0.0]

# init the 'PiecewiseFunction' selected for 'OpacityTransferFunction'
pythonCalculator1Display.OpacityTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 7.755956649780273, 1.0, 0.5, 0.0]

# init the 'Plane' selected for 'SliceFunction'
pythonCalculator1Display.SliceFunction.Origin = [719.0, 719.0, 119.5]

# hide data in view
Hide(v_5nc, renderView1)

# update the view to ensure updated data information
renderView1.Update()

# set scalar coloring
ColorBy(pythonCalculator1Display, ('POINTS', '3d_velocity', 'Magnitude'))

# rescale color and/or opacity maps used to include current data range
pythonCalculator1Display.RescaleTransferFunctionToDataRange(True, False)

# show color bar/color legend
pythonCalculator1Display.SetScalarBarVisibility(renderView1, True)

# get color transfer function/color map for 'a3d_velocity'
a3d_velocityLUT = GetColorTransferFunction('a3d_velocity')

# get opacity transfer function/opacity map for 'a3d_velocity'
a3d_velocityPWF = GetOpacityTransferFunction('a3d_velocity')

# change representation type
pythonCalculator1Display.SetRepresentationType('Volume')

# create a new 'Stream Tracer'
streamTracer1 = StreamTracer(registrationName='StreamTracer1', Input=pythonCalculator1,
    SeedType='Line')
streamTracer1.Vectors = ['POINTS', '3d_velocity']
streamTracer1.MaximumStreamlineLength = 1436.0

# init the 'Line' selected for 'SeedType'
streamTracer1.SeedType.Point1 = [1.0, 1.0, 0.0]
streamTracer1.SeedType.Point2 = [1437.0, 1437.0, 239.0]

# toggle 3D widget visibility (only when running from the GUI)
Show3DWidgets(proxy=streamTracer1.SeedType)

# Properties modified on streamTracer1
streamTracer1.SeedType = 'Point Cloud'

# show data in view
streamTracer1Display = Show(streamTracer1, renderView1, 'GeometryRepresentation')

# trace defaults for the display properties.
streamTracer1Display.Representation = 'Surface'
streamTracer1Display.ColorArrayName = ['POINTS', '3d_velocity']
streamTracer1Display.LookupTable = a3d_velocityLUT
streamTracer1Display.SelectTCoordArray = 'None'
streamTracer1Display.SelectNormalArray = 'None'
streamTracer1Display.SelectTangentArray = 'None'
streamTracer1Display.OSPRayScaleArray = '3d_velocity'
streamTracer1Display.OSPRayScaleFunction = 'PiecewiseFunction'
streamTracer1Display.SelectOrientationVectors = 'Normals'
streamTracer1Display.ScaleFactor = 143.63591489195824
streamTracer1Display.SelectScaleArray = '3d_velocity'
streamTracer1Display.GlyphType = 'Arrow'
streamTracer1Display.GlyphTableIndexArray = '3d_velocity'
streamTracer1Display.GaussianRadius = 7.181795744597912
streamTracer1Display.SetScaleArray = ['POINTS', '3d_velocity']
streamTracer1Display.ScaleTransferFunction = 'PiecewiseFunction'
streamTracer1Display.OpacityArray = ['POINTS', '3d_velocity']
streamTracer1Display.OpacityTransferFunction = 'PiecewiseFunction'
streamTracer1Display.DataAxesGrid = 'GridAxesRepresentation'
streamTracer1Display.PolarAxes = 'PolarAxesRepresentation'
#streamTracer1Display.InputVectors = ['POINTS', 'Normals']

# init the 'PiecewiseFunction' selected for 'ScaleTransferFunction'
streamTracer1Display.ScaleTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 6.752197265625, 1.0, 0.5, 0.0]

# init the 'PiecewiseFunction' selected for 'OpacityTransferFunction'
streamTracer1Display.OpacityTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 6.752197265625, 1.0, 0.5, 0.0]

# show color bar/color legend
streamTracer1Display.SetScalarBarVisibility(renderView1, True)

# update the view to ensure updated data information
renderView1.Update()

# hide data in view
Hide(pythonCalculator1, renderView1)

# create a new 'Glyph'
glyph1 = Glyph(registrationName='Glyph1', Input=streamTracer1,
    GlyphType='Sphere')
glyph1.OrientationArray = ['POINTS', 'Normals']
glyph1.ScaleArray = ['POINTS', '3d_velocity']
glyph1.ScaleFactor = 143.63591489195824
glyph1.GlyphTransform = 'Transform2'

# show data in view
glyph1Display = Show(glyph1, renderView1, 'GeometryRepresentation')

# trace defaults for the display properties.
glyph1Display.Representation = 'Surface'
glyph1Display.ColorArrayName = ['POINTS', '3d_velocity']
glyph1Display.LookupTable = a3d_velocityLUT
glyph1Display.SelectTCoordArray = 'None'
glyph1Display.SelectNormalArray = 'None'
glyph1Display.SelectTangentArray = 'None'
glyph1Display.OSPRayScaleArray = '3d_velocity'
glyph1Display.OSPRayScaleFunction = 'PiecewiseFunction'
glyph1Display.SelectOrientationVectors = 'Normals'
glyph1Display.ScaleFactor = 287.66790771484375
glyph1Display.SelectScaleArray = '3d_velocity'
glyph1Display.GlyphType = 'Arrow'
glyph1Display.GlyphTableIndexArray = '3d_velocity'
glyph1Display.GaussianRadius = 14.383395385742189
glyph1Display.SetScaleArray = ['POINTS', '3d_velocity']
glyph1Display.ScaleTransferFunction = 'PiecewiseFunction'
glyph1Display.OpacityArray = ['POINTS', '3d_velocity']
glyph1Display.OpacityTransferFunction = 'PiecewiseFunction'
glyph1Display.DataAxesGrid = 'GridAxesRepresentation'
glyph1Display.PolarAxes = 'PolarAxesRepresentation'
#glyph1Display.InputVectors = ['POINTS', 'Normals']

# init the 'PiecewiseFunction' selected for 'ScaleTransferFunction'
glyph1Display.ScaleTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 6.115447998046875, 1.0, 0.5, 0.0]

# init the 'PiecewiseFunction' selected for 'OpacityTransferFunction'
glyph1Display.OpacityTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 6.115447998046875, 1.0, 0.5, 0.0]

# show color bar/color legend
glyph1Display.SetScalarBarVisibility(renderView1, True)

# update the view to ensure updated data information
renderView1.Update()

# Properties modified on glyph1
glyph1.OrientationArray = ['POINTS', '3d_velocity']
glyph1.ScaleArray = ['POINTS', 'No scale array']
glyph1.ScaleFactor = 30.163542127311228

# update the view to ensure updated data information
renderView1.Update()

# Properties modified on glyph1
glyph1.ScaleFactor = 51.708929361104964

# update the view to ensure updated data information
renderView1.Update()

#================================================================
# addendum: following script captures some of the application
# state to faithfully reproduce the visualization during playback
#================================================================

# get layout
layout1 = GetLayout()

#--------------------------------
# saving layout sizes for layouts

# layout/tab size in pixels
layout1.SetSize(1328, 659)

#-----------------------------------
# saving camera placements for views

# current camera placement for renderView1
renderView1.CameraPosition = [719.0, 719.0, 4069.800312425404]
renderView1.CameraFocalPoint = [719.0, 719.0, 119.5]
renderView1.CameraParallelScale = 1022.4129547301325


RenderAllViews()
Interact()

Thank you.

streamTracer1.SeedType.NumberOfPoints = 100 ?

Thank you… It works of course.
Sorry to bother you with these, quite embarrassing.