Koswat dike surroundings

KoswatSurroundingsProtocol

Bases: Protocol

Empty interface to represent the Koswat surroundings and easily identify them throughout the solution.

SurroundingsInfrastructure dataclass

Bases: KoswatSurroundingsProtocol

Defines surroundings point collections that can be repaired or replaced.

The PointSurroundings contain a matrix (dictionary) where the keys represent the distances to an obstacle, and the values a float representing how long that infrastructure is.

SurroundingsObstacle dataclass

Bases: KoswatSurroundingsProtocol

Defines surroundings point collections that cannot be repaired or replaced. The PointObstacleSurroundings contain the closest distance to an obstacle both inside and outside the polder.

Point

PointSurroundings dataclass

Object representing a meter with x, y coordinates in a polder (or else).

__eq__(__value: object) -> bool

Overriding of the "magic" equality operator required so that PointSurroundings can be used as a key in a python dict.

__hash__() -> int

Overriding of the "magic" hash operator required so that PointSurroundings can be used as a key in a python dict.

get_total_infrastructure_per_zone(*zone_limit_collection: tuple[float, float]) -> list[float]

Gets the total infrastructure width at each of the provided zones zone_limit_collection (tuple[float, float]). The zone limits are matched by rounding up their upper limit to the surroundings_matrix keys (distances to the location in the real world). When two zones have overlapping limits (as expected) the lower one will "claim" the corresponding surrounding distance.

Example
  • zone_limit_collection = (0, 4), (4, 11)
  • surroundings_matrix = {5: 1.5, 10: 3, 15: 6}
  • "Taken" distances per zone:
    • (0, 4) takes key 5.
    • (4, 11) takes key(s) 10 and 15 because 5 was already taken.
  • Total infrastructure width at zones = (1.5, 9)
Returns:
  • list[float]

    list[float]: list with total width corresponding to each provided zone.

merge(other: PointSurroundings) -> None

Merges another PointSurroundings into this one by updating the surroundings_matrix with the values from the other one.

Parameters:

PointSurroundingsListBuilder dataclass

Bases: BuilderProtocol

Builds a collection of points (list[PointSurroundings]) given the dike locations (KoswatDikeLocationsShpFom) and the surroundings around it (KoswatSurroundingsCsvFom).

Wrapper

SurroundingsWrapper dataclass

get_locations_at_safe_distance(distance: float) -> list[PointSurroundings]

Gets all locations which are safe from obstacle surroundings in a radius of distance.

Parameters:
  • distance (float) –

    Radius from each point that should be free of surroundings.

Returns:
  • list[PointSurroundings]

    List[PointSurroundings]: List of safe locations (points with surroundings).

ObstacleSurroundingsWrapper dataclass

Bases: BaseSurroundingsWrapper

get_locations_at_safe_distance(distance: float) -> list[PointSurroundings]

Gets all locations which are safe from obstacle surroundings in a radius of distance.

Parameters:
  • distance (float) –

    Radius from each point that should be free of surroundings.

Returns:
  • list[PointSurroundings]

    list[PointSurroundings]: List of safe locations (points with surroundings).

obstacle_locations: list[PointObstacleSurroundings] property

Overlay of locations of the different ObstacleSurroundings that are present. Buildings need to be present as input (leading for location coordinates). Each location represents 1 meter in a real scale map.

Returns:
  • list[PointObstacleSurroundings]

    list[PointSurroundings]: List of locations with only the closest distance to obstacle(s).