ResSimpy.Nexus.DataModels.Network.NexusConstraints.NexusConstraints

class ResSimpy.Nexus.DataModels.Network.NexusConstraints.NexusConstraints(parent_network: 'NexusNetwork', model: 'NexusSimulator')[source]

Bases: Constraints

Methods:

__init__(parent_network, model)

get_all([object_name, date])

Get the constraints of the existing model with optional parameters to filter for name and date :param object_name: name of the connection, node or wellname to return.

get_df()

Creates a dataframe representing all processed constraint data in a surface file :returns: DataFrame -- of the properties of the constraint through time with each row representing a change in constraint.

get_overview()

load(surface_file, start_date, default_units)

find_by_properties(object_name, constraint_dict)

Finds a uniquely matching constraint from a given set of properties in a dictionary of attributes.

remove([constraint_dict, constraint_id])

Remove a constraint based on closest matching constraint, requires node name and date.

add(name, constraint_to_add[, comments])

Adds a constraint to the network and corresponding surface file.

modify(name, current_constraint, ...[, comments])

Modify an existing constraint.

__repr__()

Return repr(self).

__eq__(other)

Return self==value.

Inherited from Constraints

get_all([object_name, date])

get_df()

get_overview()

remove()

add(name, constraint_to_add)

modify(name, current_constraint, ...[, comments])

__init__(*[, _Constraints__constraints])

__repr__()

Return repr(self).

__eq__(other)

Return self==value.


__init__(parent_network: NexusNetwork, model: NexusSimulator) None[source]
get_all(object_name: str | None = None, date: str | None = None) Mapping[str, Sequence[NexusConstraint]][source]

Get the constraints of the existing model with optional parameters to filter for name and date :param object_name: name of the connection, node or wellname to return. Defaults to None. :type object_name: Optional[str] :param date: date in model format to filter the dates to in the constraints :type date: Optional[str]

Returns: dict[str, list[NexusConstraint]] dictionary of all constraints defined within a model, keyed by the name of the well/node.

get_df() pandas.DataFrame[source]

Creates a dataframe representing all processed constraint data in a surface file :returns: DataFrame – of the properties of the constraint through time with each row representing a change in constraint.

find_by_properties(object_name: str, constraint_dict: dict[str, None | float | str | int]) NexusConstraint[source]

Finds a uniquely matching constraint from a given set of properties in a dictionary of attributes.

Parameters:
  • object_name (str) – name of the node to which the constraint is applied (node name/well name)

  • constraint_dict (dict[str, float | str | int]) – dictionary of attributes to match on. Allows for partial matches if it finds a unique constraint.

Returns:

NexusConstraint of an existing constraint in the model that uniquely matches the provided constraint_dict constraint

remove(constraint_dict: dict[str, None | float | str | int] | None = None, constraint_id: UUID | None = None) None[source]

Remove a constraint based on closest matching constraint, requires node name and date. Needs one of at least constraint dict or constraint id.

Parameters:
  • constraint_dict (Optional[dict[str, float | str | int]]) – Constraint matching these attributes will be removed. Defaults to None.

  • constraint_id (Optional[UUID]) – Constraint matching this id will be removed. Will not be used if constraint dict is provided. Defaults to None.

add(name: str, constraint_to_add: dict[str, None | float | int | str | ResSimpy.Enums.UnitsEnum.UnitSystem] | Constraint, comments: str | None = None) None[source]

Adds a constraint to the network and corresponding surface file.

Parameters:
  • name (str) – name of the node to apply constraints to

  • constraint_to_add (dict[str, float | int | str | UnitSystem] | NexusConstraint) – properties of the constraints or a constraint object

modify(name: str, current_constraint: dict[str, None | float | int | str] | Constraint, new_constraint_props: dict[str, None | float | int | str | ResSimpy.Enums.UnitsEnum.UnitSystem] | Constraint, comments: str | None = None) None[source]

Modify an existing constraint. Retains existing constraint values that are not overridden by the new constraint properties.

Parameters:
  • name (str) –

  • current_constraint (dict[str, None | float | int | str] | Constraint) – dictionary or constraint object with enough attributes to identify a unique existing constraint in the model.

  • new_constraint_props (dict[str, None | float | int | str] | Constraint) – dictionary or constraint to update the constraint with.