pyopmspe11.utils.inputvalues module#
Read, validate, and initialize pyopmspe11 configuration values.
The module loads TOML or legacy text input, validates types and case-dependent requirements, converts physical units, and derives grid dimensions, benchmark regions, sensor locations, and other runtime settings stored in Config.
- build_config(cli)[source]#
Build the shared runtime configuration.
Read the selected TOML or legacy text file, merge command-line selections, validate values, and derive case-dependent settings.
- _finalize_config(cfg, time, msg)[source]#
Convert units and populate derived configuration values.
The function derives grid dimensions, transforms depth coordinates, normalizes physical properties, and separates optional TUNING values.
- check_flow_version(cfg)[source]#
Check that the configured OPM Flow release is supported.
- Parameters:
- cfgConfig
Initialized runtime configuration.
- Raises:
- SystemExit
If an input value is invalid or required input cannot be used.
- Parameters:
cfg (Config)
- Return type:
None
- _validate_string(cfg_file, key, errors)[source]#
Check that a TOML variable is a non-empty string.
- Parameters:
- cfg_filedict[str, Any]
TOML values to validate or normalize.
- keystr
Name of the TOML variable.
- errorslist[str]
Validation messages collected so far.
- Returns:
- bool
Whether the requested condition is satisfied.
- Parameters:
- Return type:
- _validate_number(cfg_file, key, errors, minimum=None, strict=False)[source]#
Check that a TOML variable is a finite number in the expected range.
- Parameters:
- cfg_filedict[str, Any]
TOML values to validate or normalize.
- keystr
Name of the TOML variable.
- errorslist[str]
Validation messages collected so far.
- minimumfloat | None, optional
Optional lower bound for accepted values.
- strictbool, optional
Whether the lower bound is exclusive.
- Returns:
- bool
Whether the requested condition is satisfied.
- Parameters:
- Return type:
- _validate_array(cfg_file, key, errors, length=None, integer=False, minimum=None, strict=False, nonempty=False)[source]#
Check the type, length, and values of a TOML array.
- Parameters:
- cfg_filedict[str, Any]
TOML values to validate or normalize.
- keystr
Name of the TOML variable.
- errorslist[str]
Validation messages collected so far.
- lengthint | None, optional
Required array length, if specified.
- integerbool, optional
Whether every array entry must be an integer.
- 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 requested condition is satisfied.
- Parameters:
- Return type:
- _validate_matrix(cfg_file, key, errors, rows, columns)[source]#
Check the dimensions and numeric values of a TOML matrix.
- Parameters:
- cfg_filedict[str, Any]
TOML values to validate or normalize.
- keystr
Name of the TOML variable.
- errorslist[str]
Validation messages collected so far.
- rowsint
Required number of matrix rows.
- columnsint
Required number of matrix columns.
- Returns:
- bool
Whether the requested condition is satisfied.
- Parameters:
- Return type:
- _validate_coordinates(cfg_file, key, errors)[source]#
Check that well coordinates are inside the model dimensions.
- _validate_expression(cfg_file, key, errors)[source]#
Check that a TOML variable contains a valid Python expression.
- _validate_injection_schedule(cfg_file, errors)[source]#
Check injection values and return whether TUNING values are defined.