How to extract fields container from a h5 result file, using result name that appears in hdf viewer?
Rohith Patchigolla
Member, Moderator, Employee Posts: 218
✭✭✭✭
in Structures
How to extract via Mechanical scripting console data from h5 file, based on the result names that appear in hdf viewer file?
Tagged:
0
Comments
-
In Mechanical, you can extract the fields container using the result name in the hdf viewer, "S_data" using custom result operator as shown below.
import mech_dpf import Ans.DataProcessing as dpf mech_dpf.setExtAPI(ExtAPI) filepath = r"D:\h5\dpf.h5" dataSource = dpf.DataSources() dataSource.SetResultFilePath(filepath,"h5dpf") model_h5 = dpf.Model(dataSource) op2 = dpf.operators.serialization.hdf5dpf_custom_read() op2.inputs.data_sources.Connect(dataSource) op2.inputs.result_name.Connect("BFE_data") bfe_fc = op2.outputs.field_or_fields_container.GetDataT1()
0 -
@Rohith Patchigolla , can you provide example of how you generated such an h5 file?
Are there any further options to configure the reading? For example the different items are under “Results” path, but that seems assumed as it is not specified directly in the operator inputs.Lastly, anything to get a DPF mesh from the h5 instead of fields?
0