pofff.utils.inputvalues module#

Load, validate, and normalize pofff configuration values.

This module combines command-line settings with TOML input, validates common simulation variables and workflow-specific ERT or Everest options, extracts facies and history-matching definitions, and populates derived runtime settings. Validation reports accepted values through the shared terminal helpers.

pofff.utils.inputvalues._add_validation_error(errors: list[str], message: str) None[source]#

Add a TOML validation error.

Parameters:
errorslist[str]

Validation messages collected during the current validation pass.

messagestr

Human-readable message to display or append.

pofff.utils.inputvalues._effective_workflow(cfg_file: dict[str, Any], mode: str) str[source]#

Return the effective simulation, ERT, or Everest workflow.

Parameters:
cfg_filedict[str, Any]

Cfg file used by this operation.

modestr

Selected pofff execution mode.

Returns:
str

Effective workflow name used for validation.

pofff.utils.inputvalues._is_finite_number(value: Any) bool[source]#

Return whether a value is a finite non-Boolean number.

Parameters:
valueAny

Value to inspect or format.

Returns:
bool

Whether the value is a finite, non-Boolean number.

pofff.utils.inputvalues._is_integer(value: Any) bool[source]#

Return whether a value is a non-Boolean integer.

Parameters:
valueAny

Value to inspect or format.

Returns:
bool

Whether the value is a non-Boolean integer.

pofff.utils.inputvalues._is_tuning_enabled(flow: Any) bool[source]#

Return whether TUNING is enabled in the Flow command.

Parameters:
flowAny

Flow used by this operation.

Returns:
bool

Whether the Flow command explicitly enables TUNING.

pofff.utils.inputvalues._validate_array(cfg_file: dict[str, Any], key: str, errors: list[str], length: int | None = None, integer: bool = False, minimum: float | None = None, strict: bool = False, nonempty: bool = False) bool[source]#

Check the type, length, and numeric values of a TOML array.

Parameters:
cfg_filedict[str, Any]

Cfg file used by this operation.

keystr

Configuration variable or history-matching parameter name.

errorslist[str]

Validation messages collected during the current validation pass.

lengthint | None, optional

Required array length, when specified.

integerbool, optional

Whether accepted entries must be non-Boolean integers.

minimumfloat | None, optional

Optional lower bound for accepted values.

strictbool, optional

Whether the lower bound is exclusive.

nonemptybool, optional

Whether the array must contain at least one entry.

Returns:
bool

Whether the variable is present and satisfies the array constraints.

pofff.utils.inputvalues._validate_expression(cfg_file: dict[str, Any], key: str, errors: list[str]) None[source]#

Check that a TOML variable contains a valid Python expression.

Parameters:
cfg_filedict[str, Any]

Cfg file used by this operation.

keystr

Configuration variable or history-matching parameter name.

errorslist[str]

Validation messages collected during the current validation pass.

pofff.utils.inputvalues._validate_facies(cfg_file: dict[str, Any], key: str, index: int, errors: list[str]) None[source]#

Check one fixed facies-property definition.

Parameters:
cfg_filedict[str, Any]

Cfg file used by this operation.

keystr

Configuration variable or history-matching parameter name.

indexint

One-based facies index.

errorslist[str]

Validation messages collected during the current validation pass.

pofff.utils.inputvalues._validate_history_parameter(cfg_file: dict[str, Any], key: str, workflow: str, errors: list[str]) None[source]#

Check an ERT distribution or Everest interval definition.

Parameters:
cfg_filedict[str, Any]

Cfg file used by this operation.

keystr

Configuration variable or history-matching parameter name.

workflowstr

Effective simulation, ERT, or Everest workflow.

errorslist[str]

Validation messages collected during the current validation pass.

pofff.utils.inputvalues._validate_injection_schedule(cfg_file: dict[str, Any], errors: list[str]) bool[source]#

Check injection values and return whether TUNING values are defined.

Parameters:
cfg_filedict[str, Any]

Cfg file used by this operation.

errorslist[str]

Validation messages collected during the current validation pass.

Returns:
bool

Whether at least one injection row defines TUNING values.

pofff.utils.inputvalues._validate_matrix(cfg_file: dict[str, Any], key: str, errors: list[str], rows: int, columns: int) bool[source]#

Check the dimensions and numeric values of a TOML matrix.

Parameters:
cfg_filedict[str, Any]

Cfg file used by this operation.

keystr

Configuration variable or history-matching parameter name.

errorslist[str]

Validation messages collected during the current validation pass.

rowsint

Required number of matrix rows.

columnsint

Required number of entries in each matrix row.

Returns:
bool

Whether the variable is present and has the required numeric shape.

pofff.utils.inputvalues._validate_number(cfg_file: dict[str, Any], key: str, errors: list[str], minimum: float | None = None, maximum: float | None = None, strict: bool = False, integer: bool = False) bool[source]#

Check that a TOML variable is numeric and in the expected range.

Parameters:
cfg_filedict[str, Any]

Cfg file used by this operation.

keystr

Configuration variable or history-matching parameter name.

errorslist[str]

Validation messages collected during the current validation pass.

minimumfloat | None, optional

Optional lower bound for accepted values.

maximumfloat | None, optional

Optional upper bound for accepted values.

strictbool, optional

Whether the lower bound is exclusive.

integerbool, optional

Whether accepted entries must be non-Boolean integers.

Returns:
bool

Whether the variable is present and satisfies the numeric constraints.

pofff.utils.inputvalues._validate_string(cfg_file: dict[str, Any], key: str, errors: list[str]) bool[source]#

Check that a TOML variable is a non-empty string.

Parameters:
cfg_filedict[str, Any]

Cfg file used by this operation.

keystr

Configuration variable or history-matching parameter name.

errorslist[str]

Validation messages collected during the current validation pass.

Returns:
bool

Whether the variable is present and is a non-empty string.

pofff.utils.inputvalues._validate_thickness(cfg_file: dict[str, Any], errors: list[str]) None[source]#

Check the thickness-map selection or numeric thickness.

Parameters:
cfg_filedict[str, Any]

Cfg file used by this operation.

errorslist[str]

Validation messages collected during the current validation pass.

pofff.utils.inputvalues._validate_toml(cfg_file: dict[str, Any], mode: str) dict[str, Any][source]#

Validate and normalize TOML configuration values.

Parameters:
cfg_filedict[str, Any]

Cfg file used by this operation.

modestr

Selected pofff execution mode.

Returns:
dict[str, Any]

Validated configuration values suitable for PofffConfig.

Raises:
SystemExit

If one or more configuration values are invalid.

pofff.utils.inputvalues._warn_and_remove(cfg_file: dict[str, Any], keys: set[str], message: str) None[source]#

Warn about ineffective variables and remove them.

Parameters:
cfg_filedict[str, Any]

Cfg file used by this operation.

keysset[str]

Configuration variables to remove when they are ineffective.

messagestr

Human-readable message to display or append.

pofff.utils.inputvalues.build_config(*, pofff_path: Path, cli: CliConfig, toml: dict) PofffConfig[source]#

Build and return a fully initialized PofffConfig object.

Parameters:
pofff_pathPath

Package root containing templates, geology, jobs, and benchmark data.

cliCliConfig

Cli used by this operation.

tomldict

Validated TOML values used to populate the runtime configuration.

Returns:
PofffConfig

Runtime configuration populated from CLI and TOML values.

pofff.utils.inputvalues.extract_facies(data: dict) dict[source]#

Extract definitions and remove them from the main config dict.

Parameters:
datadict

Configuration dictionary modified while extracting definitions.

Returns:
dict

Facies tables removed from the input dictionary.

pofff.utils.inputvalues.load_toml(filename: str, mode: str) dict[source]#

Load and validate a TOML configuration file.

Parameters:
filenamestr

Path to the input file.

modestr

Selected pofff execution mode.

Returns:
dict

Validated and normalized TOML configuration values.

Raises:
SystemExit

If the TOML configuration is invalid.

pofff.utils.inputvalues.postprocess_config(cfg: PofffConfig, toml: dict) None[source]#

Enrich configuration with derived values and runtime flags.

The function converts diffusion to m²/day and populates derived grid, history-matching, and workflow flags on cfg.

Parameters:
cfgPofffConfig

Shared pofff configuration and derived runtime state.

tomldict

Validated TOML values used to populate the runtime configuration.

pofff.utils.inputvalues.process_tuning(cfg: PofffConfig) None[source]#

Enable tuning and normalize injection specifications if requested.

Injection rows with TUNING text are expanded in place and cfg.tuning is enabled.

Parameters:
cfgPofffConfig

Shared pofff configuration and derived runtime state.