A minimal Python package that finds the volume ids and the material tags in a DAGMC h5m file.
Create a new conda environment and activate it
conda create --name new_env python=3.9
conda activate new_env
The dagmc-h5m-file-inspector package can be installed with a single conda install terminal command.
conda install -c fusion-energy -c conda-forge dagmc_h5m_file_inspector
The dagmc-h5m-file-inspector package requires pymoab which can be installed alongside Moab with a conda install command. Moab is not avialable on pip, however it can be installed with Conda.
Create a new conda environment and activate it
conda create --name new_env python=3.9
conda activate new_env
Then install Moab and dagmc-h5m-file-inspector
conda install -c conda-forge moab
pip install dagmc-h5m-file-inspector
Finding the volume IDs in a DAGMC h5m file.
import dagmc_h5m_file_inspector as di
di.get_volumes_from_h5m("dagmc.h5m")
>>> [1, 2]
Finding the material tags in a DAGMC h5m file.
import dagmc_h5m_file_inspector as di
di.get_materials_from_h5m("dagmc.h5m")
>>> ['steel', 'graveyard']
Finding the volume IDs with their materials present in a DAGMC h5m file.
import dagmc_h5m_file_inspector as di
di.get_volumes_and_materials_from_h5m("dagmc.h5m")
>>> {1: 'steel', 2: 'graveyard'}
The options for the command line tool can be obtained with inspect-dagmc-h5m-file --help
Print the volume IDs present in a dagmc h5m file to the terminal
inspect-dagmc-h5m-file -i dagmc.h5m -v
>>> Volume IDs =[1, 2]
Print the material tags present in a dagmc h5m file to the terminal
inspect-dagmc-h5m-file -i dagmc.h5m -m
>>> Material tags =['steel', 'graveyard']
Print the volume IDs and materials present in a dagmc h5m file to the terminal
inspect-dagmc-h5m-file -i dagmc.h5m -b
>>> Volume IDs and material tags=
{ 1: 'steel',
2: 'graveyard'}
Write the volume IDs and materials present in a dagmc h5m file to a txt file
inspect-dagmc-h5m-file -i dagmc.h5m -b -o output.txt
>>> writing file output.txt
This package is based on a Python script by @gonuke