mpycopy

This tools copies a given case setup to a new location. Simple case setups are copied without modification. Templated case setups, i.e. setups that feature

  • a top-level caseParameterTable.ecsv file in the Astropy ECSV format that lists all case variations with the corresponding parameters

  • one or more files with the ending .jinja containing placeholders for these parameters

are rendered into a ready-to-run state using the Jinja templating engine.

Templated case allow for inplace rendering. This means that the templated files can be rendered in the same location as the input template. This is useful when testing a new template setup, as it allows to quickly iterate on the template without the need to copy the template to a new location for each iteration.

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.

Inplace Rendering of a Template

Render a specific case from a template in the same location:

mpycopy --case case1 . .

This will re-render all templated files without deleting them.

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;