mpycopy

This tools copies a given case setup to a new location. Templated case setups are rendered so that the setup is ready-to-run. The tool uses Astropy for reading case parameters from a caseParameterTable.ecsv file. Copier is then used to create a copy of the template and filling in parameter values into a caseParameterDict.jinja file, creating a readable caseParameterDict.

The copy process:

  • Copies simple case setups without modification

  • Renders templated cases with Jinja2 variable substitution

  • Reads parameters from caseParameterTable.ecsv

Usage

mpycopy input output [options]

where input is the (templated) case to be copied to the output directory.

Examples

Render a Single Case from Template

Render a specific case from a templated setup:

mpycopy --case case1 ./template ./run/case1

Render All Cases from Template

Render all cases defined in the parameter table:

mpycopy ./template ./run

This will create subdirectories in ./run for each case defined in caseParameterTable.ecsv.

Template Structure

A templated case should contain:

caseParameterTable.ecsv - Table with case parameters:

case velocity temperature
---- -------- -----------
low  0.5      300
high 1.0      350

caseParameterDict.jinja - Jinja2 template file:

velocity {{ velocity }};
temperature {{ temperature }};

After rendering, the template file caseParameterDict.jinja becomes caseParameterDict with values filled in:

velocity 0.5;
temperature 300;