I have a unstructured vtk mesh with certain “group” labels as strings for the cells. When I try to color the plot by these labels using the “Interpret values as categories”, the legend shows the correct categories in the model, but the whole model has the “NaN”-color.
If I am not hallucinating, this used to work in earlier versions (pre 5.10). I also cannot extract these cells based on the group property:
File "C:\Program Files\ParaView 5.11.0\bin\Lib\site-packages\paraview\detail\python_selector.py", line 90, in execute
RuntimeError: Expression '(Group == "Brick1")' did not produce a valid mask array. The value produced is of the type '<class 'bool'>'. This typically implies a malformed expression. Verify that the expression is valid
Here is an attached simplified vtk file with this problem: test.vtu (2.1 KB)
The second issue can not be resolved, because a vtkStringArray can not be mapped to a numpy array which is used by the python selector which is used by the Find Data Panel. But i will make it not crash.
Thank you very much for adressing the issue. It is now possible to color the model based on those categorical strings, however there still seems to be an issue related to the original problem, because it is not possible to select cells based on these string values (e.g. to hide certain named regions from view).
For example, given a cell with the property name of “Slot : slot1”, when I want to extract those zones where the values is targetvalue (also a string), the following error occurs:
Error: Failed to evaluate Expression ‘(Slotslot1== targetvalue)’. The following exception stack should provide additional developer specific information. This typically implies a malformed expression. Verify that the expression is valid.
When I put targetvalue in quotation marks, the following occurs:
RuntimeError: Expression ‘(Slotslot1== “targetvalue”)’ did not produce a valid mask array.
In both cases the string property seems to be trimmed somehow.
Please let me know if I should flag this as a separate issue.
As i said before the second issue originates from the fact that a vtkStringArray can not be mapped to a numpy array which is used by the python selector, which is then used by the Find Data Panel. This mapping can not be performed (as of now) because a vtkStringArray is a special array where the memory size of each value is dynamic.
@cory.quammen do you think that anybody would be interested in supporting such functionality?
@wascott The problem is that people can not search cell or points based on an array that has string values. E.g. if can.ex2 had a point array named names and each point had a name, you can not use the find data panel to extract all the points that have their names value is red