There’s a chance this exists already, but I wrote a package for reading/modifying/creating prm files, and uploaded it to PyPi. I think it’ll be useful for spinning up suites of models.
I’ll add something about it to the manual when I get a chance, but for now here’s some info about how to install and use it, if anyone’s interested.
pip install pyrameters
Example:
from pyrameters import PRM
params = PRM()
params['Dimension'] = 3
params.set('/Postprocess/Visualization/Output format', 'vtu')
print(params)
Outputs:
set Dimension = 3
subsection Postprocess
subsection Visualization
set Output format = vtu
end
end
Or load parameters from a file:
from pyrameters import PRM
with open('input.prm','r') as input:
params = PRM(input.read())
if params['Dimension'] == 2:
params['Output directory'] = 'results-in-2D'
else:
params['Output directory'] = 'results-in-3D'
print(params)
More info here: