Thank you for your reply.
Unfortunately, It is not clear. What is Field data? How to create it ?
I can’t find information on internet.
the Array association , can be only specified as:
Point Data
orCell Data
They can be specified as FieldData the same way.
https://vtk.org/doc/nightly/html/classvtkDataObject.html#ae20049ae4de96b695ffbbfe80f21ff68
You can just use that in your programmable filter.
Sorry, this is confusing? I am not programming, I am just using Paraview.
Could you please give me some context? Because I feel lost.
Thank you
You mention using Python and trying with PointData and CellData.
How did you try that ? can you share what you did ?
This is called a Python Calculator.
Sadly the python calculator cannot compute a “global” FieldData.
In order to do that, you can :
- Use the
AddFieldArrays
filter, but you need to have a file containing a field data to provide, not very practical - Use a
Python Programmable Filter
, which would require you to learn a little bit of Python, see here for examples : https://www.paraview.org/Wiki/Python_Programmable_Filter
That being said, I think that it should be possible to create single tuple field data arrays in the calculator and the python calculator, please feel free to open a issues on our gitlab : https://gitlab.kitware.com/paraview/paraview/-/issues
I have a follow up question though, where does “t_value
” come from ?
Thank you for the details
I have a follow up question though, where does “
t_value
” come from ?
I think Paraview provides a set of available variable when using Python annotation or Python Calculator. In my case, I have a transient simulation, so t_value
is the variable that stores the current time.
I found this:
The Python expression evaluated during execution. FieldData arrays are direclty available through their name. Set of provided variables [input, t_value, t_steps, t_range, t_index, FieldData, PointData, CellData] (i.e.: "Momentum: (%f, %f, f)" XMOM[t_index,0], YMOM[t_index,0], ZMOM[t_index,0]) )
From Paraview docs
Indeed ! Well my previous post stands then.
But, In Python Programmer filter documentation I cannot find anything related to fieldData.
So is true to conclude: It is not possible to create a field data from within Paraview using Python scripting?
It is, using Python ProgrammableFilter.
pdi = self.GetInput()
pdo = self.GetOutput()
data = vtk.vtkDoubleArray()
data.SetName("MyFielData")
data.InsertNextValue(13.37)
pdo.GetFieldData().AddArray(data)
Thanks that’s interesting, but I can’t access the time variable (is there something similar to t_value
in Python calculator filter?).
I mean, instead of the value 13.37
I would like something like 5*cos(13.37*time)
.
Well, I found the answer here: https://www.paraview.org/pipermail/paraview/2013-September/029260.html
Indeed, this should work.
Hi Mathieu,
I want to use ParaView_v5.6.0 filter AddFieldArrays. I am trying to add field array data specified in csv file ‘Cell Data.csv’, but it is throwing error message, attached are images of input_dataset, error_message and csv file.
Any comments or suggestions will be much appreciated.
Thanks & Regards,
Tarun
Cell Data.csv (173 Bytes)
Add field arrays is not compatible with .csv file. You will need to open your csv file directly and then compine it with your dataset using the python calculator.
Thanks Mathieu. That I can do with python. I just want to see where this filter is applicable. Is there any other file format where addfieldarrays filter works. Any working example on using Addfieldarrays will be a great help.
Thanks,
Tarun
Many thanks for your quick reply Mathieu!.
This example gives me a full understanding on how to AddFieldArrays filer in ParaView.
Thanks & Regards,
Tarun