I am working with pvpython (paraview version 5.9). I have a calculator object, obtained from a slice. What I want to do is export the array corresponding to the velocity field, then manipulate it, load back the modified numpy array with a new name to do additional calculations (calculate the mean value).
The exporting of the array works fine with
dat = dsa.WrapDataObject(sm.Fetch(calculator9))
numpy_array = numpy_support.vtk_to_numpy(dat.PointData["Velocity"])
However, I am not sure how to create a new field in calculator9. I can add the numpy vectors to the dat object with dat.PointData.AddArray(), but this does not affect the calculator9 object.
Usually, you do not want to Fetch data in ParaView, as it does not integrate well into the pipeline architecture.
If you want to manipulate a data array in python, please use the Python Calculator filter (for one liner expressions) or the Programmable Filter for advanced use.
Thanks for the prompt reply, that is very helpful. What I still do not understand is how can one specify multiple inputs to a filter. There are examples that show how multiple inputs work inside the ProgrammableFilter.Script, but I am unsure how to initialize the filter with multiple inputs.
Thanks for the clarification. I managed to figure out that if I want to pass additonal arguments to a filter, I need to define a class like here. However, I am struggling to find any complete examples how can I use the filter class inside a pvpython script.
Once again, what I want to do create a new filter from another one. In the output filter, there is an additional field, which is created through assigning the PointData. Actually very much like in the first example of the page I linked, and I think I got the general idea, but there are still parts of the picture missing as I am not very familiar with paraview scripting.