Koswat dike surroundings¶
KoswatSurroundingsProtocol
¶
Bases: Protocol
Empty interface to represent the Koswat surroundings and easily identify them throughout the solution.
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.
closest_obstacle: float
property
¶
Distance to the closest (obstacle) surrounding. When no surroundings are given the value will be NaN
(Not A Number), so that the value 0 is reserved for buildings at distance 0.
Returns:
Name | Type | Description |
---|---|---|
float |
float
|
Distance to the closest surrounding. |
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 key5
.(4, 11)
takes key(s)10
and15
because5
was already taken.
- Total infrastructure width at zones =
(1.5, 9)
Returns:
Type | Description |
---|---|
list[float]
|
list[float]: list with total width corresponding to each provided zone. |
KoswatSurroundingsProtocol
¶
Bases: Protocol
Empty interface to represent the Koswat surroundings and easily identify them throughout the solution.
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.
closest_obstacle: float
property
¶
Distance to the closest (obstacle) surrounding. When no surroundings are given the value will be NaN
(Not A Number), so that the value 0 is reserved for buildings at distance 0.
Returns:
Name | Type | Description |
---|---|---|
float |
float
|
Distance to the closest surrounding. |
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 key5
.(4, 11)
takes key(s)10
and15
because5
was already taken.
- Total infrastructure width at zones =
(1.5, 9)
Returns:
Type | Description |
---|---|
list[float]
|
list[float]: list with total width corresponding to each provided zone. |
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.
KoswatSurroundingsProtocol
¶
Bases: Protocol
Empty interface to represent the Koswat surroundings and easily identify them throughout the solution.
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.
closest_obstacle: float
property
¶
Distance to the closest (obstacle) surrounding. When no surroundings are given the value will be NaN
(Not A Number), so that the value 0 is reserved for buildings at distance 0.
Returns:
Name | Type | Description |
---|---|---|
float |
float
|
Distance to the closest surrounding. |
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 key5
.(4, 11)
takes key(s)10
and15
because5
was already taken.
- Total infrastructure width at zones =
(1.5, 9)
Returns:
Type | Description |
---|---|
list[float]
|
list[float]: list with total width corresponding to each provided zone. |
SurroundingsObstacle
dataclass
¶
Bases: KoswatSurroundingsProtocol
Defines surroundings point collections that cannot be repaired or replaced.
The PointSurroundings
contain a matrix (dictionary) where the keys
represent the distances to an obstacle, and the values a 1
(obstacle present)
or a 0
(obstacle not present).
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.
closest_obstacle: float
property
¶
Distance to the closest (obstacle) surrounding. When no surroundings are given the value will be NaN
(Not A Number), so that the value 0 is reserved for buildings at distance 0.
Returns:
Name | Type | Description |
---|---|---|
float |
float
|
Distance to the closest surrounding. |
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 key5
.(4, 11)
takes key(s)10
and15
because5
was already taken.
- Total infrastructure width at zones =
(1.5, 9)
Returns:
Type | Description |
---|---|
list[float]
|
list[float]: list with total width corresponding to each provided zone. |
BuilderProtocol
¶
Bases: Protocol
build() -> Any
¶
Instantiates a concrete object to separate its initalization from the data structure.
Returns:
Name | Type | Description |
---|---|---|
Any |
Any
|
Intance of a created object within Koswat domain. |
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.
closest_obstacle: float
property
¶
Distance to the closest (obstacle) surrounding. When no surroundings are given the value will be NaN
(Not A Number), so that the value 0 is reserved for buildings at distance 0.
Returns:
Name | Type | Description |
---|---|---|
float |
float
|
Distance to the closest surrounding. |
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 key5
.(4, 11)
takes key(s)10
and15
because5
was already taken.
- Total infrastructure width at zones =
(1.5, 9)
Returns:
Type | Description |
---|---|
list[float]
|
list[float]: list with total width corresponding to each provided zone. |
PointSurroundingsListPoldersideBuilder
dataclass
¶
Bases: BuilderProtocol
Builds a collection of points (list[PointSurroundings]
) given the dike locations
(KoswatDikeLocationsShpFom
) and the surroundings around it
(KoswatSurroundingsCsvFom
).
Wrapper¶
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:
Name | Type | Description | Default |
---|---|---|---|
distance |
float
|
Radius from each point that should be free of surroundings. |
required |
Returns:
Type | Description |
---|---|
list[PointSurroundings]
|
list[PointSurroundings]: List of safe locations (points with surroundings). |
obstacle_locations: list[PointSurroundings]
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:
Type | Description |
---|---|
list[PointSurroundings]
|
list[PointSurroundings]: List of locations with only the closest distance to obstacle(s). |
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.
closest_obstacle: float
property
¶
Distance to the closest (obstacle) surrounding. When no surroundings are given the value will be NaN
(Not A Number), so that the value 0 is reserved for buildings at distance 0.
Returns:
Name | Type | Description |
---|---|---|
float |
float
|
Distance to the closest surrounding. |
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 key5
.(4, 11)
takes key(s)10
and15
because5
was already taken.
- Total infrastructure width at zones =
(1.5, 9)
Returns:
Type | Description |
---|---|
list[float]
|
list[float]: list with total width corresponding to each provided zone. |
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:
Name | Type | Description | Default |
---|---|---|---|
distance |
float
|
Radius from each point that should be free of surroundings. |
required |
Returns:
Type | Description |
---|---|
list[PointSurroundings]
|
List[PointSurroundings]: List of safe locations (points with surroundings). |
BaseSurroundingsWrapper
¶
Bases: ABC
surroundings_collection: dict[str, KoswatSurroundingsProtocol]
property
¶
The collection of KoswatSurroundingsProtocol
objects that are considered for a scenario analysis.
Returns:
Type | Description |
---|---|
dict[str, KoswatSurroundingsProtocol]
|
list[KoswatSurroundingsProtocol]: Collection of surroundings to include in analysis. |
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.
BaseSurroundingsWrapper
¶
Bases: ABC
surroundings_collection: dict[str, KoswatSurroundingsProtocol]
property
¶
The collection of KoswatSurroundingsProtocol
objects that are considered for a scenario analysis.
Returns:
Type | Description |
---|---|
dict[str, KoswatSurroundingsProtocol]
|
list[KoswatSurroundingsProtocol]: Collection of surroundings to include in analysis. |
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:
Name | Type | Description | Default |
---|---|---|---|
distance |
float
|
Radius from each point that should be free of surroundings. |
required |
Returns:
Type | Description |
---|---|
list[PointSurroundings]
|
list[PointSurroundings]: List of safe locations (points with surroundings). |
obstacle_locations: list[PointSurroundings]
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:
Type | Description |
---|---|
list[PointSurroundings]
|
list[PointSurroundings]: List of locations with only the closest distance to obstacle(s). |
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.
closest_obstacle: float
property
¶
Distance to the closest (obstacle) surrounding. When no surroundings are given the value will be NaN
(Not A Number), so that the value 0 is reserved for buildings at distance 0.
Returns:
Name | Type | Description |
---|---|---|
float |
float
|
Distance to the closest surrounding. |
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 key5
.(4, 11)
takes key(s)10
and15
because5
was already taken.
- Total infrastructure width at zones =
(1.5, 9)
Returns:
Type | Description |
---|---|
list[float]
|
list[float]: list with total width corresponding to each provided zone. |
SurroundingsObstacle
dataclass
¶
Bases: KoswatSurroundingsProtocol
Defines surroundings point collections that cannot be repaired or replaced.
The PointSurroundings
contain a matrix (dictionary) where the keys
represent the distances to an obstacle, and the values a 1
(obstacle present)
or a 0
(obstacle not present).