How to get list of available blocks from a reader in ParaView 5.11 in Python interface


What is the proper way to get a list of available blocks in a reader (my reader is the IOSSReader) when I’m in the Python shell?

I can see that the reader is going to read in reader.ElementBlocks but it would be nice if there was a reader.ElementBlocksAvailable property showing me what’s available from the reader.


Andy, you can do this to get the list of element block names:

s = IOSSReader(...)

Nope, it’s not obvious. ElementBlockInfo is an information_only property, so it is not made available as an attribute on the s object, hence the GetProperty() call.

You can also use the GetAvailable() API call:

>>> ioss_reader = OpenDataFile("..can.ex2")
>>> ioss_reader.ElementBlocks.GetAvailable()
['block_1', 'block_2']

# also supported by other "selection" properties, e.g.
>>> a.NodeSets.GetAvailable()
['nodelist_1', 'nodelist_100']
>>> a.ElementBlockFields.GetAvailable()
>>> a.NodeBlockFields.GetAvailable()
['ACCL', 'DISPL', 'VEL']
1 Like