plopm.utils.initialization module#

Build and normalize configuration for plopm workflows.

The module converts parsed CLI arguments into PlopmConfig, discovers simulation cases, normalizes per-variable plotting settings, selects summary or spatial processing, and defines unit conversions used by the readers.

build_config(cmdargs)[source]#

Build a plopm configuration from parsed CLI arguments.

The function expands case and difference-input paths, parses list-like options, normalizes slice and restart selections, and initializes plotting defaults shared by summary, map, and VTK workflows.

Parameters:
cmdargsargparse.Namespace

Command-line arguments returned by the plopm parser.

Returns:
PlopmConfig

Parsed and partially normalized runtime configuration.

Parameters:

cmdargs (Namespace)

Return type:

PlopmConfig

init_maps(cfg)[source]#

Normalize settings used by spatial maps.

The function selects default units, colorbar formats, and colormaps; expands per-variable limits and formats; and initializes spatial coordinate scales.

Parameters:
cfgPlopmConfig

Configuration updated in place for map generation.

Parameters:

cfg (PlopmConfig)

Return type:

None

spatial_unit(unit)[source]#

Get the conversion and label for a spatial unit.

Parameters:
unitstr

Spatial-unit code.

Returns:
tuple[float, str]

Factor converting metres and the formatted unit label.

Parameters:

unit (str)

Return type:

tuple[float, str]

mass_unit(mskl)[source]#

Get the display unit for a mass scale factor.

Parameters:
msklfloat

Factor applied to quantities stored in kilograms.

Returns:
str

Matplotlib-formatted mass unit, or an empty string when unknown.

Parameters:

mskl (float)

Return type:

str

is_summary(cfg)[source]#

Determine whether the request uses one-dimensional output.

The decision considers explicit series options, special tabulated properties, summary-vector availability, and requests to list variables.

Parameters:
cfgPlopmConfig

Initialized configuration and primary case path.

Returns:
bool

True when the request should use the summary plotting workflow.

Parameters:

cfg (PlopmConfig)

Return type:

bool

init_summary(cfg)[source]#

Normalize settings used by one-dimensional plots.

Parameters:
cfgPlopmConfig

Configuration updated in place with per-variable styles and labels.

Parameters:

cfg (PlopmConfig)

Return type:

None