[Paraview] How to Rename Blocks in Exodus File

David Thompson david.thompson at kitware.com
Wed Dec 12 00:30:22 EST 2012


Hi Dennis,

> I would like to rename the Exodus blocks to useful names, in a macro script, reading the names from a file. ...

Before doing this in ParaView, does it make sense to change the Exodus file instead? That way the names would stay changed across ParaView sessions and any other applications that use the file will have access to them. You should be able to use netcdf4-python ( http://code.google.com/p/netcdf4-python/ ) to get/set the element block names (since Exodus files are just netCDF files that follow a particular naming convention). If the "eb_names" variable exists in the netCDF file, you can alter it. Otherwise, you can add it and save the file. See the VTKData repository ( http://vtk.org/VTKData.git ) for an example file (edgeFaceElem.exii) that has names in it. The ncdump and ncgen programs that come with NetCDF are also useful for editing small files; I would advise using them to examine and modify edgeFaceElem.exii before writing a Python script to change things.

> so using src=ExodusIIReader I can use SetData on src.ElementBlocks and change that - which accomplishes nothing except de-activating all my blocks

I'm not sure how "src=ExodusIIReader; src.ElementBlocks" works at all. Are you using Tools->Python Shell to run Python commands? Or a Programmable Filter?

> However,  I need to change src.ElementBlocks.Available and I can't figure out how to do that as there is no SetData and nothing else I tried works


Given my confusion above, I cannot be sure, but it looks like you are trying to modify the reader and not the data that it loads. But the reader in ParaView is part of a pipeline that creates the dataset and modifies it as the user requests changes (e.g., load variable "A", turn off block "B", and so on), so even if you were to modify the reader's output data, it would not stay changed.

If you want the names to be different in filters that connect to the reader, you'll have to create an intermediate Programmable Filter that runs a Python script to change block names. See http://www.paraview.org/Wiki/Python_Programmable_Filter for more information, but be aware that you'll need some knowledge of how VTK multiblock datasets are named to make this work.

	David


More information about the ParaView mailing list