pyopmnearwell.utils.inputvalues module#
Read, validate, and initialize pyopmnearwell configuration values.
The module loads TOML input, applies defaults, validates full simulations and table-only configurations, reports ineffective values, checks expressions used by table generation, normalizes optional TUNING records, and derives grid and runtime values stored in the shared configuration dictionary.
- process_input(dic, in_file)[source]#
Load, validate, and initialize the shared configuration dictionary.
- Parameters:
dic (Any) -- Shared pyopmnearwell configuration dictionary.
in_file (Any) -- Path to the TOML configuration file.
- Returns:
Result produced by the operation.
- Return type:
Any
- Raises:
SystemExit -- If the documented validation or operation fails.
- process_tuning(dic)[source]#
Detect Flow TUNING support and normalize TUNING records in the injection schedule.
- Parameters:
dic (Any) -- Shared pyopmnearwell configuration dictionary.
- Returns:
Result produced by the operation.
- Return type:
Any
- _is_finite_number(value)[source]#
Return whether a value is a finite, non-Boolean number.
- Parameters:
value (Any) -- Value used by the operation.
- Returns:
Whether the requested validation condition is satisfied.
- Return type:
- _is_integer(value)[source]#
Return whether a value is a non-Boolean integer.
- Parameters:
value (Any) -- Value used by the operation.
- Returns:
Whether the requested validation condition is satisfied.
- Return type:
- _add_validation_error(errors, message)[source]#
Append a TOML validation message to the collected errors.
- _validate_number(cfg_file, key, errors, minimum=None, strict=False)[source]#
Validate a finite TOML number and its optional lower bound.
- Parameters:
- Returns:
Whether the requested validation condition is satisfied.
- Return type:
- _validate_array(cfg_file, key, errors, length=None, integer=False, minimum=None, strict=False, nonempty=False)[source]#
Validate a numeric TOML array, its shape, and its entries.
- Parameters:
cfg_file (dict[str, Any]) -- TOML values to validate or normalize.
key (str) -- Name of the TOML variable.
length (int | None, optional) -- Required array length.
integer (bool, optional) -- Whether every array entry must be an integer.
minimum (float | None, optional) -- Optional inclusive or exclusive lower bound.
strict (bool, optional) -- Whether
minimumis an exclusive bound.nonempty (bool, optional) -- Whether at least one array entry is required.
- Returns:
Whether the requested validation condition is satisfied.
- Return type:
- _validate_expression(cfg_file, key, errors)[source]#
Validate a saturation expression with a restricted Python AST.
- _validate_injection(cfg_file, errors)[source]#
Validate injection schedule records and detect TUNING values.
- _validate_records(cfg_file, key, errors, columns, minimum=None)[source]#
Validate a non-empty matrix of fixed-width numeric records.
- Parameters:
- Returns:
Whether the requested validation condition is satisfied.
- Return type:
- _is_tuning_enabled(flow)[source]#
Return whether the Flow command enables TUNING.
- Parameters:
flow (Any) -- OPM Flow command and command-line options.
- Returns:
Whether the requested validation condition is satisfied.
- Return type:
- _warn_ignored(cfg_file, keys, reason)[source]#
Warn about ineffective TOML variables and remove them.
- _validate_toml(cfg_file)[source]#
Validate and normalize all supported TOML configuration values.
- Parameters:
cfg_file (dict[str, Any]) -- TOML values to validate or normalize.
- Returns:
Whether the requested validation condition is satisfied.
- Return type:
- Raises:
SystemExit -- If the documented validation or operation fails.