geolib.models.dstability.dstability_model

Classes

DStabilityCalculationModel(value[, names, ...])

Set Type of Calculation.

DStabilityCalculationType(value[, names, ...])

Set Type of Calculation.

DStabilityModel(*args, **data)

D-Stability is software for soft soil slope stability.

DStabilityObject(**data)

class geolib.models.dstability.dstability_model.DStabilityCalculationModel(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Set Type of Calculation.

Bishop = 1
Spencer = 3
UpliftVan = 2
class geolib.models.dstability.dstability_model.DStabilityCalculationType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Set Type of Calculation.

BoundarySearch = 1
SingleCalc = 2
class geolib.models.dstability.dstability_model.DStabilityModel(*args, **data)

D-Stability is software for soft soil slope stability.

This model can read, modify and create .stix files

add_calculation(scenario_index=None, label='Calculation', notes='', set_current=True)

Add a new calculation to the model.

Parameters:
  • scenario_index (Optional[int]) – The scenario index to add the calculation to, defaults to the current scenario.

  • label (str) – Label for the calculation.

  • notes (str) – Notes for the calculation.

  • set_current (bool) – Whether to make the new calculation the current calculation.

Return type:

int

Returns:

the id of the new stage

add_excavation(points, label, notes='', scenario_index=None, stage_index=None)
Parameters:
  • points (List[Point])

  • label (str)

  • notes (str)

  • scenario_index (Optional[int])

  • stage_index (Optional[int])

add_head_line(points, label='', notes='', is_phreatic_line=False, scenario_index=None, stage_index=None)

Add head line to the model

Parameters:
  • points (List[Point]) – list of Point classes

  • label (str) – label defaults to empty string

  • notes (str) – notes defaults to empty string

  • is_phreatic_line (bool) – set as phreatic line, defaults to False

  • scenario_index (Optional[int]) – scenario to add to, defaults to the current scenario

  • stage_index (Optional[int]) – stage to add to, defaults to the current stage

Returns:

id of the added headline

Return type:

bool

add_layer(points, soil_code, label='', notes='', scenario_index=None, stage_index=None)

Add a soil layer to the model

Parameters:
  • points (List[Point]) – list of Point classes, in clockwise order (non closed simple polygon)

  • soil_code (str) – code of the soil for this layer

  • label (str) – label defaults to empty string

  • notes (str) – notes defaults to empty string

  • scenario_index (Optional[int]) – scenario to add to, defaults to the current scenario

  • stage_index (Optional[int]) – stage to add to, defaults to the current stage

Returns:

id of the added layer

Return type:

int

add_layer_and_connect_points(current_layers, new_layer)

Adds a new layer to the list of layers and connects the points of the new layer to the existing layers.

Parameters:
add_load(load, consolidations=None, scenario_index=None, stage_index=None)

Add a load to the object.

The geometry should be defined before adding loads.

If no consolidations are provided, a Consolidation with default values will be made for each SoilLayer. It is not possible to set consolidation degrees of loads afterwards since they don’t have an id.

Parameters:
  • load (DStabilityLoad) – A subclass of DStabilityLoad.

  • scenario_index (Optional[int]) – scenario to add to, defaults to the current scenario.

  • stage_index (Optional[int]) – stage to add to, defaults to the current stage.

  • consolidations (Optional[List[Consolidation]])

Raises:

ValueError – When the provided load is no subclass of DStabilityLoad, an invalid stage_index is provided, or the datastructure is no longer valid.

Return type:

None

add_reference_line(points, bottom_headline_id, top_head_line_id, label='', notes='', scenario_index=None, stage_index=None)

Add reference line to the model

Parameters:
  • points (List[Point]) – list of Point classes

  • bottom_headline_id (int) – id of the headline to use as the bottom headline

  • top_head_line_id (int) – id of the headline to use as the top headline

  • label (str) – label defaults to empty string

  • notes (str) – notes defaults to empty string

  • scenario_index (Optional[int]) – scenario to add to, defaults to the current scenario

  • stage_index (Optional[int]) – stage to add to, defaults to the current stage

Returns:

id of the added reference line

Return type:

int

add_reinforcement(reinforcement, scenario_index=None, stage_index=None)

Add a reinforcement to the model.

Parameters:
  • reinforcement (DStabilityReinforcement) – A subclass of DStabilityReinforcement.

  • scenario_index (Optional[int]) – scenario to add to, defaults to the current scenario.

  • stage_index (Optional[int]) – stage to add to, defaults to the current stage.

Returns:

Assigned id of the reinforcements (collection object of all reinforcements for a stage).

Return type:

int

Raises:

ValueError – When the provided reinforcement is no subclass of DStabilityReinforcement, an invalid stage_index is provided, or the datastructure is no longer valid.

add_scenario(label='Scenario', notes='', set_current=True)

Add a new scenario to the model.

Parameters:
  • label (str) – Label for the scenario.

  • notes (str) – Notes for the scenario.

  • set_current (bool) – Whether to make the new scenario the current scenario.

Return type:

int

Returns:

the id of the new stage

add_soil(soil)

Add a new soil to the model. The code must be unique, the id will be generated

Parameters:

soil (Soil) – a new soil

Returns:

id of the added soil

Return type:

int

add_soil_correlation(list_correlated_soil_ids)

Add a soil correlation to the model.

Parameters:

list_correlated_soil_ids (List[str]) – A list of soil ids that are correlated.

add_soil_layer_consolidations(soil_layer_id, consolidations=None, scenario_index=None, stage_index=None)

Add consolidations for a layer (layerload).

Consolidations cannot be added when adding soil layers since in the consolidations, all other soil layers need to be referred. Therefore, all soillayers in a stage should be defined before setting consolidation and the number of consolidations given should equal the amount of layers.

Parameters:
  • soil_layer_id (int) – Consolidation is set for this soil layer id.

  • consolidations (Optional[List[Consolidation]]) – List of Consolidation. Must contain a Consolidation for every other layer.

  • scenario_index (Optional[int]) – scenario to add to, defaults to the current scenario.

  • stage_index (Optional[int]) – stage to add to, defaults to the current stage.

Raises:

ValueError – When the provided load is no subclass of DStabilityLoad, an invalid stage_index is provided, or the datastructure is no longer valid.

Return type:

None

add_stage(scenario_index=None, label='Stage', notes='', set_current=True)

Add a new stage to the model at the given scenario index.

Parameters:
  • scenario_index (Optional[int]) – The scenario index to add the stage to, defaults to the current scenario.

  • label (str) – Label for the stage.

  • notes (str) – Notes for the stage.

  • set_current (bool) – Whether to make the new stage the current stage.

Return type:

int

Returns:

the id of the new stage

add_state_correlation(correlated_state_ids, scenario_index=None, stage_index=None)

Add state correlation between the given state point ids.

Parameters:
  • correlated_state_ids (List[int]) – The state point ids to correlate.

  • scenario_index (Optional[int]) – scenario to add to, defaults to the current scenario.

  • stage_index (Optional[int]) – stage to add to, defaults to the current stage.

Returns:

None

add_state_line(points, state_points, scenario_index=None, stage_index=None)

Add state line. From the Soils, only the state parameters are used.

points are a list of points with x,z coordinates state_point are a list of DStabilityStateLinePoint where ONLY the x is used, the Z will be calculated

Parameters:
  • points (List[Point]) – The geometry points of the state line.

  • state_point (List[DStabilityStatePoint]) – The list of state point values.

  • scenario_index (Optional[int]) – scenario to add to, defaults to the current scenario.

  • stage_index (Optional[int]) – stage to add to, defaults to the current stage.

  • state_points (List[DStabilityStateLinePoint])

Returns:

The created state line

Return type:

PersistableStateLine

add_state_point(state_point, scenario_index=None, stage_index=None)

Add state point to the model

Parameters:
  • state_point (DStabilityStatePoint) – DStabilityStatePoint class

  • scenario_index (Optional[int]) – scenario to add to, defaults to the current scenario

  • stage_index (Optional[int]) – stage to add to, defaults to the current stage

Returns:

id of the added add_state_point

Return type:

int

connect_layers(layer1, layer2)

Connects two polygons by adding a the missing points on the polygon edges. Returns the two new polygons.

Parameters:
current_calculation: int
current_id: int
current_scenario: int
current_stage: int
property custom_console_path: Path
datastructure: DStabilityStructure

This is the base class for all models in GEOLib.

Note that datastructure is a SerializeAsAny type, which means that the inheriting class is serialized according to its own definition (duck-typing). This is needed since Pydantic v2 as the default behavior has changed: https://docs.pydantic.dev/latest/concepts/serialization/#subclass-instances-for-fields-of-basemodel-dataclasses-typeddict

property default_console_path: Path
dstability_points_to_shapely_polygon(points)
Parameters:

points (List[PersistablePoint])

Return type:

Polygon

geolib_points_to_shapely_polygon(points)
Parameters:

points (List[Point])

Return type:

Polygon

get_calculation_index(calculation_index)
Parameters:

calculation_index (Optional[int])

static get_color_from_soil_id(soil_visualizations, soil_id)
Parameters:
Return type:

str

get_result(scenario_index=None, calculation_index=None)

Returns the results of a calculation. Calculation results are based on analysis type and calculation type.

Parameters:
  • scenario_index (Optional[int]) – Index of a scenario, if None is supplied the result of the current scenario is returned.

  • calculation_index (Optional[int]) – Index of a calculation, if None is supplied the result of the current calculation is returned.

Returns:

The analysis results of the stage.

Return type:

DStabilityResult

Raises:

ValueError – No results or calculationsettings available

get_scenario_index(scenario_index)
Parameters:

scenario_index (Optional[int])

get_slipcircle_result(scenario_index=None, calculation_index=None)

Get the slipcircle(s) of the calculation result of a given stage.

Parameters:
  • scenario_index (Optional[int]) – scenario for which to get the available results

  • calculation_index (Optional[int]) – calculation for which to get the available results

Returns:

the slipcircle for the given calculation

Return type:

Union[BishopSlipCircleResult, UpliftVanSlipCircleResult]

Raises:
  • ValueError – Result is not available for provided scenario and calculation index

  • AttributeError – When the result has no slipcircle. Try get the slipplane

get_slipplane_result(scenario_index=None, calculation_index=None)

Get the slipplanes of the calculations result of a calculation.

Parameters:
  • scenario_index (Optional[int]) – scenario for which to get the available results

  • calculation_index (Optional[int]) – calculation for which to get the available results

Returns:

the slip plane for the given calculation

Return type:

SpencerSlipPlaneResult

Raises:
  • ValueError – Result is not available for provided scenario and calculation index

  • AttributeError – When the result has no slipplane. Try get the slipcircle

get_soil(code)

Gets an existing soil with the given soil code.

Parameters:

code (str) – the code of the soil

Returns:

the soil

Return type:

PersistableSoil

get_soil_by_name(name)

Gets an existing soil with the given soil name.

Parameters:

name (str) – the name of the soil

Returns:

the soil

Return type:

PersistableSoil

static get_soil_id_from_layer_id(layers, layer_id)
Parameters:
Return type:

Optional[str]

get_stage_index(stage_index)
Parameters:

stage_index (Optional[int])

has_result(scenario_index=None, calculation_index=None)

Returns whether a calculation has a result.

Parameters:
  • scenario_index (Optional[int]) – Index of a scenario, if None the current scenario is used.

  • calculation_index (Optional[int]) – Index of a calculation, if None the current calculation is used.

Returns:

Value indicating whether the calculation has a result.

Return type:

bool

make_points_valid(points)
Parameters:

points (List[Point])

Return type:

List[PersistablePoint]

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

property output: List[UpliftVanResult | UpliftVanParticleSwarmResult | UpliftVanReliabilityResult | UpliftVanParticleSwarmReliabilityResult | SpencerGeneticAlgorithmResult | SpencerReliabilityResult | SpencerGeneticAlgorithmReliabilityResult | SpencerResult | BishopBruteForceResult | BishopReliabilityResult | BishopBruteForceReliabilityResult | BishopResult | None]

Access internal dict-like datastructure of the output.

Requires a successful execute.

parse(*args, **kwargs)

Parse input or outputfile to Model, depending on extension.

property parser_provider_type: Type[DStabilityParserProvider]

Returns the parser provider type of the current concrete class.

Raises:

NotImplementedError – If not implemented in the concrete class.

Returns:

Type[BaseParserProvider] – Concrete parser provider.

plot(scenario_index=None, stage_index=None)
Parameters:
  • scenario_index (Optional[int])

  • stage_index (Optional[int])

property points

Enables easy access to the points in the internal dict-like datastructure. Also enables edit/delete for individual points.

property scenarios: List[Scenario]
serialize(location)

Support serializing to directory while developing for debugging purposes.

Parameters:

location (Union[Path, BinaryIO])

set_model(analysis_method, scenario_index=None, calculation_index=None)

Sets the model and applies the given parameters

Parameters:
  • analysis_method (DStabilityAnalysisMethod) – A subclass of DStabilityAnalysisMethod.

  • scenario_index (Optional[int]) – scenario to add to, defaults to the current scenario

  • calculation_index (Optional[int]) – calculation to add to, defaults to the current calculation

Raises:
  • ValueError – When the provided analysis method is no subclass of DStabilityAnalysisMethod,

  • an invalid stage_index is provided, the analysis method is not known or the datastructure is no longer valid.

Return type:

None

property soil_correlations: SoilCorrelation
property soils: SoilCollection

Enables easy access to the soil in the internal dict-like datastructure. Also enables edit/delete for individual soils.

to_dstability_points(shapely_object)
Parameters:

shapely_object (Union[LineString, Polygon])

Return type:

List[PersistablePoint]

to_shapely_linestring(points)
Parameters:

points (List[PersistablePoint])

Return type:

LineString

property waternets: List[Waternet]
class geolib.models.dstability.dstability_model.DStabilityObject(**data)
Parameters:

data (Any)

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].