404
+ +Page not found
+ + +diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/404.html b/404.html new file mode 100644 index 00000000..020b7cfa --- /dev/null +++ b/404.html @@ -0,0 +1,194 @@ + + +
+ + + + +Page not found
+ + +LineString
or a MultiLineString
LineString
or a MultiLineString
koswat/surrounding
builder classes to be initialized from files.FileObjectModelProtocol
instance of KoswatCsvFom
. Added new methods to fom and reader protocols, adapted related classesImportant! : The following installation steps are written based on a Windows environment. When using other systems (which should be possible) it might be required to use different commands. However, the fundamental of the installation steps should remain the same. This meaning, no additional packages or libraries should be required. If problems would arose during your installation, please contact the maintainers of the tool.
+When you only require the koswat package to be used as a whole, and not for developments, we advise to directly use the latest greatest release, or directly the latest available version from Master
as follows:
Latest available Master
:
+
pip install git+https://github.com/Deltares/Koswat.git
+
Specific Koswat version, add @version-tag
to the previous command, for instance install tag v0.11.0
(MVP pre-release):
+
pip install git+https://github.com/Deltares/Koswat.git@v0.11.0
+
@0504c06
)
+Using docker (requires checking the repository in a directory): +
cd <your koswat checked out directory>
+docker build -t koswat:latest -f Dockerimage .
+docker run -it koswat bash
+
Checkout the code from github in a directory of your choice. You can either do this by downloading the source zip or (better) using git, for instance: +
cd C:\repos
+git clone https://github.com/Deltares/Koswat.git koswat
+
Navigate to your Koswat repository and then install the koswat package with your preferred step:
+cd C:\repos\koswat
+conda env create -f .conf\environment.yml
+conda activate koswat_env
+poetry install
+
pypi
:
+ cd C:\repos\koswat
+pip install .
+
Poetry
, which is required to properly maintain the interdependencies of Koswat
tool.In general, the architecture of this package is based on the following principles:
+We cluster entities into modules (components) that represent their domain and have minimal dependencies with others components, this way the modules can be accessed when operating Koswat as a sandbox. Within each component we apply the same principle and create sub-modules to reduce dependencies.
+At the current (unreleased) version v.0.15.0
the component hierarchy looks like follows:
koswat/
+
+ configuration/ # Data structures required for a koswat run.
+ geometries/
+ io/
+ settings/
+
+ core/ # Generic definitions and functionatilities.
+ geometries/
+ io/
+ protocols/
+
+ cost_report/ # Summary of costs per dike reinforcement.
+ io/
+ infrastructure/
+ multi_location_profile/
+ profile/
+ summary/
+
+ dike/ # Definition of a koswat dike.
+ characteristic_points/
+ layers/
+ material/
+ profile/
+ surroundings/
+
+ dike_reinforcements/ # Dike calculations to generate possible reinforcements.
+ input_profile/
+ io/
+ reinforcement_layers/
+ reinforcement_profile/
+
+ plots/ # Generic functionality for plotting.
+ dike/
+ geometries/
+
+ strategies/ # Different selection methods of all possible dike reinforcements alongside a dike traject.
+ order_strategy
+
And the components interdependencies could be slightly represented as in the following diagram:
++ |
---|
Image 1. Component diagram | +
To facilitate the Open-Closed principle
most of our classes have parameterless constructors (__init__
method). Then, to instantiate objects we often relay on the implementation of builder patterns
In Koswat we make use of Protocols to define the required and essential properties and methods that represent an entity. Although Python does not always enforce these types as other OO languages would do (for instance C#), we try to follow and respect this principle throughought the whole repository.
+Check for instance this wikipedia article for a more detailed reference.
+Because most of our classes have dependencies on other classes their initialization would require multiple steps that would become tedious and hard to maintain if they were defined in the default init method. Moreover, this approach would violate the open-closed principle.
+Therefore, we apply the builder pattern to reduce complexity at the classes, improving maintainability and enabling future developments to create a separate builder shall the design require a different way of instantiating a given class.
+ +A Koswat report is divided in different parts:
+MultiLocationProfileCostReport
). InfrastructureLocationProfileCostReport
) Costs related to applying all calculated reinforcement profiles at the locations where infrastructures are present.ProfileCostReport
), what are the (material) volume costs associated when applying a given reinforced profile .+ |
---|
Image 1. Volume costs | +
When determining the costs of infrastructures we look mainly at:
+ReinforcementProfileProtocol
) zones A and B. SurroundingsInfrastructure.points
, PointSurroundings.surroundings_matrix
).These characteristics are then used to estimate how much surface of the infrastructures will be affected by the reinforced profile and therefore their associated cost.
+A reinforced profile can be different from its original state in many ways, however here we are only intestered in two things:
+dh0
),By using the old and the reinforced profile's geometries, we can determine what we call zone A
and zone B
, A + B = {profile's width from waterside crest point}
.
A
represents the length of the dike old profile's crest (highest surface).B
the distance between said crest and the end of the dike's reinforcement.+ |
---|
Image 1. Reinforcement with dh0 = 0 |
+
However, when the crest's height of a ReinforcementProfileProtocol
has increased in comparison to its original profile (ReinforcementProfileProtocol.old_profile
, KoswatProfileProtocol
) then we set zone A = 0
and therefore B = {profile's width from waterside crest point}
.
+ |
---|
Image 2. Reinforcement with dh0 = 1 |
+
An infrastructure (SurroundingsInfrastructure
) can be present at different locations (SurroundingsInfrastructure.points
). Each of these locations (PointSurroundings
) contains a dictionary (surroundings_matrix: dict[float, float]
) where the key is the distance between said location and the infrastructure and the values represent the length of the infrastructure found at that distance.
For instance, we could have surroundings_matrix = {5: 1.5, 10: 0, 15: 2.5}
, which means:
+- Between 0
and 5
meters from the location we will find 1.5
meters of the infrastructure,
+- Between 5
and 10
meters from the location we will find 0
meters of the infrastructure,
+- Between 10
and 15
meters from the location we will find 2.5
meters of the infrastructure.
In addition, each infrastructure has a fixed width (SurroundingsInfrastructure.infrastructure_width
), which can later be used to calculate the total surface of said infrastructure affected by the given profile. So: affected_infra_zone_x = meters_of_infrastructure_in_zone_x * infrastructure_width
, where meters_of_infrastructure_in_zone_x
are the values calculated from the surroundings_matrix
and infrastructure_width
is the infrastructure fixed width.
After defining the profile's zones A
and B
we can easily find how much of each infrastructures is affected by checking the surroundings_matrix
indices and "rounding" up. It is agreed that at the overlapping points between A
and B
, the affected surface, and therefore costs, will only be computed for zone A
; this is done regardless of the chosen infrastructure costs type (InfraCostsEnum
).
Once the total area is known, we only need to multiply them by their related costs for adding and/or removing infrastructure's material.
+Using as example the previous surroundings_matrix = {5: 1.5, 10: 0, 15: 2.5}
we can demostrate this when A = 4
and B = 10
.
zone_a
goes from 0 to 4,zone_b
goes from 4 to 14.zone_a
affects only up until key 5
, so 1.5 meters of infrastructure.zone_b
affects keys 10
and 15
, so 2.5 meters of infrastructure.5
as has already been considered for zone_a
.After running a Koswat analysis, several files and directories will be generated. Usually the structure will be as follows:
+Dike profile section scenarios -> Scenario -> Generated files
Example using a summarized view of the output tree directory when running the acceptance test test_main.test_given_valid_input_succeeds
:
+
acceptance
+| koswat.log
+|
++-- results_output
+| +-- dike_10-1-1-A-1-A
+| | +-- scenario_scenario1
+| | | | Grondmaatregel_profiel.png
+| | | | Kistdam.png
+| | | | Kwelscherm.png
+| | | | summary_costs.csv
+| | | | summary_locations.csv
+| | | | summary_infrastructure_costs.csv
+| | | | Stabiliteitswand.png
+| | | | Verticale_piping_oplossing.png
+| | | |
+| | | +-- Grondmaatregel_profiel
+| | | | added_Grondmaatregel_profiel_CLAY.png
+| | | | added_Grondmaatregel_profiel_GRASS.png
+| | | | added_Grondmaatregel_profiel_SAND.png
+| | | | removed_Grondmaatregel_profiel_CLAY.png
+| | | | removed_Grondmaatregel_profiel_GRASS.png
+| | | +-- Kistdam
+| | | | ...
+| | |
+| | | +-- Kwelscherm
+| | | | ...
+| | |
+| | | +-- Stabiliteitswand
+| | | | ...
+| | |
+| | | +-- Verticale_piping_oplossing
+| | | | ...
+| | |
+| | +-- scenario_scenario2
+| | | ...
+
In this section we will describe how a Koswat dike is defined and what its parts are.
+A koswat dike is represented by an instance of a KoswatProfileProtocol
. And its properties represent different aspects of a 'real domain'. With Image 1. Base profile properties as reference, we can see the mapping between said 'real domain' and the koswat properties:
input_data
: The parts of a dike (written on the image reference), which are directly mapped as an implementation of the KoswatInputProfileProtocol
. characteristic_points
: 8 points given by the user describing the dike on (x,y) coordinates, the first four represent the waterside, the last four the polderside. Numbered in the reference picture from 1 to 8. layers_wrapper
: The description on how the layers of the dike are built. Further described in Dike layers.location
: coordinate (x, y) where the dike is situated.profile_width
: The difference between the lowest and the highest 'x' coordinates of the profile characteristic points. The distance between characteristic point 1 and 8.+ |
---|
Image 1. Base profile properties | +
A dike is composed by three layers:
+These layers are wrapped under a KoswatLayersWrapperProtocol
instance. At the same time, each layer is an instance of a KoswatLayerProtocol
containing the following properties:
material_type
: Either Sand, Clay or Grass.upper_points
: The surface points of the layer. This property can be used to calculate the surface (m2) of a material.outer_geometry
: A polygon representing the material layer and the 'wrapped' polygons. For instance, the Clay outer_geometry
will also include the Sand material_geometry
.material_geometry
: A closed polygon containing only the points representing the layer.Using Image 3. Clay layer highlighted as an example, we can map the previous properties:
+material_type
: Clay, the 'in-between' layer.upper_points
: Line with the 'orange' points, without 'closing' the polygon, something like: [(-18, 0), (0, 5.5), (8, 5.5), (21, 0)].outer_geometry
: Closed geometry using the upper points
and the 'ground floor' points: [(-18, 0), (0, 5.5), (8, 5.5), (21, 0), (-18, 0)].material_geometry
: Closed geometry using the upper_points
from Clay and the upper_points
from the layer below (Sand, green points). Should be something like: [(-18, 0), (0, 5.5), (8, 5.5), (21, 0), (19, 0), (8, 4.75), (0, 4.75), (-14, 0), (-18, 0)]+ |
---|
Image 2. Sand layer highlighted | +
+ |
---|
Image 3. Clay layer highlighted | +
+ |
---|
Image 4. Grass layer highlighted | +
DataObjectModelProtocol
+
+
+¶
+ Bases: Protocol
Empty protocol just to be able to classify other classes as a DataObjectModelProtocol
Instance.
KoswatConfigProtocol
+
+
+¶
+ Bases: DataObjectModelProtocol
, Protocol
is_valid() -> bool
+
+¶Validates the current KoswatConfigProtocol
instance.
Returns:
+Name | Type | +Description | +
---|---|---|
bool |
+ bool
+ |
+
|
+
as_unified_geometry(source_geom: geometry.Polygon | geometry.MultiPolygon) -> geometry.Polygon
+
+¶Ensures the calculated geometry is returned as a single polygon.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
source_geom |
+
+ geometry.Polygon | geometry.MultiPolygon
+ |
+ Calculated source geometry. |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ geometry.Polygon
+ |
+ geometry.Polygon: Unified resulting geometry with its points ordered (first one is the most-left x coordinate). |
+
get_groundlevel_surface(pol_geometry: geometry.Polygon) -> geometry.LineString
+
+¶Returns all the points which are at 'groundlevel' values (y = 0)
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
pol_geometry |
+
+ geometry.Polygon
+ |
+ Source geometry. |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ geometry.LineString
+ |
+ geometry.LineString: Line with points at y = 0. |
+
get_normalized_polygon_difference(left_geom: geometry.Polygon, right_geom: geometry.Polygon) -> geometry.Polygon | geometry.MultiPolygon
+
+¶Given two polygons calculates the difference between them and removes any residual polygon due to minor precision errors.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
left_geom |
+
+ geometry.Polygon
+ |
+ Base polygon from where to substract. |
+ + required + | +
right_geom |
+
+ geometry.Polygon
+ |
+ Polygon to substract from base. |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ geometry.Polygon | geometry.MultiPolygon
+ |
+ geometry.Polygon: Resulting normalized substraction polygon. |
+
get_polygon_coordinates(pol_geometry: geometry.Polygon | geometry.MultiPolygon) -> geometry.LineString
+
+¶Given a single or multi geometry returns the coordinates composing its outer layout.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
pol_geometry |
+
+ geometry.Polygon | geometry.MultiPolygon
+ |
+ Source geometry. |
+ + required + | +
Raises:
+Type | +Description | +
---|---|
+ NotImplementedError
+ |
+ When the provided geometry is not yet supported. |
+
Returns:
+Type | +Description | +
---|---|
+ geometry.LineString
+ |
+ geometry.LineString: Set of points composing the outer layout of the geometry. |
+
get_polygon_surface_points(base_geometry: geometry.Polygon | geometry.MultiPolygon) -> geometry.LineString
+
+¶Gets all the points composing the upper surface of a 'dike' geometry.
+IMPORTANT! The calling of this method assumes the base_geometry
points are in order, call order_geometry_points
if needed.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
base_geometry |
+
+ Union[geometry.Polygon, geometry.MultiPolygon]
+ |
+ Source geometry. |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ geometry.LineString
+ |
+ geometry.LineString: Resulting line with points from the outer geometry. |
+
get_relative_core_layer(core_geometry: geometry.Polygon, coating_geometry: geometry.Polygon) -> geometry.Polygon
+
+¶Returns a new 'core' from the original core_geometry
relative to the coating_geometry
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
core_geometry |
+
+ Polygon
+ |
+ Original core geometry on which layers are stacked upon. |
+ + required + | +
coating_geometry |
+
+ Polygon
+ |
+ Layer wrapping the exterior of a core geometry. |
+ + required + | +
Returns:
+Name | Type | +Description | +
---|---|---|
Polygon |
+ geometry.Polygon
+ |
+ Layer wrapping a reduced surface of the |
+
order_geometry_points(dike_polygon: geometry.Polygon) -> geometry.Polygon
+
+¶In koswat we handle polygon operations expecting the lowest 'x' coordinate to be the initial and last point of a geometry. +For this reason we need to ensure all geometries are 'normalized' based on this criteria.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
dike_polygon |
+
+ geometry.Polygon
+ |
+ Polygon to normalized. |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ geometry.Polygon
+ |
+ geometry.Polygon: Normalized polygon. |
+
profile_points_to_polygon(points_list: list[geometry.Point]) -> geometry.Polygon
+
+¶Transforms a list of points into a valid 'dike' polygon. When there is a difference in height between left and right side then we correct it in the x = 0 coordinate.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
points_list |
+
+ List[geometry.Point]
+ |
+ List of points representing a dike profile. |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ geometry.Polygon
+ |
+ geometry.Polygon: Validated enclosed geometry simple polygon. |
+
remove_layer_from_polygon(dike_polygon: geometry.Polygon, layer_depth: float) -> geometry.Polygon
+
+¶Gets the dike profile without a layer of provided layer_depth
depth.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
dike_polygon |
+
+ geometry.Polygon
+ |
+ Source geometry. |
+ + required + | +
layer_depth |
+
+ float
+ |
+ Depth of a layer from the outer |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ geometry.Polygon
+ |
+ geometry.Polygon: Resulting geometry when removing the layer. |
+
FileObjectModelProtocol
+
+
+¶
+ Bases: Protocol
is_valid() -> bool
+
+¶Verifies if the current object is valid for import / export.
+ +Returns:
+Name | Type | +Description | +
---|---|---|
bool |
+ bool
+ |
+ Result of the validation. |
+
DataObjectModelProtocol
+
+
+¶
+ Bases: Protocol
Empty protocol just to be able to classify other classes as a DataObjectModelProtocol
Instance.
KoswatImporterProtocol
+
+
+¶
+ Bases: Protocol
import_from(from_path: Path) -> Union[DataObjectModelProtocol, List[DataObjectModelProtocol]]
+
+¶Generates a valid instance of a DataObjectModelProtocol
based on the contents from the provided path.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
from_path |
+
+ Path
+ |
+ Path containing data to be read. |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ Union[DataObjectModelProtocol, List[DataObjectModelProtocol]]
+ |
+ Union[DataObjectModelProtocol, List[DataObjectModelProtocol]]: Either a single valid instance of a |
+
FileObjectModelProtocol
+
+
+¶
+ Bases: Protocol
is_valid() -> bool
+
+¶Verifies if the current object is valid for import / export.
+ +Returns:
+Name | Type | +Description | +
---|---|---|
bool |
+ bool
+ |
+ Result of the validation. |
+
KoswatReaderProtocol
+
+
+¶
+ Bases: Protocol
read(file_path: Path) -> FileObjectModelProtocol
+
+¶Imports the data from the file_path
into a concrete implementation of a FileObjectModelProtocol
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
file_path |
+
+ Path
+ |
+ Path to a file that should be imported. |
+ + required + | +
Returns:
+Name | Type | +Description | +
---|---|---|
FileObjectModelProtocol |
+ FileObjectModelProtocol
+ |
+ Model representing the data in the file. |
+
supports_file(file_path: Path) -> bool
+
+¶Validates whether the current reader is capable of importing data from the provided file.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
file_path |
+
+ Path
+ |
+ Path to a file that should be imported. |
+ + required + | +
Returns:
+Name | Type | +Description | +
---|---|---|
bool |
+ bool
+ |
+ Result of validation. |
+
FileObjectModelProtocol
+
+
+¶
+ Bases: Protocol
is_valid() -> bool
+
+¶Verifies if the current object is valid for import / export.
+ +Returns:
+Name | Type | +Description | +
---|---|---|
bool |
+ bool
+ |
+ Result of the validation. |
+
KoswatWriterProtocol
+
+
+¶
+ Bases: Protocol
write(fom_instance: FileObjectModelProtocol, to_path: Path) -> None
+
+¶Writes the data from the instance of a FileObjectModelProtocol
to the to_path
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fom_instance |
+
+ FileObjectModelProtocol
+ |
+ Instance with data to write. |
+ + required + | +
to_path |
+
+ Path
+ |
+ Path to file (or directory) where to write the data. |
+ + required + | +
FileObjectModelProtocol
+
+
+¶
+ Bases: Protocol
is_valid() -> bool
+
+¶Verifies if the current object is valid for import / export.
+ +Returns:
+Name | Type | +Description | +
---|---|---|
bool |
+ bool
+ |
+ Result of the validation. |
+
KoswatCsvFomProtocol
+
+
+¶
+ Bases: FileObjectModelProtocol
, Protocol
is_valid() -> bool
+
+¶Validates the current structure of this KoswatCsvFomProtocol
instance.
Returns:
+Name | Type | +Description | +
---|---|---|
bool |
+ bool
+ |
+ True when is a valid FOM. |
+
KoswatCsvFomProtocol
+
+
+¶
+ Bases: FileObjectModelProtocol
, Protocol
is_valid() -> bool
+
+¶Validates the current structure of this KoswatCsvFomProtocol
instance.
Returns:
+Name | Type | +Description | +
---|---|---|
bool |
+ bool
+ |
+ True when is a valid FOM. |
+
KoswatReaderProtocol
+
+
+¶
+ Bases: Protocol
read(file_path: Path) -> FileObjectModelProtocol
+
+¶Imports the data from the file_path
into a concrete implementation of a FileObjectModelProtocol
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
file_path |
+
+ Path
+ |
+ Path to a file that should be imported. |
+ + required + | +
Returns:
+Name | Type | +Description | +
---|---|---|
FileObjectModelProtocol |
+ FileObjectModelProtocol
+ |
+ Model representing the data in the file. |
+
supports_file(file_path: Path) -> bool
+
+¶Validates whether the current reader is capable of importing data from the provided file.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
file_path |
+
+ Path
+ |
+ Path to a file that should be imported. |
+ + required + | +
Returns:
+Name | Type | +Description | +
---|---|---|
bool |
+ bool
+ |
+ Result of validation. |
+
KoswatCsvFomProtocol
+
+
+¶
+ Bases: FileObjectModelProtocol
, Protocol
is_valid() -> bool
+
+¶Validates the current structure of this KoswatCsvFomProtocol
instance.
Returns:
+Name | Type | +Description | +
---|---|---|
bool |
+ bool
+ |
+ True when is a valid FOM. |
+
KoswatWriterProtocol
+
+
+¶
+ Bases: Protocol
write(fom_instance: FileObjectModelProtocol, to_path: Path) -> None
+
+¶Writes the data from the instance of a FileObjectModelProtocol
to the to_path
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fom_instance |
+
+ FileObjectModelProtocol
+ |
+ Instance with data to write. |
+ + required + | +
to_path |
+
+ Path
+ |
+ Path to file (or directory) where to write the data. |
+ + required + | +
FileObjectModelProtocol
+
+
+¶
+ Bases: Protocol
is_valid() -> bool
+
+¶Verifies if the current object is valid for import / export.
+ +Returns:
+Name | Type | +Description | +
---|---|---|
bool |
+ bool
+ |
+ Result of the validation. |
+
KoswatIniFomProtocol
+
+
+¶
+ Bases: FileObjectModelProtocol
, Protocol
from_config(ini_config: ConfigParser) -> KoswatIniFomProtocol
+
+
+ classmethod
+
+
+¶Imports all the data stored in an dictionary into a KoswatIniFomProtocol
instance.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
ini_config |
+
+ ConfigParser
+ |
+ Dictionary containing Ini values (section - properties, property - value) to be parsed. |
+ + required + | +
Returns:
+Name | Type | +Description | +
---|---|---|
KoswatIniFomProtocol |
+ KoswatIniFomProtocol
+ |
+ Valid instance of a |
+
KoswatIniFomProtocol
+
+
+¶
+ Bases: FileObjectModelProtocol
, Protocol
from_config(ini_config: ConfigParser) -> KoswatIniFomProtocol
+
+
+ classmethod
+
+
+¶Imports all the data stored in an dictionary into a KoswatIniFomProtocol
instance.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
ini_config |
+
+ ConfigParser
+ |
+ Dictionary containing Ini values (section - properties, property - value) to be parsed. |
+ + required + | +
Returns:
+Name | Type | +Description | +
---|---|---|
KoswatIniFomProtocol |
+ KoswatIniFomProtocol
+ |
+ Valid instance of a |
+
KoswatReaderProtocol
+
+
+¶
+ Bases: Protocol
read(file_path: Path) -> FileObjectModelProtocol
+
+¶Imports the data from the file_path
into a concrete implementation of a FileObjectModelProtocol
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
file_path |
+
+ Path
+ |
+ Path to a file that should be imported. |
+ + required + | +
Returns:
+Name | Type | +Description | +
---|---|---|
FileObjectModelProtocol |
+ FileObjectModelProtocol
+ |
+ Model representing the data in the file. |
+
supports_file(file_path: Path) -> bool
+
+¶Validates whether the current reader is capable of importing data from the provided file.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
file_path |
+
+ Path
+ |
+ Path to a file that should be imported. |
+ + required + | +
Returns:
+Name | Type | +Description | +
---|---|---|
bool |
+ bool
+ |
+ Result of validation. |
+
FileObjectModelProtocol
+
+
+¶
+ Bases: Protocol
is_valid() -> bool
+
+¶Verifies if the current object is valid for import / export.
+ +Returns:
+Name | Type | +Description | +
---|---|---|
bool |
+ bool
+ |
+ Result of the validation. |
+
KoswatTxtFomProtocol
+
+
+¶
+ Bases: FileObjectModelProtocol
, Protocol
from_text(file_text: str) -> KoswatTxtFomProtocol
+
+
+ classmethod
+
+
+¶Imports all the data stored in text form.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
file_text |
+
+ str
+ |
+ Raw data in string format. |
+ + required + | +
Returns:
+Name | Type | +Description | +
---|---|---|
KoswatTxtFomProtocol |
+ KoswatTxtFomProtocol
+ |
+ Valid instance of a |
+
KoswatReaderProtocol
+
+
+¶
+ Bases: Protocol
read(file_path: Path) -> FileObjectModelProtocol
+
+¶Imports the data from the file_path
into a concrete implementation of a FileObjectModelProtocol
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
file_path |
+
+ Path
+ |
+ Path to a file that should be imported. |
+ + required + | +
Returns:
+Name | Type | +Description | +
---|---|---|
FileObjectModelProtocol |
+ FileObjectModelProtocol
+ |
+ Model representing the data in the file. |
+
supports_file(file_path: Path) -> bool
+
+¶Validates whether the current reader is capable of importing data from the provided file.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
file_path |
+
+ Path
+ |
+ Path to a file that should be imported. |
+ + required + | +
Returns:
+Name | Type | +Description | +
---|---|---|
bool |
+ bool
+ |
+ Result of validation. |
+
KoswatTxtFomProtocol
+
+
+¶
+ Bases: FileObjectModelProtocol
, Protocol
from_text(file_text: str) -> KoswatTxtFomProtocol
+
+
+ classmethod
+
+
+¶Imports all the data stored in text form.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
file_text |
+
+ str
+ |
+ Raw data in string format. |
+ + required + | +
Returns:
+Name | Type | +Description | +
---|---|---|
KoswatTxtFomProtocol |
+ KoswatTxtFomProtocol
+ |
+ Valid instance of a |
+
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. |
+
DataObjectModelProtocol
+
+
+¶
+ Bases: Protocol
Empty protocol just to be able to classify other classes as a DataObjectModelProtocol
Instance.
CostReportProtocol
+
+
+¶
+ Bases: Protocol
A Protocol
defining the properties of a report in Koswat.
ProfileZoneCalculator
+
+
+
+ dataclass
+
+
+¶Calculator to determine the width of zones A
and B
of a reinforced
+profile (ReinforcementProfileProtocol
). It requires its original base
+profile to be in its definition.
calculate() -> tuple[float, float]
+
+¶Calculates the width of zones A
and B
for the defined instance of
+ReinforcementProfileProtocol
. The calculation is as follows:
+- When dh0
has not varied with respect to the base profile, then zones
+A
and B
are calculated.
+- When dh0
has increased then only zone B
is calculated.
Returns:
+Type | +Description | +
---|---|
+ tuple[float, float]
+ |
+ tuple[float, float]: Calculated zone |
+
ReinforcementProfileProtocol
+
+
+¶
+ Bases: KoswatProfileProtocol
, Protocol
Extension of the KoswatProfileProtocol
to define the properties of a calculated reinforcement.
InfrastructureLocationCosts
+
+
+
+ dataclass
+
+
+¶Simple data structure containing the results of the costs calculations
+for a given ReinforcementProfileProtocol
profile.
+The values related to zone_a
and zone_b
are calculated in the
+ProfileZoneCalculator
.
InfrastructureProfileCostsCalculator
+
+
+
+ dataclass
+
+
+¶Calculator to generate all InfrastructureLocationCosts
instances
+based on the locations of the contained infrastructure
+(SurroundingsInfrastructure.points
) and the width of zone_a
and
+zone_b
.
calculate(zone_a_width: float, zone_b_width: float) -> list[InfrastructureLocationCosts]
+
+¶Calculates the costs affecting this instance's infrastructure +at all points where its present.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
zone_a_width |
+
+ float
+ |
+ Width of zone type |
+ + required + | +
zone_b_width |
+
+ float
+ |
+ Width of zone type `B . |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ list[InfrastructureLocationCosts]
+ |
+ list[InfrastructureLocationCosts]: Resulting cost summaries. |
+
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.
zone_limit_collection
= (0, 4), (4, 11)surroundings_matrix
= {5: 1.5, 10: 3, 15: 6}(0, 4)
takes key 5
.(4, 11)
takes key(s) 10
and 15
because 5
was already taken.(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.
InfrastructureProfileCostsCalculator
+
+
+
+ dataclass
+
+
+¶Calculator to generate all InfrastructureLocationCosts
instances
+based on the locations of the contained infrastructure
+(SurroundingsInfrastructure.points
) and the width of zone_a
and
+zone_b
.
calculate(zone_a_width: float, zone_b_width: float) -> list[InfrastructureLocationCosts]
+
+¶Calculates the costs affecting this instance's infrastructure +at all points where its present.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
zone_a_width |
+
+ float
+ |
+ Width of zone type |
+ + required + | +
zone_b_width |
+
+ float
+ |
+ Width of zone type `B . |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ list[InfrastructureLocationCosts]
+ |
+ list[InfrastructureLocationCosts]: Resulting cost summaries. |
+
MultiInfrastructureProfileCostsCalculator
+
+
+
+ dataclass
+
+
+¶Calculator that contains all possible "infrastructure" calculators
+(InfrastructureProfileCostsCalculator
) one for each of the available
+infrastructures in the current KoswatScenario
.
+Its calculate
method only requires a reinforcement
+(ReinforcementProfileProtocol
) to determine all infrastructures' costs.
calculate(reinforced_profile: ReinforcementProfileProtocol) -> list[InfrastructureLocationProfileCostReport]
+
+¶Calculates the costs related to appyling the provided reinforcement_profile
+at all the locations where an infrastructures' is present. It first determines
+zone A
and B
and then provides their widths to the inner
+infrastructure calculators (InfrastructureProfileCostsCalculator
).
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
reinforced_profile |
+
+ ReinforcementProfileProtocol
+ |
+ Reinforcement to be applied. |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ list[InfrastructureLocationProfileCostReport]
+ |
+ list[InfrastructureLocationProfileCostReport]: Collection of reports summarizing the cost-impact of a |
+
ProfileZoneCalculator
+
+
+
+ dataclass
+
+
+¶Calculator to determine the width of zones A
and B
of a reinforced
+profile (ReinforcementProfileProtocol
). It requires its original base
+profile to be in its definition.
calculate() -> tuple[float, float]
+
+¶Calculates the width of zones A
and B
for the defined instance of
+ReinforcementProfileProtocol
. The calculation is as follows:
+- When dh0
has not varied with respect to the base profile, then zones
+A
and B
are calculated.
+- When dh0
has increased then only zone B
is calculated.
Returns:
+Type | +Description | +
---|---|
+ tuple[float, float]
+ |
+ tuple[float, float]: Calculated zone |
+
ReinforcementProfileProtocol
+
+
+¶
+ Bases: KoswatProfileProtocol
, Protocol
Extension of the KoswatProfileProtocol
to define the properties of a calculated reinforcement.
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. |
+
InfrastructureProfileCostsCalculator
+
+
+
+ dataclass
+
+
+¶Calculator to generate all InfrastructureLocationCosts
instances
+based on the locations of the contained infrastructure
+(SurroundingsInfrastructure.points
) and the width of zone_a
and
+zone_b
.
calculate(zone_a_width: float, zone_b_width: float) -> list[InfrastructureLocationCosts]
+
+¶Calculates the costs affecting this instance's infrastructure +at all points where its present.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
zone_a_width |
+
+ float
+ |
+ Width of zone type |
+ + required + | +
zone_b_width |
+
+ float
+ |
+ Width of zone type `B . |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ list[InfrastructureLocationCosts]
+ |
+ list[InfrastructureLocationCosts]: Resulting cost summaries. |
+
MultiInfrastructureProfileCostsCalculator
+
+
+
+ dataclass
+
+
+¶Calculator that contains all possible "infrastructure" calculators
+(InfrastructureProfileCostsCalculator
) one for each of the available
+infrastructures in the current KoswatScenario
.
+Its calculate
method only requires a reinforcement
+(ReinforcementProfileProtocol
) to determine all infrastructures' costs.
calculate(reinforced_profile: ReinforcementProfileProtocol) -> list[InfrastructureLocationProfileCostReport]
+
+¶Calculates the costs related to appyling the provided reinforcement_profile
+at all the locations where an infrastructures' is present. It first determines
+zone A
and B
and then provides their widths to the inner
+infrastructure calculators (InfrastructureProfileCostsCalculator
).
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
reinforced_profile |
+
+ ReinforcementProfileProtocol
+ |
+ Reinforcement to be applied. |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ list[InfrastructureLocationProfileCostReport]
+ |
+ list[InfrastructureLocationProfileCostReport]: Collection of reports summarizing the cost-impact of a |
+
MultiInfrastructureProfileCostsCalculatorBuilder
+
+
+
+ dataclass
+
+
+¶
+ Bases: BuilderProtocol
Builder to set up "fix" information such as costs derived from the koswat
+settings (InfraCostsEnum
, SurtaxFactorEnum
) which directly determines the
+zone A
and/or B
costs that will be applied for each infrastructure.
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.
CostParameterProtocol
+
+
+¶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. |
+
CostParameterProtocol
+
+
+¶ReinforcementProfileProtocol
+
+
+¶
+ Bases: KoswatProfileProtocol
, Protocol
Extension of the KoswatProfileProtocol
to define the properties of a calculated reinforcement.
KoswatExporterProtocol
+
+
+¶
+ Bases: Protocol
export(**kwargs) -> None
+
+¶Exports an object model into a concrete file format.
+ +SummaryInfrastructureCostsCsvFomBuilder
+
+
+
+ dataclass
+
+
+¶
+ Bases: BuilderProtocol
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. |
+
InfrastructureLocationCosts
+
+
+
+ dataclass
+
+
+¶Simple data structure containing the results of the costs calculations
+for a given ReinforcementProfileProtocol
profile.
+The values related to zone_a
and zone_b
are calculated in the
+ProfileZoneCalculator
.
MultiLocationProfileCostReport
+
+
+
+ dataclass
+
+
+¶
+ Bases: CostReportProtocol
total_cost: float
+
+
+ property
+
+
+¶Calculates the cost of the measure for all possible locations, +regardless whether that measure is chosen by the order strategy or not.
+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.
zone_limit_collection
= (0, 4), (4, 11)surroundings_matrix
= {5: 1.5, 10: 3, 15: 6}(0, 4)
takes key 5
.(4, 11)
takes key(s) 10
and 15
because 5
was already taken.(1.5, 9)
Returns:
+Type | +Description | +
---|---|
+ list[float]
+ |
+ list[float]: list with total width corresponding to each provided zone. |
+
SummaryInfrastructureCostsCsvFomBuilder
+
+
+
+ dataclass
+
+
+¶
+ Bases: BuilderProtocol
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.
zone_limit_collection
= (0, 4), (4, 11)surroundings_matrix
= {5: 1.5, 10: 3, 15: 6}(0, 4)
takes key 5
.(4, 11)
takes key(s) 10
and 15
because 5
was already taken.(1.5, 9)
Returns:
+Type | +Description | +
---|---|
+ list[float]
+ |
+ list[float]: list with total width corresponding to each provided zone. |
+
ReinforcementProfileProtocol
+
+
+¶
+ Bases: KoswatProfileProtocol
, Protocol
Extension of the KoswatProfileProtocol
to define the properties of a calculated reinforcement.
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. |
+
KoswatLayerBuilderProtocol
+
+
+¶
+ Bases: BuilderProtocol
, Protocol
build() -> KoswatLayerProtocol
+
+¶Builds an instance of a KoswatLayerProtocol
based on the provided upper_linestring
and layer_data
Returns:
+Name | Type | +Description | +
---|---|---|
KoswatLayerProtocol |
+ KoswatLayerProtocol
+ |
+ Valid instance of a |
+
KoswatLayerProtocol
+
+
+¶
+ Bases: Protocol
as_data_dict() -> dict
+
+¶Returns the information related to an instance of the KoswatLayerProtocol
.
Returns:
+Name | Type | +Description | +
---|---|---|
dict |
+ dict
+ |
+ custom dictionary with the relevant data. |
+
KoswatLayerProtocol
+
+
+¶
+ Bases: Protocol
as_data_dict() -> dict
+
+¶Returns the information related to an instance of the KoswatLayerProtocol
.
Returns:
+Name | Type | +Description | +
---|---|---|
dict |
+ dict
+ |
+ custom dictionary with the relevant data. |
+
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. |
+
KoswatLayersWrapperBuilderProtocol
+
+
+¶
+ Bases: BuilderProtocol
, Protocol
build() -> KoswatLayersWrapperProtocol
+
+¶Builds an instance of KoswatLayersWrapperProtocol
based on the class required fields layers_data
and profile_points
.
Returns:
+Name | Type | +Description | +
---|---|---|
KoswatLayersWrapperProtocol |
+ KoswatLayersWrapperProtocol
+ |
+ Valid initialized instance of a |
+
KoswatLayersWrapperProtocol
+
+
+¶
+ Bases: Protocol
as_data_dict() -> dict
+
+¶Returns the layers as a dictionary.
+ +Returns:
+Name | Type | +Description | +
---|---|---|
dict |
+ dict
+ |
+ Dictionary containing all the information of the wrapper layers ( |
+
KoswatLayerProtocol
+
+
+¶
+ Bases: Protocol
as_data_dict() -> dict
+
+¶Returns the information related to an instance of the KoswatLayerProtocol
.
Returns:
+Name | Type | +Description | +
---|---|---|
dict |
+ dict
+ |
+ custom dictionary with the relevant data. |
+
KoswatLayersWrapperProtocol
+
+
+¶
+ Bases: Protocol
as_data_dict() -> dict
+
+¶Returns the layers as a dictionary.
+ +Returns:
+Name | Type | +Description | +
---|---|---|
dict |
+ dict
+ |
+ Dictionary containing all the information of the wrapper layers ( |
+
KoswatLayersWrapper
+
+
+¶
+ Bases: KoswatLayersWrapperProtocol
layers: List[KoswatLayerProtocol]
+
+
+ property
+
+
+¶All the stored layers being the KoswatBaseLayer
the latest one in the collection.
Returns:
+Type | +Description | +
---|---|
+ List[KoswatLayerProtocol]
+ |
+ List[KoswatLayerProtocol]: Ordered list of |
+
KoswatProfileBase
+
+
+
+ dataclass
+
+
+¶
+ Bases: KoswatProfileProtocol
Basic definition and implementation of a KoswatProfileProtocol
. It represents the initial koswat profile being provided by the user from which further calculations will be made.
points: list[Point]
+
+
+ property
+
+
+¶The combination of points from both water and polder sides.
+ +Returns:
+Type | +Description | +
---|---|
+ list[Point]
+ |
+ list[Point]: A total of eight points comforming the |
+
profile_height: float
+
+
+ property
+
+
+¶The profile highest point (largest y-coordinate).
+ +Returns:
+Name | Type | +Description | +
---|---|---|
float |
+ float
+ |
+ Greatest y-coordinate. |
+
profile_width: float
+
+
+ property
+
+
+¶The profile extent from the lowest (left-most) x-coordinate to the largest (right-most) x-coordinate from a dike geometry polygon.
+ +Returns:
+Name | Type | +Description | +
---|---|---|
float |
+ float
+ |
+ Total distance. |
+
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.
zone_limit_collection
= (0, 4), (4, 11)surroundings_matrix
= {5: 1.5, 10: 3, 15: 6}(0, 4)
takes key 5
.(4, 11)
takes key(s) 10
and 15
because 5
was already taken.(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.
zone_limit_collection
= (0, 4), (4, 11)surroundings_matrix
= {5: 1.5, 10: 3, 15: 6}(0, 4)
takes key 5
.(4, 11)
takes key(s) 10
and 15
because 5
was already taken.(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.
zone_limit_collection
= (0, 4), (4, 11)surroundings_matrix
= {5: 1.5, 10: 3, 15: 6}(0, 4)
takes key 5
.(4, 11)
takes key(s) 10
and 15
because 5
was already taken.(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).
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.
zone_limit_collection
= (0, 4), (4, 11)surroundings_matrix
= {5: 1.5, 10: 3, 15: 6}(0, 4)
takes key 5
.(4, 11)
takes key(s) 10
and 15
because 5
was already taken.(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.
zone_limit_collection
= (0, 4), (4, 11)surroundings_matrix
= {5: 1.5, 10: 3, 15: 6}(0, 4)
takes key 5
.(4, 11)
takes key(s) 10
and 15
because 5
was already taken.(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
).
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.
zone_limit_collection
= (0, 4), (4, 11)surroundings_matrix
= {5: 1.5, 10: 3, 15: 6}(0, 4)
takes key 5
.(4, 11)
takes key(s) 10
and 15
because 5
was already taken.(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.
zone_limit_collection
= (0, 4), (4, 11)surroundings_matrix
= {5: 1.5, 10: 3, 15: 6}(0, 4)
takes key 5
.(4, 11)
takes key(s) 10
and 15
because 5
was already taken.(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).
KoswatLayerProtocol
+
+
+¶
+ Bases: Protocol
as_data_dict() -> dict
+
+¶Returns the information related to an instance of the KoswatLayerProtocol
.
Returns:
+Name | Type | +Description | +
---|---|---|
dict |
+ dict
+ |
+ custom dictionary with the relevant data. |
+
get_polygon_coordinates(pol_geometry: geometry.Polygon | geometry.MultiPolygon) -> geometry.LineString
+
+¶Given a single or multi geometry returns the coordinates composing its outer layout.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
pol_geometry |
+
+ geometry.Polygon | geometry.MultiPolygon
+ |
+ Source geometry. |
+ + required + | +
Raises:
+Type | +Description | +
---|---|
+ NotImplementedError
+ |
+ When the provided geometry is not yet supported. |
+
Returns:
+Type | +Description | +
---|---|
+ geometry.LineString
+ |
+ geometry.LineString: Set of points composing the outer layout of the geometry. |
+
ReinforcementCoatingLayer
+
+
+¶
+ Bases: ReinforcementLayerProtocol
with_same_outer_geometry(coating_layer: KoswatCoatingLayer) -> ReinforcementCoatingLayer
+
+
+ classmethod
+
+
+¶Creates a new reinforcement coating layer which does not differ +in geometry from the provided coating layer. This was found to +be needed in KOSWAT_82.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
coating_layer |
+
+ KoswatCoatingLayer
+ |
+ Base coating layer. |
+ + required + | +
Returns:
+Name | Type | +Description | +
---|---|---|
ReinforcementCoatingLayer |
+ ReinforcementCoatingLayer
+ |
+ Resulting coating layer with "empty" |
+
+ ReinforcementCoatingLayer
+ |
+ polygons for added / removed (layer) geometries. |
+
get_polygon_coordinates(pol_geometry: geometry.Polygon | geometry.MultiPolygon) -> geometry.LineString
+
+¶Given a single or multi geometry returns the coordinates composing its outer layout.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
pol_geometry |
+
+ geometry.Polygon | geometry.MultiPolygon
+ |
+ Source geometry. |
+ + required + | +
Raises:
+Type | +Description | +
---|---|
+ NotImplementedError
+ |
+ When the provided geometry is not yet supported. |
+
Returns:
+Type | +Description | +
---|---|
+ geometry.LineString
+ |
+ geometry.LineString: Set of points composing the outer layout of the geometry. |
+
KoswatLayersWrapperProtocol
+
+
+¶
+ Bases: Protocol
as_data_dict() -> dict
+
+¶Returns the layers as a dictionary.
+ +Returns:
+Name | Type | +Description | +
---|---|---|
dict |
+ dict
+ |
+ Dictionary containing all the information of the wrapper layers ( |
+
ReinforcementCoatingLayer
+
+
+¶
+ Bases: ReinforcementLayerProtocol
with_same_outer_geometry(coating_layer: KoswatCoatingLayer) -> ReinforcementCoatingLayer
+
+
+ classmethod
+
+
+¶Creates a new reinforcement coating layer which does not differ +in geometry from the provided coating layer. This was found to +be needed in KOSWAT_82.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
coating_layer |
+
+ KoswatCoatingLayer
+ |
+ Base coating layer. |
+ + required + | +
Returns:
+Name | Type | +Description | +
---|---|---|
ReinforcementCoatingLayer |
+ ReinforcementCoatingLayer
+ |
+ Resulting coating layer with "empty" |
+
+ ReinforcementCoatingLayer
+ |
+ polygons for added / removed (layer) geometries. |
+
ReinforcementLayersWrapper
+
+
+¶
+ Bases: KoswatLayersWrapperProtocol
layers: list[ReinforcementLayerProtocol]
+
+
+ property
+
+
+¶All the stored layers being the KoswatBaseLayer
the latest one in the collection.
Returns:
+Type | +Description | +
---|---|
+ list[ReinforcementLayerProtocol]
+ |
+ List[KoswatLayerProtocol]: Ordered list of |
+
KoswatLayerProtocol
+
+
+¶
+ Bases: Protocol
as_data_dict() -> dict
+
+¶Returns the information related to an instance of the KoswatLayerProtocol
.
Returns:
+Name | Type | +Description | +
---|---|---|
dict |
+ dict
+ |
+ custom dictionary with the relevant data. |
+
KoswatLayersWrapperBuilderProtocol
+
+
+¶
+ Bases: BuilderProtocol
, Protocol
build() -> KoswatLayersWrapperProtocol
+
+¶Builds an instance of KoswatLayersWrapperProtocol
based on the class required fields layers_data
and profile_points
.
Returns:
+Name | Type | +Description | +
---|---|---|
KoswatLayersWrapperProtocol |
+ KoswatLayersWrapperProtocol
+ |
+ Valid initialized instance of a |
+
KoswatLayersWrapperProtocol
+
+
+¶
+ Bases: Protocol
as_data_dict() -> dict
+
+¶Returns the layers as a dictionary.
+ +Returns:
+Name | Type | +Description | +
---|---|---|
dict |
+ dict
+ |
+ Dictionary containing all the information of the wrapper layers ( |
+
OutsideSlopeReinforcementLayersWrapperBuilder
+
+
+¶
+ Bases: KoswatLayersWrapperBuilderProtocol
ReinforcementCoatingLayer
+
+
+¶
+ Bases: ReinforcementLayerProtocol
with_same_outer_geometry(coating_layer: KoswatCoatingLayer) -> ReinforcementCoatingLayer
+
+
+ classmethod
+
+
+¶Creates a new reinforcement coating layer which does not differ +in geometry from the provided coating layer. This was found to +be needed in KOSWAT_82.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
coating_layer |
+
+ KoswatCoatingLayer
+ |
+ Base coating layer. |
+ + required + | +
Returns:
+Name | Type | +Description | +
---|---|---|
ReinforcementCoatingLayer |
+ ReinforcementCoatingLayer
+ |
+ Resulting coating layer with "empty" |
+
+ ReinforcementCoatingLayer
+ |
+ polygons for added / removed (layer) geometries. |
+
ReinforcementLayersWrapper
+
+
+¶
+ Bases: KoswatLayersWrapperProtocol
layers: list[ReinforcementLayerProtocol]
+
+
+ property
+
+
+¶All the stored layers being the KoswatBaseLayer
the latest one in the collection.
Returns:
+Type | +Description | +
---|---|
+ list[ReinforcementLayerProtocol]
+ |
+ List[KoswatLayerProtocol]: Ordered list of |
+
get_polygon_surface_points(base_geometry: geometry.Polygon | geometry.MultiPolygon) -> geometry.LineString
+
+¶Gets all the points composing the upper surface of a 'dike' geometry.
+IMPORTANT! The calling of this method assumes the base_geometry
points are in order, call order_geometry_points
if needed.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
base_geometry |
+
+ Union[geometry.Polygon, geometry.MultiPolygon]
+ |
+ Source geometry. |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ geometry.LineString
+ |
+ geometry.LineString: Resulting line with points from the outer geometry. |
+
KoswatLayerProtocol
+
+
+¶
+ Bases: Protocol
as_data_dict() -> dict
+
+¶Returns the information related to an instance of the KoswatLayerProtocol
.
Returns:
+Name | Type | +Description | +
---|---|---|
dict |
+ dict
+ |
+ custom dictionary with the relevant data. |
+
KoswatLayersWrapperBuilderProtocol
+
+
+¶
+ Bases: BuilderProtocol
, Protocol
build() -> KoswatLayersWrapperProtocol
+
+¶Builds an instance of KoswatLayersWrapperProtocol
based on the class required fields layers_data
and profile_points
.
Returns:
+Name | Type | +Description | +
---|---|---|
KoswatLayersWrapperProtocol |
+ KoswatLayersWrapperProtocol
+ |
+ Valid initialized instance of a |
+
KoswatLayersWrapperProtocol
+
+
+¶
+ Bases: Protocol
as_data_dict() -> dict
+
+¶Returns the layers as a dictionary.
+ +Returns:
+Name | Type | +Description | +
---|---|---|
dict |
+ dict
+ |
+ Dictionary containing all the information of the wrapper layers ( |
+
ReinforcementCoatingLayer
+
+
+¶
+ Bases: ReinforcementLayerProtocol
with_same_outer_geometry(coating_layer: KoswatCoatingLayer) -> ReinforcementCoatingLayer
+
+
+ classmethod
+
+
+¶Creates a new reinforcement coating layer which does not differ +in geometry from the provided coating layer. This was found to +be needed in KOSWAT_82.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
coating_layer |
+
+ KoswatCoatingLayer
+ |
+ Base coating layer. |
+ + required + | +
Returns:
+Name | Type | +Description | +
---|---|---|
ReinforcementCoatingLayer |
+ ReinforcementCoatingLayer
+ |
+ Resulting coating layer with "empty" |
+
+ ReinforcementCoatingLayer
+ |
+ polygons for added / removed (layer) geometries. |
+
ReinforcementLayersWrapper
+
+
+¶
+ Bases: KoswatLayersWrapperProtocol
layers: list[ReinforcementLayerProtocol]
+
+
+ property
+
+
+¶All the stored layers being the KoswatBaseLayer
the latest one in the collection.
Returns:
+Type | +Description | +
---|---|
+ list[ReinforcementLayerProtocol]
+ |
+ List[KoswatLayerProtocol]: Ordered list of |
+
StandardReinforcementLayersWrapperBuilder
+
+
+¶
+ Bases: KoswatLayersWrapperBuilderProtocol
as_unified_geometry(source_geom: geometry.Polygon | geometry.MultiPolygon) -> geometry.Polygon
+
+¶Ensures the calculated geometry is returned as a single polygon.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
source_geom |
+
+ geometry.Polygon | geometry.MultiPolygon
+ |
+ Calculated source geometry. |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ geometry.Polygon
+ |
+ geometry.Polygon: Unified resulting geometry with its points ordered (first one is the most-left x coordinate). |
+
get_normalized_polygon_difference(left_geom: geometry.Polygon, right_geom: geometry.Polygon) -> geometry.Polygon | geometry.MultiPolygon
+
+¶Given two polygons calculates the difference between them and removes any residual polygon due to minor precision errors.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
left_geom |
+
+ geometry.Polygon
+ |
+ Base polygon from where to substract. |
+ + required + | +
right_geom |
+
+ geometry.Polygon
+ |
+ Polygon to substract from base. |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ geometry.Polygon | geometry.MultiPolygon
+ |
+ geometry.Polygon: Resulting normalized substraction polygon. |
+
get_polygon_surface_points(base_geometry: geometry.Polygon | geometry.MultiPolygon) -> geometry.LineString
+
+¶Gets all the points composing the upper surface of a 'dike' geometry.
+IMPORTANT! The calling of this method assumes the base_geometry
points are in order, call order_geometry_points
if needed.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
base_geometry |
+
+ Union[geometry.Polygon, geometry.MultiPolygon]
+ |
+ Source geometry. |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ geometry.LineString
+ |
+ geometry.LineString: Resulting line with points from the outer geometry. |
+
get_relative_core_layer(core_geometry: geometry.Polygon, coating_geometry: geometry.Polygon) -> geometry.Polygon
+
+¶Returns a new 'core' from the original core_geometry
relative to the coating_geometry
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
core_geometry |
+
+ Polygon
+ |
+ Original core geometry on which layers are stacked upon. |
+ + required + | +
coating_geometry |
+
+ Polygon
+ |
+ Layer wrapping the exterior of a core geometry. |
+ + required + | +
Returns:
+Name | Type | +Description | +
---|---|---|
Polygon |
+ geometry.Polygon
+ |
+ Layer wrapping a reduced surface of the |
+
KoswatProfileBase
+
+
+
+ dataclass
+
+
+¶
+ Bases: KoswatProfileProtocol
Basic definition and implementation of a KoswatProfileProtocol
. It represents the initial koswat profile being provided by the user from which further calculations will be made.
points: list[Point]
+
+
+ property
+
+
+¶The combination of points from both water and polder sides.
+ +Returns:
+Type | +Description | +
---|---|
+ list[Point]
+ |
+ list[Point]: A total of eight points comforming the |
+
profile_height: float
+
+
+ property
+
+
+¶The profile highest point (largest y-coordinate).
+ +Returns:
+Name | Type | +Description | +
---|---|---|
float |
+ float
+ |
+ Greatest y-coordinate. |
+
profile_width: float
+
+
+ property
+
+
+¶The profile extent from the lowest (left-most) x-coordinate to the largest (right-most) x-coordinate from a dike geometry polygon.
+ +Returns:
+Name | Type | +Description | +
---|---|---|
float |
+ float
+ |
+ Total distance. |
+
ReinforcementInputProfileCalculationProtocol
+
+
+¶
+ Bases: BuilderProtocol
, Protocol
build() -> ReinforcementInputProfileProtocol
+
+¶Builds a ReinforcementInputProfileProtocol
instance based on the base_profile
and scenario
specified in this class.
Returns:
+Name | Type | +Description | +
---|---|---|
ReinforcementInputProfileProtocol |
+ ReinforcementInputProfileProtocol
+ |
+ Calculated reinforcement input profile. |
+
ReinforcementInputProfileProtocol
+
+
+¶
+ Bases: KoswatInputProfileProtocol
, Protocol
Just an alias to distinguish from a regular KoswatInputProfileProtocol
.
reinforcement_domain_name: str
+
+
+ property
+
+
+¶Returns the representative name in the "real" world of this reinforcement.
+ReinforcementLayersWrapper
+
+
+¶
+ Bases: KoswatLayersWrapperProtocol
layers: list[ReinforcementLayerProtocol]
+
+
+ property
+
+
+¶All the stored layers being the KoswatBaseLayer
the latest one in the collection.
Returns:
+Type | +Description | +
---|---|
+ list[ReinforcementLayerProtocol]
+ |
+ List[KoswatLayerProtocol]: Ordered list of |
+
ReinforcementProfileBuilderProtocol
+
+
+¶
+ Bases: BuilderProtocol
, Protocol
build() -> ReinforcementProfileProtocol
+
+¶Builds a concrete instance of a ReinforcementProfileProtocol
based on the required data.
Returns:
+Name | Type | +Description | +
---|---|---|
ReinforcementProfileProtocol |
+ ReinforcementProfileProtocol
+ |
+ Valid instance of a |
+
KoswatProfileBase
+
+
+
+ dataclass
+
+
+¶
+ Bases: KoswatProfileProtocol
Basic definition and implementation of a KoswatProfileProtocol
. It represents the initial koswat profile being provided by the user from which further calculations will be made.
points: list[Point]
+
+
+ property
+
+
+¶The combination of points from both water and polder sides.
+ +Returns:
+Type | +Description | +
---|---|
+ list[Point]
+ |
+ list[Point]: A total of eight points comforming the |
+
profile_height: float
+
+
+ property
+
+
+¶The profile highest point (largest y-coordinate).
+ +Returns:
+Name | Type | +Description | +
---|---|---|
float |
+ float
+ |
+ Greatest y-coordinate. |
+
profile_width: float
+
+
+ property
+
+
+¶The profile extent from the lowest (left-most) x-coordinate to the largest (right-most) x-coordinate from a dike geometry polygon.
+ +Returns:
+Name | Type | +Description | +
---|---|---|
float |
+ float
+ |
+ Total distance. |
+
ReinforcementProfileBuilderFactory
+
+
+¶get_available_reinforcements() -> list[ReinforcementProfileProtocol]
+
+
+ staticmethod
+
+
+¶Gets all available reinforcements defined in Koswat.
+ +Returns:
+Type | +Description | +
---|---|
+ list[ReinforcementProfileProtocol]
+ |
+ List[ReinforcementProfileProtocol]: List of reinforcement profile protocols types. |
+
get_reinforcement_builder(reinforcement_profile_type: type[ReinforcementProfileProtocol]) -> ReinforcementProfileBuilderProtocol
+
+
+ staticmethod
+
+
+¶Gets a valid reinforcement profile builder
instance (ReinforcementProfileBuilderProtocol
).
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
reinforcement_profile_type |
+
+ Type[ReinforcementProfileProtocol]
+ |
+ Type that requires a builder. |
+ + required + | +
Raises:
+Type | +Description | +
---|---|
+ NotImplementedError
+ |
+ When there is no builder associated to the given |
+
Returns:
+Name | Type | +Description | +
---|---|---|
ReinforcementProfileBuilderProtocol |
+ ReinforcementProfileBuilderProtocol
+ |
+ Valid instance of a |
+
ReinforcementProfileBuilderProtocol
+
+
+¶
+ Bases: BuilderProtocol
, Protocol
build() -> ReinforcementProfileProtocol
+
+¶Builds a concrete instance of a ReinforcementProfileProtocol
based on the required data.
Returns:
+Name | Type | +Description | +
---|---|---|
ReinforcementProfileProtocol |
+ ReinforcementProfileProtocol
+ |
+ Valid instance of a |
+
ReinforcementProfileProtocol
+
+
+¶
+ Bases: KoswatProfileProtocol
, Protocol
Extension of the KoswatProfileProtocol
to define the properties of a calculated reinforcement.
StandardReinforcementProfileBuilder
+
+
+¶
+ Bases: ReinforcementProfileBuilderBase
get_input_profile_calculator(reinforcement_type: type[StandardReinforcementProfile]) -> ReinforcementInputProfileCalculationProtocol
+
+
+ staticmethod
+
+
+¶Get the input profile calculator for the given reinforcement type.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
reinforcement_type |
+
+ type[StandardReinforcementProfile]
+ |
+ The reinforcement type. |
+ + required + | +
Raises:
+Type | +Description | +
---|---|
+ NotImplementedError
+ |
+ The given reinforcement type is not supported. |
+
Returns:
+Name | Type | +Description | +
---|---|---|
ReinforcementInputProfileCalculationProtocol |
+ ReinforcementInputProfileCalculationProtocol
+ |
+ The input profile calculator. |
+
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. |
+
KoswatProfileBase
+
+
+
+ dataclass
+
+
+¶
+ Bases: KoswatProfileProtocol
Basic definition and implementation of a KoswatProfileProtocol
. It represents the initial koswat profile being provided by the user from which further calculations will be made.
points: list[Point]
+
+
+ property
+
+
+¶The combination of points from both water and polder sides.
+ +Returns:
+Type | +Description | +
---|---|
+ list[Point]
+ |
+ list[Point]: A total of eight points comforming the |
+
profile_height: float
+
+
+ property
+
+
+¶The profile highest point (largest y-coordinate).
+ +Returns:
+Name | Type | +Description | +
---|---|---|
float |
+ float
+ |
+ Greatest y-coordinate. |
+
profile_width: float
+
+
+ property
+
+
+¶The profile extent from the lowest (left-most) x-coordinate to the largest (right-most) x-coordinate from a dike geometry polygon.
+ +Returns:
+Name | Type | +Description | +
---|---|---|
float |
+ float
+ |
+ Total distance. |
+
ReinforcementProfileBuilderProtocol
+
+
+¶
+ Bases: BuilderProtocol
, Protocol
build() -> ReinforcementProfileProtocol
+
+¶Builds a concrete instance of a ReinforcementProfileProtocol
based on the required data.
Returns:
+Name | Type | +Description | +
---|---|---|
ReinforcementProfileProtocol |
+ ReinforcementProfileProtocol
+ |
+ Valid instance of a |
+
ReinforcementProfileProtocol
+
+
+¶
+ Bases: KoswatProfileProtocol
, Protocol
Extension of the KoswatProfileProtocol
to define the properties of a calculated reinforcement.
ReinforcementInputProfileProtocol
+
+
+¶
+ Bases: KoswatInputProfileProtocol
, Protocol
Just an alias to distinguish from a regular KoswatInputProfileProtocol
.
reinforcement_domain_name: str
+
+
+ property
+
+
+¶Returns the representative name in the "real" world of this reinforcement.
+ReinforcementLayersWrapper
+
+
+¶
+ Bases: KoswatLayersWrapperProtocol
layers: list[ReinforcementLayerProtocol]
+
+
+ property
+
+
+¶All the stored layers being the KoswatBaseLayer
the latest one in the collection.
Returns:
+Type | +Description | +
---|---|
+ list[ReinforcementLayerProtocol]
+ |
+ List[KoswatLayerProtocol]: Ordered list of |
+
ReinforcementProfileProtocol
+
+
+¶
+ Bases: KoswatProfileProtocol
, Protocol
Extension of the KoswatProfileProtocol
to define the properties of a calculated reinforcement.
KoswatProfileBase
+
+
+
+ dataclass
+
+
+¶
+ Bases: KoswatProfileProtocol
Basic definition and implementation of a KoswatProfileProtocol
. It represents the initial koswat profile being provided by the user from which further calculations will be made.
points: list[Point]
+
+
+ property
+
+
+¶The combination of points from both water and polder sides.
+ +Returns:
+Type | +Description | +
---|---|
+ list[Point]
+ |
+ list[Point]: A total of eight points comforming the |
+
profile_height: float
+
+
+ property
+
+
+¶The profile highest point (largest y-coordinate).
+ +Returns:
+Name | Type | +Description | +
---|---|---|
float |
+ float
+ |
+ Greatest y-coordinate. |
+
profile_width: float
+
+
+ property
+
+
+¶The profile extent from the lowest (left-most) x-coordinate to the largest (right-most) x-coordinate from a dike geometry polygon.
+ +Returns:
+Name | Type | +Description | +
---|---|---|
float |
+ float
+ |
+ Total distance. |
+
ReinforcementInputProfileProtocol
+
+
+¶
+ Bases: KoswatInputProfileProtocol
, Protocol
Just an alias to distinguish from a regular KoswatInputProfileProtocol
.
reinforcement_domain_name: str
+
+
+ property
+
+
+¶Returns the representative name in the "real" world of this reinforcement.
+ReinforcementLayersWrapper
+
+
+¶
+ Bases: KoswatLayersWrapperProtocol
layers: list[ReinforcementLayerProtocol]
+
+
+ property
+
+
+¶All the stored layers being the KoswatBaseLayer
the latest one in the collection.
Returns:
+Type | +Description | +
---|---|
+ list[ReinforcementLayerProtocol]
+ |
+ List[KoswatLayerProtocol]: Ordered list of |
+
ReinforcementProfileProtocol
+
+
+¶
+ Bases: KoswatProfileProtocol
, Protocol
Extension of the KoswatProfileProtocol
to define the properties of a calculated reinforcement.
ReinforcementLayersWrapper
+
+
+¶
+ Bases: KoswatLayersWrapperProtocol
layers: list[ReinforcementLayerProtocol]
+
+
+ property
+
+
+¶All the stored layers being the KoswatBaseLayer
the latest one in the collection.
Returns:
+Type | +Description | +
---|---|
+ list[ReinforcementLayerProtocol]
+ |
+ List[KoswatLayerProtocol]: Ordered list of |
+
CofferdamInputProfileCalculation
+
+
+¶
+ Bases: ReinforcementInputProfileCalculationBase
, ReinforcementInputProfileCalculationProtocol
KoswatProfileBase
+
+
+
+ dataclass
+
+
+¶
+ Bases: KoswatProfileProtocol
Basic definition and implementation of a KoswatProfileProtocol
. It represents the initial koswat profile being provided by the user from which further calculations will be made.
points: list[Point]
+
+
+ property
+
+
+¶The combination of points from both water and polder sides.
+ +Returns:
+Type | +Description | +
---|---|
+ list[Point]
+ |
+ list[Point]: A total of eight points comforming the |
+
profile_height: float
+
+
+ property
+
+
+¶The profile highest point (largest y-coordinate).
+ +Returns:
+Name | Type | +Description | +
---|---|---|
float |
+ float
+ |
+ Greatest y-coordinate. |
+
profile_width: float
+
+
+ property
+
+
+¶The profile extent from the lowest (left-most) x-coordinate to the largest (right-most) x-coordinate from a dike geometry polygon.
+ +Returns:
+Name | Type | +Description | +
---|---|---|
float |
+ float
+ |
+ Total distance. |
+
OutsideSlopeReinforcementLayersWrapperBuilder
+
+
+¶
+ Bases: KoswatLayersWrapperBuilderProtocol
ReinforcementInputProfileCalculationProtocol
+
+
+¶
+ Bases: BuilderProtocol
, Protocol
build() -> ReinforcementInputProfileProtocol
+
+¶Builds a ReinforcementInputProfileProtocol
instance based on the base_profile
and scenario
specified in this class.
Returns:
+Name | Type | +Description | +
---|---|---|
ReinforcementInputProfileProtocol |
+ ReinforcementInputProfileProtocol
+ |
+ Calculated reinforcement input profile. |
+
ReinforcementInputProfileProtocol
+
+
+¶
+ Bases: KoswatInputProfileProtocol
, Protocol
Just an alias to distinguish from a regular KoswatInputProfileProtocol
.
reinforcement_domain_name: str
+
+
+ property
+
+
+¶Returns the representative name in the "real" world of this reinforcement.
+ReinforcementLayersWrapper
+
+
+¶
+ Bases: KoswatLayersWrapperProtocol
layers: list[ReinforcementLayerProtocol]
+
+
+ property
+
+
+¶All the stored layers being the KoswatBaseLayer
the latest one in the collection.
Returns:
+Type | +Description | +
---|---|
+ list[ReinforcementLayerProtocol]
+ |
+ List[KoswatLayerProtocol]: Ordered list of |
+
ReinforcementLayersWrapper
+
+
+¶
+ Bases: KoswatLayersWrapperProtocol
layers: list[ReinforcementLayerProtocol]
+
+
+ property
+
+
+¶All the stored layers being the KoswatBaseLayer
the latest one in the collection.
Returns:
+Type | +Description | +
---|---|
+ list[ReinforcementLayerProtocol]
+ |
+ List[KoswatLayerProtocol]: Ordered list of |
+
ReinforcementLayersWrapper
+
+
+¶
+ Bases: KoswatLayersWrapperProtocol
layers: list[ReinforcementLayerProtocol]
+
+
+ property
+
+
+¶All the stored layers being the KoswatBaseLayer
the latest one in the collection.
Returns:
+Type | +Description | +
---|---|
+ list[ReinforcementLayerProtocol]
+ |
+ List[KoswatLayerProtocol]: Ordered list of |
+
ReinforcementLayersWrapper
+
+
+¶
+ Bases: KoswatLayersWrapperProtocol
layers: list[ReinforcementLayerProtocol]
+
+
+ property
+
+
+¶All the stored layers being the KoswatBaseLayer
the latest one in the collection.
Returns:
+Type | +Description | +
---|---|
+ list[ReinforcementLayerProtocol]
+ |
+ List[KoswatLayerProtocol]: Ordered list of |
+
KoswatProfileBase
+
+
+
+ dataclass
+
+
+¶
+ Bases: KoswatProfileProtocol
Basic definition and implementation of a KoswatProfileProtocol
. It represents the initial koswat profile being provided by the user from which further calculations will be made.
points: list[Point]
+
+
+ property
+
+
+¶The combination of points from both water and polder sides.
+ +Returns:
+Type | +Description | +
---|---|
+ list[Point]
+ |
+ list[Point]: A total of eight points comforming the |
+
profile_height: float
+
+
+ property
+
+
+¶The profile highest point (largest y-coordinate).
+ +Returns:
+Name | Type | +Description | +
---|---|---|
float |
+ float
+ |
+ Greatest y-coordinate. |
+
profile_width: float
+
+
+ property
+
+
+¶The profile extent from the lowest (left-most) x-coordinate to the largest (right-most) x-coordinate from a dike geometry polygon.
+ +Returns:
+Name | Type | +Description | +
---|---|---|
float |
+ float
+ |
+ Total distance. |
+
OutsideSlopeReinforcementLayersWrapperBuilder
+
+
+¶
+ Bases: KoswatLayersWrapperBuilderProtocol
PipingWallInputProfileCalculation
+
+
+¶
+ Bases: ReinforcementInputProfileCalculationBase
, ReinforcementInputProfileCalculationProtocol
ReinforcementInputProfileCalculationProtocol
+
+
+¶
+ Bases: BuilderProtocol
, Protocol
build() -> ReinforcementInputProfileProtocol
+
+¶Builds a ReinforcementInputProfileProtocol
instance based on the base_profile
and scenario
specified in this class.
Returns:
+Name | Type | +Description | +
---|---|---|
ReinforcementInputProfileProtocol |
+ ReinforcementInputProfileProtocol
+ |
+ Calculated reinforcement input profile. |
+
ReinforcementInputProfileProtocol
+
+
+¶
+ Bases: KoswatInputProfileProtocol
, Protocol
Just an alias to distinguish from a regular KoswatInputProfileProtocol
.
reinforcement_domain_name: str
+
+
+ property
+
+
+¶Returns the representative name in the "real" world of this reinforcement.
+ReinforcementLayersWrapper
+
+
+¶
+ Bases: KoswatLayersWrapperProtocol
layers: list[ReinforcementLayerProtocol]
+
+
+ property
+
+
+¶All the stored layers being the KoswatBaseLayer
the latest one in the collection.
Returns:
+Type | +Description | +
---|---|
+ list[ReinforcementLayerProtocol]
+ |
+ List[KoswatLayerProtocol]: Ordered list of |
+
SoilInputProfileCalculation
+
+
+¶
+ Bases: ReinforcementInputProfileCalculationBase
, ReinforcementInputProfileCalculationProtocol
StabilityWallInputProfileCalculation
+
+
+¶
+ Bases: ReinforcementInputProfileCalculationBase
, ReinforcementInputProfileCalculationProtocol
StandardReinforcementLayersWrapperBuilder
+
+
+¶
+ Bases: KoswatLayersWrapperBuilderProtocol
StandardReinforcementProfileBuilder
+
+
+¶
+ Bases: ReinforcementProfileBuilderBase
get_input_profile_calculator(reinforcement_type: type[StandardReinforcementProfile]) -> ReinforcementInputProfileCalculationProtocol
+
+
+ staticmethod
+
+
+¶Get the input profile calculator for the given reinforcement type.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
reinforcement_type |
+
+ type[StandardReinforcementProfile]
+ |
+ The reinforcement type. |
+ + required + | +
Raises:
+Type | +Description | +
---|---|
+ NotImplementedError
+ |
+ The given reinforcement type is not supported. |
+
Returns:
+Name | Type | +Description | +
---|---|---|
ReinforcementInputProfileCalculationProtocol |
+ ReinforcementInputProfileCalculationProtocol
+ |
+ The input profile calculator. |
+
ReinforcementLayersWrapper
+
+
+¶
+ Bases: KoswatLayersWrapperProtocol
layers: list[ReinforcementLayerProtocol]
+
+
+ property
+
+
+¶All the stored layers being the KoswatBaseLayer
the latest one in the collection.
Returns:
+Type | +Description | +
---|---|
+ list[ReinforcementLayerProtocol]
+ |
+ List[KoswatLayerProtocol]: Ordered list of |
+
KoswatHandler
+
+
+¶Handler for CLI usage of Koswat
. It allows the initialization of a logger during the analysis.
__init__(log_output: Optional[str]) -> None
+
+¶Initializes the handler creating a log file at the optional provided directory log_output
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
log_output |
+
+ Optional[str]
+ |
+ Directory where to save the |
+ + required + | +
run_analysis(analysis_file: str) -> None
+
+¶Runs a Koswat analysis using the provided *.ini
file analysis_file
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
analysis_file |
+
+ str
+ |
+ Location of the main koswat analysis ini file. |
+ + required + | +
KoswatLogger
+
+
+¶KoswatSummaryBuilder
+
+
+
+ dataclass
+
+
+¶
+ Bases: BuilderProtocol
KoswatHandler
+
+
+¶Handler for CLI usage of Koswat
. It allows the initialization of a logger during the analysis.
__init__(log_output: Optional[str]) -> None
+
+¶Initializes the handler creating a log file at the optional provided directory log_output
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
log_output |
+
+ Optional[str]
+ |
+ Directory where to save the |
+ + required + | +
run_analysis(analysis_file: str) -> None
+
+¶Runs a Koswat analysis using the provided *.ini
file analysis_file
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
analysis_file |
+
+ str
+ |
+ Location of the main koswat analysis ini file. |
+ + required + | +
run_analysis(input_file: str, log_output: str)
+
+¶CLI call to execute a Koswat analysis given a settings files (input_file
). The log is generated by default in the execute path, unless otherwise specified in the log_output
argument.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
input_file |
+
+ str
+ |
+ Location of the |
+ + required + | +
log_output |
+
+ str
+ |
+ Optional argument to specify where will be created the |
+ + required + | +
KoswatLayerPlot
+
+
+¶
+ Bases: KoswatPlotProtocol
plot(color: str) -> None
+
+¶Plots a KoswatLayerProtocol
into the provided canvas plot_axes
with the requested color
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
color |
+
+ str
+ |
+ Color code. |
+ + required + | +
return list(
+ map(concatenate, zip(*map(lambda x: x.coords.xy, koswat_geometry.geoms)))
+)
+ ValueError: When the KoswatLayerProtocol
material has not been registered.
KoswatLayerProtocol
+
+
+¶
+ Bases: Protocol
as_data_dict() -> dict
+
+¶Returns the information related to an instance of the KoswatLayerProtocol
.
Returns:
+Name | Type | +Description | +
---|---|---|
dict |
+ dict
+ |
+ custom dictionary with the relevant data. |
+
KoswatPlotProtocol
+
+
+¶
+ Bases: Protocol
plot(*args, **kwargs) -> pyplot.axes
+
+¶Plots a koswat_object
into the provided plot ax
with the requested *args
and **kwargs
.
Returns:
+Type | +Description | +
---|---|
+ pyplot.axes
+ |
+ pyplot.axes: Canvas with plotted |
+
KoswatLayerPlot
+
+
+¶
+ Bases: KoswatPlotProtocol
plot(color: str) -> None
+
+¶Plots a KoswatLayerProtocol
into the provided canvas plot_axes
with the requested color
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
color |
+
+ str
+ |
+ Color code. |
+ + required + | +
return list(
+ map(concatenate, zip(*map(lambda x: x.coords.xy, koswat_geometry.geoms)))
+)
+ ValueError: When the KoswatLayerProtocol
material has not been registered.
KoswatLayerProtocol
+
+
+¶
+ Bases: Protocol
as_data_dict() -> dict
+
+¶Returns the information related to an instance of the KoswatLayerProtocol
.
Returns:
+Name | Type | +Description | +
---|---|---|
dict |
+ dict
+ |
+ custom dictionary with the relevant data. |
+
KoswatLayersWrapperPlot
+
+
+¶
+ Bases: KoswatPlotProtocol
with_layers_list(layers_list: List[KoswatLayerProtocol]) -> KoswatLayersWrapperPlot
+
+
+ classmethod
+
+
+¶Class method to aid the usage of this class with unrelated layers from different wrappers.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
layers_list |
+
+ List[KoswatLayerProtocol]
+ |
+ List of layers to wrap just for plotting. |
+ + required + | +
Returns:
+Name | Type | +Description | +
---|---|---|
KoswatLayersWrapperPlot |
+ KoswatLayersWrapperPlot
+ |
+ Initialized valid instance with custom intenal wrapper |
+
KoswatLayersWrapperProtocol
+
+
+¶
+ Bases: Protocol
as_data_dict() -> dict
+
+¶Returns the layers as a dictionary.
+ +Returns:
+Name | Type | +Description | +
---|---|---|
dict |
+ dict
+ |
+ Dictionary containing all the information of the wrapper layers ( |
+
KoswatPlotProtocol
+
+
+¶
+ Bases: Protocol
plot(*args, **kwargs) -> pyplot.axes
+
+¶Plots a koswat_object
into the provided plot ax
with the requested *args
and **kwargs
.
Returns:
+Type | +Description | +
---|---|
+ pyplot.axes
+ |
+ pyplot.axes: Canvas with plotted |
+
get_cmap(n_colors: int, name: int = 'hsv')
+
+¶Returns a function that maps each index in 0, 1, ..., n-1 to a distinct +RGB color; the keyword argument name must be a standard mpl colormap name.
+ +KoswatLayersWrapperPlot
+
+
+¶
+ Bases: KoswatPlotProtocol
with_layers_list(layers_list: List[KoswatLayerProtocol]) -> KoswatLayersWrapperPlot
+
+
+ classmethod
+
+
+¶Class method to aid the usage of this class with unrelated layers from different wrappers.
+ +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
layers_list |
+
+ List[KoswatLayerProtocol]
+ |
+ List of layers to wrap just for plotting. |
+ + required + | +
Returns:
+Name | Type | +Description | +
---|---|---|
KoswatLayersWrapperPlot |
+ KoswatLayersWrapperPlot
+ |
+ Initialized valid instance with custom intenal wrapper |
+
KoswatPlotProtocol
+
+
+¶
+ Bases: Protocol
plot(*args, **kwargs) -> pyplot.axes
+
+¶Plots a koswat_object
into the provided plot ax
with the requested *args
and **kwargs
.
Returns:
+Type | +Description | +
---|---|
+ pyplot.axes
+ |
+ pyplot.axes: Canvas with plotted |
+
KoswatPlotProtocol
+
+
+¶
+ Bases: Protocol
plot(*args, **kwargs) -> pyplot.axes
+
+¶Plots a koswat_object
into the provided plot ax
with the requested *args
and **kwargs
.
Returns:
+Type | +Description | +
---|---|
+ pyplot.axes
+ |
+ pyplot.axes: Canvas with plotted |
+
HighlightGeometryPlot
+
+
+¶
+ Bases: KoswatPlotProtocol
plot(*args, **kwargs) -> pyplot.axes
+
+¶Plots a layer highlighting its content.
+ +Returns:
+Type | +Description | +
---|---|
+ pyplot.axes
+ |
+ pyplot.axes: Polygon with its area painted. |
+
KoswatPlotProtocol
+
+
+¶
+ Bases: Protocol
plot(*args, **kwargs) -> pyplot.axes
+
+¶Plots a koswat_object
into the provided plot ax
with the requested *args
and **kwargs
.
Returns:
+Type | +Description | +
---|---|
+ pyplot.axes
+ |
+ pyplot.axes: Canvas with plotted |
+
KoswatFigureContextHandler
+
+
+¶PyPlot fig context handler that opens the figure stream and closes it saving it to the appointed path.
+ +with KoswatFigureContext(Path("C://my_plot.png"), 42) as _figure: + _subplot = _figure.add_subplot() + ...
+__enter__() -> Figure
+
+¶Access to the context and invokation of pyplot.figure(dpi)
.
Returns:
+Name | Type | +Description | +
---|---|---|
Figure |
+ Figure
+ |
+ Initialized instance from |
+
__exit__(*args, **kwargs) -> None
+
+¶Exit the current context and save the previously initialized Figure
.
__init__(output_path: Path, dpi: int) -> None
+
+¶Initializes the context by invoking pyplot.figure(dpi=dpi)
and saving its output to an internal field.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
output_path |
+
+ Path
+ |
+ Export location for the generated plot. |
+ + required + | +
dpi |
+
+ int
+ |
+ Canvas resolution in dots-per-inch. |
+ + required + | +
KoswatPlotProtocol
+
+
+¶
+ Bases: Protocol
plot(*args, **kwargs) -> pyplot.axes
+
+¶Plots a koswat_object
into the provided plot ax
with the requested *args
and **kwargs
.
Returns:
+Type | +Description | +
---|---|
+ pyplot.axes
+ |
+ pyplot.axes: Canvas with plotted |
+
KoswatExporterProtocol
+
+
+¶
+ Bases: Protocol
export(**kwargs) -> None
+
+¶Exports an object model into a concrete file format.
+ +PlotExporterProtocol
+
+
+¶
+ Bases: KoswatExporterProtocol
, Protocol
export() -> None
+
+¶Exports a given object into a plot.
+ +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.
zone_limit_collection
= (0, 4), (4, 11)surroundings_matrix
= {5: 1.5, 10: 3, 15: 6}(0, 4)
takes key 5
.(4, 11)
takes key(s) 10
and 15
because 5
was already taken.(1.5, 9)
Returns:
+Type | +Description | +
---|---|
+ list[float]
+ |
+ list[float]: list with total width corresponding to each provided zone. |
+
ReinforcementProfileProtocol
+
+
+¶
+ Bases: KoswatProfileProtocol
, Protocol
Extension of the KoswatProfileProtocol
to define the properties of a calculated reinforcement.
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.
zone_limit_collection
= (0, 4), (4, 11)surroundings_matrix
= {5: 1.5, 10: 3, 15: 6}(0, 4)
takes key 5
.(4, 11)
takes key(s) 10
and 15
because 5
was already taken.(1.5, 9)
Returns:
+Type | +Description | +
---|---|
+ list[float]
+ |
+ list[float]: list with total width corresponding to each provided zone. |
+
ReinforcementProfileProtocol
+
+
+¶
+ Bases: KoswatProfileProtocol
, Protocol
Extension of the KoswatProfileProtocol
to define the properties of a calculated reinforcement.
StrategyProtocol
+
+
+¶
+ Bases: Protocol
apply_strategy(strategy_input: StrategyInput) -> list[StrategyLocationReinforcement]
+
+¶Applies a specific strategy by matching each location (PointSurroundings
)
+ to a valid reinforcement type (ReinforcementProfileProtocol
).
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
strategy_input |
+
+ `StrategyInput`
+ |
+ Input data structure containing locations and available reinforcements for each of them. |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ list[StrategyLocationReinforcement]
+ |
+ list[StrategyLocationReinforcement]: List of mapped locations to applied reinforcement. |
+
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.
zone_limit_collection
= (0, 4), (4, 11)surroundings_matrix
= {5: 1.5, 10: 3, 15: 6}(0, 4)
takes key 5
.(4, 11)
takes key(s) 10
and 15
because 5
was already taken.(1.5, 9)
Returns:
+Type | +Description | +
---|---|
+ list[float]
+ |
+ list[float]: list with total width corresponding to each provided zone. |
+
ReinforcementProfileProtocol
+
+
+¶
+ Bases: KoswatProfileProtocol
, Protocol
Extension of the KoswatProfileProtocol
to define the properties of a calculated reinforcement.
StrategyProtocol
+
+
+¶
+ Bases: Protocol
apply_strategy(strategy_input: StrategyInput) -> list[StrategyLocationReinforcement]
+
+¶Applies a specific strategy by matching each location (PointSurroundings
)
+ to a valid reinforcement type (ReinforcementProfileProtocol
).
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
strategy_input |
+
+ `StrategyInput`
+ |
+ Input data structure containing locations and available reinforcements for each of them. |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ list[StrategyLocationReinforcement]
+ |
+ list[StrategyLocationReinforcement]: List of mapped locations to applied reinforcement. |
+
ReinforcementProfileProtocol
+
+
+¶
+ Bases: KoswatProfileProtocol
, Protocol
Extension of the KoswatProfileProtocol
to define the properties of a calculated reinforcement.
ReinforcementProfileProtocol
+
+
+¶
+ Bases: KoswatProfileProtocol
, Protocol
Extension of the KoswatProfileProtocol
to define the properties of a calculated reinforcement.
OrderCluster
+
+
+
+ dataclass
+
+
+¶extend_cluster(other: OrderCluster)
+
+¶Extends the current cluster with the reinforcements
+(list[StrategyLocationReinforcement]
) from another cluster.
+Modifies the selected_measure
property of those measures being merged but it
+does not remove them from their source cluster.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
other |
+
+ OrderCluster
+ |
+ Cluster whose contents will be used to extend |
+ + required + | +
Raises:
+Type | +Description | +
---|---|
+ ValueError
+ |
+ When trying to extend from an unrelated cluster. |
+
get_stronger_cluster() -> OrderCluster
+
+¶Gets the neighbor with the lowest reinforcement type value greater
+than the current cluster's value (self.reinforcement_idx
).
Returns:
+Name | Type | +Description | +
---|---|---|
OrderCluster |
+ OrderCluster
+ |
+ Neighbor with a stronger |
+
is_compliant(min_length: float, strongest_reinforcement: int) -> bool
+
+¶Checks whether this OrderCluster
instance is compliant within a cluster group.
+This method does not check for exceptions, such as, the cluster's neighbors are
+of lower strength than the current.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
min_length |
+
+ float
+ |
+ Minimal length a reinforcement measure is required +for a cluster. |
+ + required + | +
strongest_reinforcement |
+
+ int
+ |
+ What is the reinforcement index which cannot +be futher 'strengthen'. |
+ + required + | +
Returns:
+Name | Type | +Description | +
---|---|---|
bool |
+ bool
+ |
+ if the cluster is compliant within its neighbors context. |
+
ReinforcementProfileProtocol
+
+
+¶
+ Bases: KoswatProfileProtocol
, Protocol
Extension of the KoswatProfileProtocol
to define the properties of a calculated reinforcement.
OrderCluster
+
+
+
+ dataclass
+
+
+¶extend_cluster(other: OrderCluster)
+
+¶Extends the current cluster with the reinforcements
+(list[StrategyLocationReinforcement]
) from another cluster.
+Modifies the selected_measure
property of those measures being merged but it
+does not remove them from their source cluster.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
other |
+
+ OrderCluster
+ |
+ Cluster whose contents will be used to extend |
+ + required + | +
Raises:
+Type | +Description | +
---|---|
+ ValueError
+ |
+ When trying to extend from an unrelated cluster. |
+
get_stronger_cluster() -> OrderCluster
+
+¶Gets the neighbor with the lowest reinforcement type value greater
+than the current cluster's value (self.reinforcement_idx
).
Returns:
+Name | Type | +Description | +
---|---|---|
OrderCluster |
+ OrderCluster
+ |
+ Neighbor with a stronger |
+
is_compliant(min_length: float, strongest_reinforcement: int) -> bool
+
+¶Checks whether this OrderCluster
instance is compliant within a cluster group.
+This method does not check for exceptions, such as, the cluster's neighbors are
+of lower strength than the current.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
min_length |
+
+ float
+ |
+ Minimal length a reinforcement measure is required +for a cluster. |
+ + required + | +
strongest_reinforcement |
+
+ int
+ |
+ What is the reinforcement index which cannot +be futher 'strengthen'. |
+ + required + | +
Returns:
+Name | Type | +Description | +
---|---|---|
bool |
+ bool
+ |
+ if the cluster is compliant within its neighbors context. |
+
As described in the user manual, the tool can be used either as a sandbox, where the user has responsibility on how to put together an analysis, or as a command line tool.
+When using the latter unfortunately we will only have one available call, in this chapter we will breakdown this main workflow so that we can better understand the structure of the rest of the package.
+First of all, let's write the workflow as a pipeline:
+CLI call
+-> Import of ini files
+-> Run scenarios
+ -> Generate reinforcement profiles
+ -> Calculate reinforcement costs
+ -> Apply measure selection strategy
+ -> Calculate total costs
+ -> Export results
+
+ |
---|
Image 1. General Workflow | +
This step is very straightforward, the command line will run the method run_analysis
, which will initiate the KoswatHandler
and start an analysis.
This step comprehends of several more steps. Usually, for each of the file imports an internal workflow will happen:
+File -> Import -> File Object Model -> Build -> Data Object Model
This step is summarized by the generation of the KoswatRunSettings
object.
Each KoswatRunScenarioSettings
will run a koswat analysis for a given dike section.
+To do so, a specific KoswatProfileBase
will be created based on the conditions from the KoswatScenario
and the surroundings of said dike section.
All reinforcement profiles will be calculated for the scenario KoswatProfileBase
profile.
For this step, we will be creating a cost report +For each of the reinforcement profiles we will calculate their associated costs if they were to be applied at all the available traject points where the surroundings allow it.
+Based on the available locations and the reinforcements that can be applied to it, a selection strategy finds which construction should be done at each location based on the strategy's criteria.
+Once Koswat
knows which measure will be applied to each location, and with the previously calculated reinforcement costs, it will estimate the total meters required of each reinforcement and their total cost in euros (€).
Once the costs reports are generate each of the summaries is exported to a *.csv
file whilst the reinforcement profiles 'layers' are also exported into different *.png
files.
In koswat we consider a reinforcement profile the result of applying one of the multiple possible reinforcement calculations on an instance of a KoswatProfileBase
(Koswat dike).
This chapter covers the description of a reinforcement profile and its parts.
+A reinforcement profile implements the ReinforcementProfileProtocol
, which is a specialization of the KoswatProfileProtocol
with some differences:
input_data
: Similar to the base profile input_data
but instead implements the ReinforcementInputProfileProtocol
, a specialization of the (KoswatInputProfileProtocol
) which depends on the type of reinforcement being applied.old_profile
: New property which contains the koswat profile from which the calculation was based on.We have two main different sort of reinfocements which contain also subtypes for said reinforcements:
+OutsideSlopeReinforcementProfile
.StandardReinforcementProfile
.In addition, the above mentioned reinforcements can also implement their own ReinforcementInputProfileProtocol
, which are after all extensions of the KoswatInputProfileBase
with extra properties.
Koswat can determine which is the "best" reinforcement type for a dike traject based on different selection criteria that we name "strategies" (StrategyProtocol
).
A strategy requires a strategy input (StrategyInput
), this input contains information over which reinforcement types are available at each location as well as what's the minimal buffer (reinforcement_min_buffer
) and minimal length (reinforcement_min_length
) for each reinforcement type.
By default a strategy is applied as follows:
+CofferDam
).reinforcement_min_buffer
) for each one of the reinforcements.reinforcement_min_length
), otherwise change it into one of the reinforcements next to it.list[StrategyLocationReinforcement]
).This strategy is the first and default of all defined strategies. Its criteria is based on a pre-defined 'order' of each reinforcement. In steps, it can be seen as:
+The predefined (hardcoded) reinforcement's order, from least to most restrictive, is as follows:
+SoilReinforcementProfile
VPSReinforcementProfile
PipingWallReinforcementProfile
StabilityWallReinforcementProfile
CofferDamReinforcementProfile
We create reinforcement-location "grouping" for the whole traject.
+A grouping represents a reinforcement type that is "selected" for a series of continuous locations. This means locations that are next to each other sharing the same measure type (Type[ReinforcementProfileProtocol]
).
Simplified representation for a traject with 10 locations. This example is also tested in the tests.strategies.order_strategy.py
test file.
+
{
+ "SoilReinforcementProfile": [
+ "Location_000",
+ "Location_001",
+ "Location_002",
+ ],
+ "StabilityWallReinforcementProfile": [
+ "Location_003",
+ "Location_004",
+ ],
+ "SoilReinforcementProfile": [
+ "Location_005",
+ "Location_006",
+ "Location_007",
+ ],
+ "CofferDamReinforcementProfile": [
+ "Location_008",
+ "Location_009",
+ ],
+}
+
Given a reinforcement grouping, we will create a dictionary of masks of size NM
where N
(the keys) is the number of available reinforcement types (Type[ReinforcementProfileProtocol]
) and M
the number of available locations.
Note: Masks' values are the position of a reinforcement type in the reinforcement's order list. So a location withCofferDamReinforcementProfile
will have a 4 at the mask's position, whilst a SoilReinforcementProfile
will have a 0 instead (remember in Python indexing starts with 0).
Steps breakdown:
+Initialize the dictionary masks with all values to -1.
+Iterate over the groupings list, and for each entry:
+Select the mask to update using the grouping's reinforcement type (cluster's key).
+Update the indices representing the grouping's locations (grouping's values) with the matching value for this grouping's key (see previous note).
+Add a buffer (StrategyInput.reinforcement_min_buffer
) by updating the adjacent's positions of this grouping with the same values as in step 1.
Merge all masks into a 1-dimensional array where the cell's value is the maximum between the available masks.
+CofferDamReinforcementProfile
is replaced by a "weaker" one.Update the locations with their new associated reinforcement. The resulting mask contains the index of the reinforcement to be applied in the reinforcement's order.
+One simplified example, based on the grouping example, and using a buffer value of "1". This example is also tested in the tests.strategies.order_strategy_buffering.py
test file.
1. Initialize the masks based on the provided clusters:
+{
+ "SoilReinforcementProfile":
+ [-1, -1, -1, -1, -1, -1 ,-1, -1, -1, -1],
+ "VPSReinforcementProfile":
+ [-1, -1, -1, -1, -1, -1 ,-1, -1, -1, -1],
+ "PipingWallReinforcementProfile":
+ [-1, -1, -1, -1, -1, -1 ,-1, -1, -1, -1],
+ "StabilityWallReinforcementProfile":
+ [-1, -1, -1, -1, -1, -1 ,-1, -1, -1, -1],
+ "CofferDamReinforcementProfile":
+ [-1, -1, -1, -1, -1, -1 ,-1, -1, -1, -1],
+}
+
+2. Iterate over the clusters and update the masks' values:
+{
+ "SoilReinforcementProfile":
+ [ 0, 0, 0, 0, 0, 0, 0, 0, 0, -1],
+ "VPSReinforcementProfile":
+ [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1],
+ "PipingWallReinforcementProfile":
+ [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1],
+ "StabilityWallReinforcementProfile":
+ [-1, -1, 3, 3, 3, 3, -1, -1, -1, -1],
+ "CofferDamReinforcementProfile":
+ [-1, -1, -1, -1, -1, -1, -1, 4, 4, 4],
+}
+
+3. Merge all masks and select their maximum value:
+[0, 0, 3, 3, 3, 3, 0, 4, 4, 4]
+
+4. Update the cluster's locations:
+{
+ "SoilReinforcementProfile": [
+ "Location_000",
+ "Location_001",
+ ],
+ "StabilityWallReinforcementProfile": [
+ "Location_002",
+ "Location_003",
+ "Location_004",
+ "Location_005",
+ ],
+ "SoilReinforcementProfile": [
+ "Location_006",
+ ],
+ "CofferDamReinforcementProfile": [
+ "Location_007",
+ "Location_008",
+ "Location_009",
+ ],
+}
+
Given a reinforcement grouping, ideally done after applying buffering, we will now proceed to change the pre-selected reinforcement of all those groupings that contain less locations than required by the describing property. We do this by updating their type with the one of a "stronger" adjacent grouping, on this section called "clusters". These clusters are internally represented by the class OrderCluster
.
The strategy here is to detect non-compliant reinforcement-location clusters and replace their selected reinforcement type with the "least strong" of its adjacent clusters. We do this iteratively, so we first target the lowest type of reinforcements (SoilReinforcementProfile
) and we move up until the first to the last (the last one cannot be further strengthened).
Conditions:
+reinforcement_min_length
).Steps breakdown:
+One simplified example, based on the buffering example, and using a minimal distance of "5". This example is also tested in the tests.strategies.order_strategy_clustering.py
test file.
1. List of unmerged clusters:
+[
+ (0, ["Location_000","Location_001",]),
+ (3, ["Location_002","Location_003","Location_004","Location_005",]),
+ (0, ["Location_006",]),
+ (4, ["Location_007","Location_008","Location_009",]),
+]
+
+2. Iterate over each reinforcement type:
+2.1. Target is "SoilReinforcementProfile" (idx=0), non-compliant clusters:
+ [
+ (0, ["Location_006",]),
+ ]
+ 2.1.1. Length = 1.
+ 2.1.2. Get a stronger neighbor,
+ - Left-neighbor reinforcement type = 3,
+ - Right-neighbor reinforcement type = 4,
+ - Left-neighbor is selected.
+ 2.1.3. Move locations to stronger neighbor.
+ [
+ (2, ["Location_002", ... ,"Location_006",]),
+ (0, ["Location_006",]),
+ ]
+ 2.1.4. Remove the current cluster from the available list.
+
+2.2. Target is "PipingWallReinforcementProfile" (idx=3),
+ - All clusters are compliant at this point.
+2.3. Target is "StabilityWallReinforcementProfile" (idx=4),
+ - All clusters are compliant at this point.
+2.4. "CofferDamReinforcementProfile" won't be checked as it's the last
+reinforcement profile type, therefore the strongest.
+
+Resulting cluster:
+ [
+ (0, ["Location_000","Location_001",]),
+ (3, ["Location_002","Location_003","Location_004","Location_005","Location_006",]),
+ (4, ["Location_007","Location_008","Location_009",]),
+ ]
+
In koswat's real domain, a dike is surrounded by all sort of surroundings, these could be nature or human-built structures. During our analyisis we make use of (.shp
) maps where a dike's traject is shown together with all the human-built structures in its proximity.
We categorize these structures in the following two types:
++ |
---|
Image 1. Surroundings representation | +
To define said surroundings we make use of .csv
files, each file for a specific type of surrounding that needs to be "enabled" in the koswat_general.ini
settings file.
In addition, surroundings can be defined for the inside or the outside of a dike. At the current Koswat
version (unreleased v0.15.0
) we only support surroundings in the inside of a dike ( binnendijks
).
.csv
files¶The surroundings files follow all the same format both in naming and content.
+Their file name has the form of T{dike_traject}_{type_of_surrounding}.csv
:
+- The {dike_traject}
is the dike's traject code name, usually something like 10_1
,
+- the {type_of_surrounding}
is the name of surrounding that will be imported (check further in the corresponding subsections of obstacles and infrastructure).
Their headers are divided in the following columns:
+SECTIE
, section of the location in the dike's traject,Xcoord
, x coordinate of the location,Ycoord
, y coordinate of the location, afst_{x}m
, distance from the location, where 'x' are all the values between 5
and 200
with steps of 5, thus 40 columns. The values in these cells are called define whether there are obstacles at this distance or not and in Koswat
are usually built in the SurroundingsPoint.surroundings_matrix
, each type of surrounding interprets the weights in a different manner.An obstacle usually represents a building, because they cannot be removed they become a constraint to the possible reinforcements that can be applied at a given location. For instance, if a dike's reinforcement will become 5 meters wider, but within that distance there are obstacles, said reinforcement will be discarded as a possible option at that location.
+The values in the columns afst_{x}m
are either 1
or 0
and are simply interpreted as having a surrounding or not. Thus ignoring other characteristics of the surrounding and just focusing on its presence.
Currently we identify and support the following surroundings as written in the .csv
file names:
bebouwing_binnendijks
(buildings), spoorwegen_binnendijks
(railways),waters_binnendijks
(waters),As reminder, at the moment we only support 'inside the dike's' surroundings.
+Infrastructures are mostly "roads". Contrary to the obstacles these infrastructures do not become a boundary for a reinforcement and they will simply be either displaced or repaired when applying a reinforcement requires their space. When this occurs, it is reflected as additional costs for the given type of reinforcement at that location. In short, these costs are calculated based on:
+Koswat_general.ini
settings),afst_{x}m
),koswat_general.ini
settings) and its related costs (koswat_costs.ini
).With the above values we know what's the affected area of an infrastructure when a reinforced profile needs to be applied and therefore can estimate their costs.
+Currently we identify and support the following surroundings as written in the .csv
file names:
wegen_binnendijks_klasse2
(roads class 2),wegen_binnendijks_klasse7
(roads class 7),wegen_binnendijks_klasse24
(roads class 24),wegen_binnendijks_klasse47
(roads class 47),wegen_binnendijks_klasseonbekend
(roads of unknown class),As reminder, at the moment we only support 'inside the dike's' surroundings.
+But, how are these surroundings represented in the code? As earlier described, we distinguish surroundings by either obstacles or infrastructures. This is also reflected in the code where we create a general SurroundingsWrapper, which as the name states, wraps the obstacle and infrastructure surroundings in separate properties, each implementing an specialitzation of the BaseSurroundingsWrapper
so that:
ObstacleSurroundingsWrapper
will wrap all the supported obstacle types, in separate properties of type SurroundingsObstacle
.InfrastructureSurroundingsWrapper
will wrap all the supported infrastructure types, in separate properties of type SurroundingsInfrastructure
.A simple diagram illustrating the above can be seen in the image below:
++ |
---|
Image 2. Surroundings code-wise | +
More detailed information can be found in the corresponding surroundings subproject.
+ +' + escapeHtml(summary) +'
' + noResultsText + '
'); + } +} + +function doSearch () { + var query = document.getElementById('mkdocs-search-query').value; + if (query.length > min_search_length) { + if (!window.Worker) { + displayResults(search(query)); + } else { + searchWorker.postMessage({query: query}); + } + } else { + // Clear results for short queries + displayResults([]); + } +} + +function initSearch () { + var search_input = document.getElementById('mkdocs-search-query'); + if (search_input) { + search_input.addEventListener("keyup", doSearch); + } + var term = getSearchTermFromLocation(); + if (term) { + search_input.value = term; + doSearch(); + } +} + +function onWorkerMessage (e) { + if (e.data.allowSearch) { + initSearch(); + } else if (e.data.results) { + var results = e.data.results; + displayResults(results); + } else if (e.data.config) { + min_search_length = e.data.config.min_search_length-1; + } +} + +if (!window.Worker) { + console.log('Web Worker API not supported'); + // load index in main thread + $.getScript(joinUrl(base_url, "search/worker.js")).done(function () { + console.log('Loaded worker'); + init(); + window.postMessage = function (msg) { + onWorkerMessage({data: msg}); + }; + }).fail(function (jqxhr, settings, exception) { + console.error('Could not load worker.js'); + }); +} else { + // Wrap search in a web worker + var searchWorker = new Worker(joinUrl(base_url, "search/worker.js")); + searchWorker.postMessage({init: true}); + searchWorker.onmessage = onWorkerMessage; +} diff --git a/search/search_index.json b/search/search_index.json new file mode 100644 index 00000000..79758561 --- /dev/null +++ b/search/search_index.json @@ -0,0 +1 @@ +{"config":{"indexing":"full","lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"index.html","text":"Koswat \u00b6 Official documentation read the docs for Koswat","title":"Koswat"},{"location":"index.html#koswat","text":"Official documentation read the docs for Koswat","title":"Koswat"},{"location":"changelog.html","text":"Release-2023 (2023-11-07) \u00b6 Feat \u00b6 Added order_strategy submodule for determining reinforcement features across a dike traject based on default order Added new class to better handle / generate the location-reinforcement matrix Fix \u00b6 improve rounding improve rounding improve rounding show cost per km if no locations present add @property to total_cost add @property to total_cost add @property to total_cost test on presence of construction costs correct return type Added logic to plot new layer surfaces when they are either a LineString or a MultiLineString corrected berm width calculations (#114) corrected berm width calculations merge leftovers rename \"raise\" to \"surtax\" throughout KOSWAT rename \"raise\" to \"surtax\" throughout KOSWAT correct symbol name correct symbol name typo comment typo comment Added logic to avoid creating added / removed layers geometries when there were no modifications Added default values as math.nan for koswatscenario We now replace not-provided values from a KoswatScenario when calculating new reinforcements docu corrections docu corrections docu corrections v0.14.1 (2023-11-08) \u00b6 v0.14.0 (2023-11-07) \u00b6 Feat \u00b6 Added order_strategy submodule for determining reinforcement features across a dike traject based on default order Added new class to better handle / generate the location-reinforcement matrix Fix \u00b6 improve rounding improve rounding improve rounding show cost per km if no locations present add @property to total_cost add @property to total_cost add @property to total_cost test on presence of construction costs correct return type Added logic to plot new layer surfaces when they are either a LineString or a MultiLineString corrected berm width calculations (#114) corrected berm width calculations merge leftovers rename \"raise\" to \"surtax\" throughout KOSWAT rename \"raise\" to \"surtax\" throughout KOSWAT correct symbol name correct symbol name typo comment typo comment Added logic to avoid creating added / removed layers geometries when there were no modifications Added default values as math.nan for koswatscenario We now replace not-provided values from a KoswatScenario when calculating new reinforcements docu corrections docu corrections docu corrections v0.13.0 (2023-01-31) \u00b6 Feat \u00b6 volume_cost_parameters_builder.py : We now calculate the costs based on the ini input file v0.12.1 (2023-01-27) \u00b6 Fix \u00b6 calc_library.py : Standrad reinforcement calculation now uses a different method to make sure the added geometry is normalized v0.12.0 (2023-01-26) \u00b6 Feat \u00b6 koswat/cost_report : Koswat Summary now includes all available locations even if they are not suitable for any reinforcement profile. Adapted the rest of the classes to generate a proper matrix also during export v0.11.7 (2023-01-25) \u00b6 Fix \u00b6 calc_library.py : We now check whether the last point intersects with the line drawn between the first two points to avoid precission issues v0.11.6 (2023-01-25) \u00b6 Fix \u00b6 calc_library.py;koswat_coating_layer_builder.py : We now round up the coordinates of the calculated layers to avoid precision issues calc_library.py : Corrected collection of surface points, added extra plot for reinforced profiles v0.11.5 (2023-01-12) \u00b6 Fix \u00b6 calc_library : Small correction to avoid crashing when trying to order multiline strings v0.11.4 (2023-01-12) \u00b6 Fix \u00b6 standard_reinforcement_layers_wrapper_builder : Fixed sand layer added surface not being correct calc_library.py : After doing a geometry union the resulting geometry gets now their points in order v0.11.3 (2023-01-12) \u00b6 Fix \u00b6 koswat/configuration : Fixed creation of scenarios based on selected dike sections v0.11.2 (2022-12-21) \u00b6 v0.11.1 (2022-12-20) \u00b6 Fix \u00b6 koswat/ main .py : Renamed main file to fit to python main expected module v0.11.0 (2022-12-20) \u00b6 Feat \u00b6 koswat/koswat_handler.py : We now accept a log_output argument to specify the directory where to save the koswat run log. v0.10.0 (2022-12-20) \u00b6 Feat \u00b6 koswat/configuration/converters : Created converters fom to dom koswat/configuration/io/converters/ : Added configuration converters for the analysis section. We can now generate input profiles from the ini files koswat/configuration/io/csv : Added import of KoswatInputProfiles KoswatHandler;KoswatLogger : Added handler and logger for koswat runs from CLI Fix \u00b6 koswat/geometries/calc_library.py : We now order the points of the geometries so that calculations can be done correctly koswat/calculations : Corrected profile calculation for all types and their tests. These changes come directly from Peter de Grave koswat/configuration/io/koswat_run_settings_importer.py : corrected filtering of selected input profiles koswat_dike_locations_shp_reader.py : Fixed enumerating a filtered list instead of filtering after enumerating KoswatSurroundingsConverter : Fixed return as it was only giving the latest mapped FOM configuration/io/converters : Fixed return of data and adapted tests koswat_analysis_converter.py : Small fix to converter koswat_General_settings.py : Fix validation for surroundings koswat/calculations : Fixed calculations due to new profile input property KoswatMaterialType : Minor fix regarding usage of new KoswatMaterialType KoswatMaterialType : Adapted code to use the enum instead of strings Refactor \u00b6 koswat/configuration/io : Moved converters into io koswat/dike/surroundings/io/shp : Moved shp reader and fom to surroundings module koswat/configuration : Integrating mapping of files to fom's during settings import koswat/dike/surroundings/io : Moved previous CSV reader into a concrete module within dike/surroundings. Created protocols for csv reading so it can be repurposed KoswatMaterialType : Made koswat material into an enum. Adapted code overall in the source v0.9.0 (2022-12-12) \u00b6 Feat \u00b6 KoswatGeneralSettings : Created DOM for koswat general settings configuration KoswatConfigurationIniImporter : We can now map all different ini fom classes to the config class koswat/configuration : Created koswat configuration module and related class KoswatConfiguration to encapsulate all require information for a koswat analysis KoswatScenarioIniFom : It is now possible to read a KoswatScenarioIniFom from file KoswatDikeSelectionIniFom : It is now possible to read a Dike Selection INI file into its corresponding FOM KoswatCostsIniFom : Added logic to fully implement reading of a KoswatCostsIniFom file KoswatCostsIniFom : Added koswat costs ini file KoswatIniReader : Created koswat ini reader and initial approach to reading the general Koswat INI file Fix \u00b6 KoswatCosts : Added class conversion to dictionary Refactor \u00b6 koswat/configuration/models : Moved configuration data object models into their own module. Fixed / grouped imports KoswatDikeSelection : Koswat dike selection now implements a new type KoswatDikeSelectionTxtFom with related reader koswat_scenario : Moved koswat scenario into koswat/configuration koswat/io : Adapted export / import fom protocol v0.8.2 (2022-12-09) \u00b6 Fix \u00b6 KoswatLayerProtocol : we now have two different geometries for a layer, so that the profile with the layer and the stand alone representation of it are better reached v0.8.1 (2022-11-21) \u00b6 Fix \u00b6 SummaryMatrixCsvExporter : We now provide NANs when volume parameter is not defined summary_matrix_csv_exporter : We now correctly export all required information to the csv for the user v0.8.0 (2022-11-19) \u00b6 Feat \u00b6 KoswatPlotContext : Created plot context handler so it's easier to initialize and close plots v0.7.0 (2022-11-18) \u00b6 Feat \u00b6 koswat/cost_report/io/plots/ : Added module for cost_report export plots logic koswat_profile_plot.py : We can now set a unique color for layers_wrapper and profile plots koswat/plots/dike/ : Extracted dike plotting logic into separate classes koswat/plots/geometries : Created module with plotting for regular geometries from shapely Fix \u00b6 koswat/plots/utils.py : Replaced wrapper as it is not a good approach characteristic_points_builder.py : Resolved a circular dependency Refactor \u00b6 koswat/calculations/io/ : Extracted plot exporters from calculations into their corresponding directory koswat/plots : Create concrete module for plotting koswat/io : Moved io files into their corresponding modules v0.6.0 (2022-11-11) \u00b6 Feat \u00b6 VolumeCalculationParameters : Included all operations required to for volume calculation ReinforcementProfileProtocol : Added new property to retrieve the new ground level surface OutsideSlopeReinforcementLayersWrapperBuilder : Added builder for for the outside slope reinforcement layers wrapper StandardReinforcemetnLayersWrapperBuilder : Added logic to generate the geometries of a standard reinforcement dike ReinforcementLayersWrapper : We now have dedicated builders for the LayersWrapper associated with a Reinforcement ReinforcementProfileBuilderProtocol : Created protocol for better hierarchy CoatingLayerCostReport : Extended usage of previous StandardLayerCostReport so that other reinforcements can also use it Added logic to extract the surface of a layer LayerCostReportProtocol;StandardLayerCostReportBuilder : Extracted standard layer cost report builder logic into separate class. Added protocol to represent the layer cost reports koswat/geometries; standard_layer_cost_report : Implemented logic for StandardLayer cost calculation OutsideSlopeReinforcementProfileProtocol;StandardReinforcementProfileProtocol : Added protocols to represent the different types of reinforcement - per volume; Added tests for factory LayerCostReportbuilderFactory : Added logic to retrieve the corresponding LayerCostReportBuilderProtocol; Adapted tests and related imports LayerCostReportBuilderFactory : Introduced layer cost report builder factory for the different types of volume calculators available Fix \u00b6 PipingWallReinforcementProfileCalculation : Solved wrong calculation of the Length Piping Wall StabilityWallReinforcementProfileCalculation : Corrected calculation of the length stability wall property StabilityWall calculation was not properly mapped OutsideSlopeProfileCostReportBuilder : Now we properly calculate the added core layer OutsideSlopeProfileCostReportBuilder : Calculation of the 'kistdam' layers is now done properly Refactor \u00b6 koswat/calculations : Moved calculations into their respecitve reinforcement types Starting to move logic of added / removed layers to the calculation module cost_report : Moved layer factory to profile factory as the logic should be in a higher level v0.5.1 (2022-10-11) \u00b6 Fix \u00b6 SummaryMatrixCsvExporter : We now export the locations in order of import v0.5.0 (2022-10-11) \u00b6 Feat \u00b6 SummaryMatrixCsvExporter : We now also export the CsvFom into a file SummaryMatrixCsvFom;SummaryMatrixCsvExporter : Added Summary Matrix Csv Fom and Exporter initial logic CofferDamInputProfile : Added concrete input profile for CofferDamReinforcementProfile calculations/cofferdam;CofferdamReinforcementProfileCalculation;CofferdamReinforcementProfile : Added Cofferdam Reinforcement Profile and Calculation to the calculations module. Added information to the summary to also build their report. StabilityWallInputProfile;StabilityWallReinforcementProfileCalculation : Created both concrete input profile and profile calculation for StabilityWallReinforcementProfile StabilityWallReinforcemetnProfile : Added StabilityWallReinforcementProfile type PipingWallInputProfile : Created dedicated input profile for PipingWall KoswatInputProfileProtocol : Made a Koswat Input Profile protocol to manage better concrete input profiles. Adapted existing code and tests PipingWallReinforcementProfileCalculation : Added calculation for PipingWall Reinforcement Profile PipingWall : Added PipingWallReinforcementProfile class ReinforcementProfileProtocol : Introduced ReinforcementProfileProtocol as a sub protocol of KoswatProfileProtocol. Adapted existent classes and tests. Moved existing calculations into calculations\\soil Fix \u00b6 CofferdamReinforcementProfileCalculation : P4 x coordinate set to 0 for all builds from this calculation KoswatProfileBuilder : Removed paramater from build method to make it complier to the BuilderProtocol v0.4.0 (2022-10-07) \u00b6 Feat \u00b6 MultiLocationMultiProfileCostBuilder : Added new report to summarize reports of profile per location. ListMultiLocationProfileCostBuilder : It is now possible to make a report for multiple locations and multiple possible profiles KoswatBuildingsPolderside.get_classify_surroundings : We can now retrieve all points classified by their distance to the closest building KoswatSurroundings : Added wrapper class for surroundings and a builder for it. Extended other koswat/surrounding builder classes to be initialized from files. KoswatCsvFomBuilder;Koswat\\surroundings : We can now map the csv data to surrounding points and their distances to buildings. Adapted related code KoswatCsvReader : It is possible to read a CSV file into a FileObjectModelProtocol instance of KoswatCsvFom . Added new methods to fom and reader protocols, adapted related classes KoswatShpReader : Added KoswatShpReader to read from a shapefile. Added reader protocol and io module Refactor \u00b6 koswat/surroundings : Moved files into separate module dike : Renamed profiles module to dike for a more coherent approach cost_report : Moved directories into a better tree structure koswat/cost_report : Seggregated module into builders and reports. koswat/cost_report : Extracted reports into their own modules ProfileCostBuilder : Profile cost builder is independent of the profile type. All types of new profiles are calculated and then a report is done for each of them\" v0.3.0 (2022-10-03) \u00b6 Feat \u00b6 CharacteristicPoints : Created characteristic points to replace the previous 'ProtocolSide' related classes. Introduced builder to allow initial or reinforced profile creation KoswatLayersBuilder : We now can create layers based on the provided depth ProfileReinforcementCostBuilder : Generates a cost report for the new profile based on the extra required volume KoswatReport : Added KoswatReport to generate costs overviews It is now possible to create layers from a dictionary koswat_layers;koswat_profile_builder : Added new class to represent the layers of a profile, their material and so on. koswat/calculations : Added profile reinforcement calculation koswat/profiles : Added koswat profiles and related properties. They can now be built from an input profile v0.2.0 (2022-09-27) \u00b6 Feat \u00b6 koswat : Initial commit. Created Initial architecture and basic tests for the structure given. Added version control through commitizen","title":"Changelog"},{"location":"changelog.html#release-2023-2023-11-07","text":"","title":"Release-2023 (2023-11-07)"},{"location":"changelog.html#feat","text":"Added order_strategy submodule for determining reinforcement features across a dike traject based on default order Added new class to better handle / generate the location-reinforcement matrix","title":"Feat"},{"location":"changelog.html#fix","text":"improve rounding improve rounding improve rounding show cost per km if no locations present add @property to total_cost add @property to total_cost add @property to total_cost test on presence of construction costs correct return type Added logic to plot new layer surfaces when they are either a LineString or a MultiLineString corrected berm width calculations (#114) corrected berm width calculations merge leftovers rename \"raise\" to \"surtax\" throughout KOSWAT rename \"raise\" to \"surtax\" throughout KOSWAT correct symbol name correct symbol name typo comment typo comment Added logic to avoid creating added / removed layers geometries when there were no modifications Added default values as math.nan for koswatscenario We now replace not-provided values from a KoswatScenario when calculating new reinforcements docu corrections docu corrections docu corrections","title":"Fix"},{"location":"changelog.html#v0141-2023-11-08","text":"","title":"v0.14.1 (2023-11-08)"},{"location":"changelog.html#v0140-2023-11-07","text":"","title":"v0.14.0 (2023-11-07)"},{"location":"changelog.html#feat_1","text":"Added order_strategy submodule for determining reinforcement features across a dike traject based on default order Added new class to better handle / generate the location-reinforcement matrix","title":"Feat"},{"location":"changelog.html#fix_1","text":"improve rounding improve rounding improve rounding show cost per km if no locations present add @property to total_cost add @property to total_cost add @property to total_cost test on presence of construction costs correct return type Added logic to plot new layer surfaces when they are either a LineString or a MultiLineString corrected berm width calculations (#114) corrected berm width calculations merge leftovers rename \"raise\" to \"surtax\" throughout KOSWAT rename \"raise\" to \"surtax\" throughout KOSWAT correct symbol name correct symbol name typo comment typo comment Added logic to avoid creating added / removed layers geometries when there were no modifications Added default values as math.nan for koswatscenario We now replace not-provided values from a KoswatScenario when calculating new reinforcements docu corrections docu corrections docu corrections","title":"Fix"},{"location":"changelog.html#v0130-2023-01-31","text":"","title":"v0.13.0 (2023-01-31)"},{"location":"changelog.html#feat_2","text":"volume_cost_parameters_builder.py : We now calculate the costs based on the ini input file","title":"Feat"},{"location":"changelog.html#v0121-2023-01-27","text":"","title":"v0.12.1 (2023-01-27)"},{"location":"changelog.html#fix_2","text":"calc_library.py : Standrad reinforcement calculation now uses a different method to make sure the added geometry is normalized","title":"Fix"},{"location":"changelog.html#v0120-2023-01-26","text":"","title":"v0.12.0 (2023-01-26)"},{"location":"changelog.html#feat_3","text":"koswat/cost_report : Koswat Summary now includes all available locations even if they are not suitable for any reinforcement profile. Adapted the rest of the classes to generate a proper matrix also during export","title":"Feat"},{"location":"changelog.html#v0117-2023-01-25","text":"","title":"v0.11.7 (2023-01-25)"},{"location":"changelog.html#fix_3","text":"calc_library.py : We now check whether the last point intersects with the line drawn between the first two points to avoid precission issues","title":"Fix"},{"location":"changelog.html#v0116-2023-01-25","text":"","title":"v0.11.6 (2023-01-25)"},{"location":"changelog.html#fix_4","text":"calc_library.py;koswat_coating_layer_builder.py : We now round up the coordinates of the calculated layers to avoid precision issues calc_library.py : Corrected collection of surface points, added extra plot for reinforced profiles","title":"Fix"},{"location":"changelog.html#v0115-2023-01-12","text":"","title":"v0.11.5 (2023-01-12)"},{"location":"changelog.html#fix_5","text":"calc_library : Small correction to avoid crashing when trying to order multiline strings","title":"Fix"},{"location":"changelog.html#v0114-2023-01-12","text":"","title":"v0.11.4 (2023-01-12)"},{"location":"changelog.html#fix_6","text":"standard_reinforcement_layers_wrapper_builder : Fixed sand layer added surface not being correct calc_library.py : After doing a geometry union the resulting geometry gets now their points in order","title":"Fix"},{"location":"changelog.html#v0113-2023-01-12","text":"","title":"v0.11.3 (2023-01-12)"},{"location":"changelog.html#fix_7","text":"koswat/configuration : Fixed creation of scenarios based on selected dike sections","title":"Fix"},{"location":"changelog.html#v0112-2022-12-21","text":"","title":"v0.11.2 (2022-12-21)"},{"location":"changelog.html#v0111-2022-12-20","text":"","title":"v0.11.1 (2022-12-20)"},{"location":"changelog.html#fix_8","text":"koswat/ main .py : Renamed main file to fit to python main expected module","title":"Fix"},{"location":"changelog.html#v0110-2022-12-20","text":"","title":"v0.11.0 (2022-12-20)"},{"location":"changelog.html#feat_4","text":"koswat/koswat_handler.py : We now accept a log_output argument to specify the directory where to save the koswat run log.","title":"Feat"},{"location":"changelog.html#v0100-2022-12-20","text":"","title":"v0.10.0 (2022-12-20)"},{"location":"changelog.html#feat_5","text":"koswat/configuration/converters : Created converters fom to dom koswat/configuration/io/converters/ : Added configuration converters for the analysis section. We can now generate input profiles from the ini files koswat/configuration/io/csv : Added import of KoswatInputProfiles KoswatHandler;KoswatLogger : Added handler and logger for koswat runs from CLI","title":"Feat"},{"location":"changelog.html#fix_9","text":"koswat/geometries/calc_library.py : We now order the points of the geometries so that calculations can be done correctly koswat/calculations : Corrected profile calculation for all types and their tests. These changes come directly from Peter de Grave koswat/configuration/io/koswat_run_settings_importer.py : corrected filtering of selected input profiles koswat_dike_locations_shp_reader.py : Fixed enumerating a filtered list instead of filtering after enumerating KoswatSurroundingsConverter : Fixed return as it was only giving the latest mapped FOM configuration/io/converters : Fixed return of data and adapted tests koswat_analysis_converter.py : Small fix to converter koswat_General_settings.py : Fix validation for surroundings koswat/calculations : Fixed calculations due to new profile input property KoswatMaterialType : Minor fix regarding usage of new KoswatMaterialType KoswatMaterialType : Adapted code to use the enum instead of strings","title":"Fix"},{"location":"changelog.html#refactor","text":"koswat/configuration/io : Moved converters into io koswat/dike/surroundings/io/shp : Moved shp reader and fom to surroundings module koswat/configuration : Integrating mapping of files to fom's during settings import koswat/dike/surroundings/io : Moved previous CSV reader into a concrete module within dike/surroundings. Created protocols for csv reading so it can be repurposed KoswatMaterialType : Made koswat material into an enum. Adapted code overall in the source","title":"Refactor"},{"location":"changelog.html#v090-2022-12-12","text":"","title":"v0.9.0 (2022-12-12)"},{"location":"changelog.html#feat_6","text":"KoswatGeneralSettings : Created DOM for koswat general settings configuration KoswatConfigurationIniImporter : We can now map all different ini fom classes to the config class koswat/configuration : Created koswat configuration module and related class KoswatConfiguration to encapsulate all require information for a koswat analysis KoswatScenarioIniFom : It is now possible to read a KoswatScenarioIniFom from file KoswatDikeSelectionIniFom : It is now possible to read a Dike Selection INI file into its corresponding FOM KoswatCostsIniFom : Added logic to fully implement reading of a KoswatCostsIniFom file KoswatCostsIniFom : Added koswat costs ini file KoswatIniReader : Created koswat ini reader and initial approach to reading the general Koswat INI file","title":"Feat"},{"location":"changelog.html#fix_10","text":"KoswatCosts : Added class conversion to dictionary","title":"Fix"},{"location":"changelog.html#refactor_1","text":"koswat/configuration/models : Moved configuration data object models into their own module. Fixed / grouped imports KoswatDikeSelection : Koswat dike selection now implements a new type KoswatDikeSelectionTxtFom with related reader koswat_scenario : Moved koswat scenario into koswat/configuration koswat/io : Adapted export / import fom protocol","title":"Refactor"},{"location":"changelog.html#v082-2022-12-09","text":"","title":"v0.8.2 (2022-12-09)"},{"location":"changelog.html#fix_11","text":"KoswatLayerProtocol : we now have two different geometries for a layer, so that the profile with the layer and the stand alone representation of it are better reached","title":"Fix"},{"location":"changelog.html#v081-2022-11-21","text":"","title":"v0.8.1 (2022-11-21)"},{"location":"changelog.html#fix_12","text":"SummaryMatrixCsvExporter : We now provide NANs when volume parameter is not defined summary_matrix_csv_exporter : We now correctly export all required information to the csv for the user","title":"Fix"},{"location":"changelog.html#v080-2022-11-19","text":"","title":"v0.8.0 (2022-11-19)"},{"location":"changelog.html#feat_7","text":"KoswatPlotContext : Created plot context handler so it's easier to initialize and close plots","title":"Feat"},{"location":"changelog.html#v070-2022-11-18","text":"","title":"v0.7.0 (2022-11-18)"},{"location":"changelog.html#feat_8","text":"koswat/cost_report/io/plots/ : Added module for cost_report export plots logic koswat_profile_plot.py : We can now set a unique color for layers_wrapper and profile plots koswat/plots/dike/ : Extracted dike plotting logic into separate classes koswat/plots/geometries : Created module with plotting for regular geometries from shapely","title":"Feat"},{"location":"changelog.html#fix_13","text":"koswat/plots/utils.py : Replaced wrapper as it is not a good approach characteristic_points_builder.py : Resolved a circular dependency","title":"Fix"},{"location":"changelog.html#refactor_2","text":"koswat/calculations/io/ : Extracted plot exporters from calculations into their corresponding directory koswat/plots : Create concrete module for plotting koswat/io : Moved io files into their corresponding modules","title":"Refactor"},{"location":"changelog.html#v060-2022-11-11","text":"","title":"v0.6.0 (2022-11-11)"},{"location":"changelog.html#feat_9","text":"VolumeCalculationParameters : Included all operations required to for volume calculation ReinforcementProfileProtocol : Added new property to retrieve the new ground level surface OutsideSlopeReinforcementLayersWrapperBuilder : Added builder for for the outside slope reinforcement layers wrapper StandardReinforcemetnLayersWrapperBuilder : Added logic to generate the geometries of a standard reinforcement dike ReinforcementLayersWrapper : We now have dedicated builders for the LayersWrapper associated with a Reinforcement ReinforcementProfileBuilderProtocol : Created protocol for better hierarchy CoatingLayerCostReport : Extended usage of previous StandardLayerCostReport so that other reinforcements can also use it Added logic to extract the surface of a layer LayerCostReportProtocol;StandardLayerCostReportBuilder : Extracted standard layer cost report builder logic into separate class. Added protocol to represent the layer cost reports koswat/geometries; standard_layer_cost_report : Implemented logic for StandardLayer cost calculation OutsideSlopeReinforcementProfileProtocol;StandardReinforcementProfileProtocol : Added protocols to represent the different types of reinforcement - per volume; Added tests for factory LayerCostReportbuilderFactory : Added logic to retrieve the corresponding LayerCostReportBuilderProtocol; Adapted tests and related imports LayerCostReportBuilderFactory : Introduced layer cost report builder factory for the different types of volume calculators available","title":"Feat"},{"location":"changelog.html#fix_14","text":"PipingWallReinforcementProfileCalculation : Solved wrong calculation of the Length Piping Wall StabilityWallReinforcementProfileCalculation : Corrected calculation of the length stability wall property StabilityWall calculation was not properly mapped OutsideSlopeProfileCostReportBuilder : Now we properly calculate the added core layer OutsideSlopeProfileCostReportBuilder : Calculation of the 'kistdam' layers is now done properly","title":"Fix"},{"location":"changelog.html#refactor_3","text":"koswat/calculations : Moved calculations into their respecitve reinforcement types Starting to move logic of added / removed layers to the calculation module cost_report : Moved layer factory to profile factory as the logic should be in a higher level","title":"Refactor"},{"location":"changelog.html#v051-2022-10-11","text":"","title":"v0.5.1 (2022-10-11)"},{"location":"changelog.html#fix_15","text":"SummaryMatrixCsvExporter : We now export the locations in order of import","title":"Fix"},{"location":"changelog.html#v050-2022-10-11","text":"","title":"v0.5.0 (2022-10-11)"},{"location":"changelog.html#feat_10","text":"SummaryMatrixCsvExporter : We now also export the CsvFom into a file SummaryMatrixCsvFom;SummaryMatrixCsvExporter : Added Summary Matrix Csv Fom and Exporter initial logic CofferDamInputProfile : Added concrete input profile for CofferDamReinforcementProfile calculations/cofferdam;CofferdamReinforcementProfileCalculation;CofferdamReinforcementProfile : Added Cofferdam Reinforcement Profile and Calculation to the calculations module. Added information to the summary to also build their report. StabilityWallInputProfile;StabilityWallReinforcementProfileCalculation : Created both concrete input profile and profile calculation for StabilityWallReinforcementProfile StabilityWallReinforcemetnProfile : Added StabilityWallReinforcementProfile type PipingWallInputProfile : Created dedicated input profile for PipingWall KoswatInputProfileProtocol : Made a Koswat Input Profile protocol to manage better concrete input profiles. Adapted existing code and tests PipingWallReinforcementProfileCalculation : Added calculation for PipingWall Reinforcement Profile PipingWall : Added PipingWallReinforcementProfile class ReinforcementProfileProtocol : Introduced ReinforcementProfileProtocol as a sub protocol of KoswatProfileProtocol. Adapted existent classes and tests. Moved existing calculations into calculations\\soil","title":"Feat"},{"location":"changelog.html#fix_16","text":"CofferdamReinforcementProfileCalculation : P4 x coordinate set to 0 for all builds from this calculation KoswatProfileBuilder : Removed paramater from build method to make it complier to the BuilderProtocol","title":"Fix"},{"location":"changelog.html#v040-2022-10-07","text":"","title":"v0.4.0 (2022-10-07)"},{"location":"changelog.html#feat_11","text":"MultiLocationMultiProfileCostBuilder : Added new report to summarize reports of profile per location. ListMultiLocationProfileCostBuilder : It is now possible to make a report for multiple locations and multiple possible profiles KoswatBuildingsPolderside.get_classify_surroundings : We can now retrieve all points classified by their distance to the closest building KoswatSurroundings : Added wrapper class for surroundings and a builder for it. Extended other koswat/surrounding builder classes to be initialized from files. KoswatCsvFomBuilder;Koswat\\surroundings : We can now map the csv data to surrounding points and their distances to buildings. Adapted related code KoswatCsvReader : It is possible to read a CSV file into a FileObjectModelProtocol instance of KoswatCsvFom . Added new methods to fom and reader protocols, adapted related classes KoswatShpReader : Added KoswatShpReader to read from a shapefile. Added reader protocol and io module","title":"Feat"},{"location":"changelog.html#refactor_4","text":"koswat/surroundings : Moved files into separate module dike : Renamed profiles module to dike for a more coherent approach cost_report : Moved directories into a better tree structure koswat/cost_report : Seggregated module into builders and reports. koswat/cost_report : Extracted reports into their own modules ProfileCostBuilder : Profile cost builder is independent of the profile type. All types of new profiles are calculated and then a report is done for each of them\"","title":"Refactor"},{"location":"changelog.html#v030-2022-10-03","text":"","title":"v0.3.0 (2022-10-03)"},{"location":"changelog.html#feat_12","text":"CharacteristicPoints : Created characteristic points to replace the previous 'ProtocolSide' related classes. Introduced builder to allow initial or reinforced profile creation KoswatLayersBuilder : We now can create layers based on the provided depth ProfileReinforcementCostBuilder : Generates a cost report for the new profile based on the extra required volume KoswatReport : Added KoswatReport to generate costs overviews It is now possible to create layers from a dictionary koswat_layers;koswat_profile_builder : Added new class to represent the layers of a profile, their material and so on. koswat/calculations : Added profile reinforcement calculation koswat/profiles : Added koswat profiles and related properties. They can now be built from an input profile","title":"Feat"},{"location":"changelog.html#v020-2022-09-27","text":"","title":"v0.2.0 (2022-09-27)"},{"location":"changelog.html#feat_13","text":"koswat : Initial commit. Created Initial architecture and basic tests for the structure given. Added version control through commitizen","title":"Feat"},{"location":"installation.html","text":"Installation \u00b6 Important! : The following installation steps are written based on a Windows environment. When using other systems (which should be possible) it might be required to use different commands. However, the fundamental of the installation steps should remain the same. This meaning, no additional packages or libraries should be required. If problems would arose during your installation, please contact the maintainers of the tool. For users \u00b6 When you only require the koswat package to be used as a whole, and not for developments, we advise to directly use the latest greatest release, or directly the latest available version from Master as follows: Latest available Master : pip install git+https://github.com/Deltares/Koswat.git Specific Koswat version, add @version-tag to the previous command, for instance install tag v0.11.0 ( MVP pre-release): pip install git+https://github.com/Deltares/Koswat.git@v0.11.0 | You can also do the above with a commit-hash for development branches (e.g.: @0504c06 ) Using docker (requires checking the repository in a directory): cdWhen using Koswat
as a package you can run it directly from the command line as follows:
python -m koswat --input_file path\\to\\your\\koswat.ini --log_output path\\to\\your\\output\\dir
+
--input_file
(required): Absolute path to the location of your general koswat.ini
file.--log_output
(optional): Absolute path to the location of where the koswat.log
will be written. If not specified it will be written at the root of the execution directory.It is also possible to check all the above possibilities via the --help
argument in the command line:
+
python -m koswat --help
+
It is entirely possible to make a custom Koswat analysis using the tool as a sandbox. This means, through a script calling the different classes to generate an analysis.
+As a simple example, we can rewrite the acceptance test test_given_surrounding_files_run_calculations_for_all_included_profiles
:
from koswat.dike.profile.koswat_input_profile_base import KoswatInputProfileBase
+from koswat.dike.material.koswat_material_type import KoswatMaterialType
+from koswat.configuration.settings.koswat_scenario import KoswatScenario
+from koswat.dike.profile import KoswatProfileBase, KoswatProfileBuilder
+from koswat.cost_report.profile.profile_cost_report import ProfileCostReport
+from koswat.cost_report.summary import KoswatSummary, KoswatSummaryBuilder
+from koswat.configuration.settings.koswat_run_scenario_settings import (
+ KoswatRunScenarioSettings,
+)
+from koswat.cost_report.io.summary.koswat_summary_exporter import KoswatSummaryExporter
+from koswat.cost_report.io.plots.multi_location_profile_comparison_plot_exporter import (
+ MultiLocationProfileComparisonPlotExporter,
+)
+from koswat.dike_reinforcements import ReinforcementProfileBuilderFactory
+
+# 1. Define input data.
+_input_dir = Path("C:\\my_koswat_input_dir")
+_output_dir = Path("C:\\my_koswat_results")
+_shp_trajects_file = (
+ _input_dir
+ / "Dijkvak"
+ / "Dijkringlijnen_KOSWAT_Totaal_2017_10_3_Dijkvak.shp"
+)
+assert _shp_trajects_file.is_file()
+
+## Define input profile case
+input_profile_case = KoswatInputProfileBase()
+input_profile_case.dike_section = "test_data"
+input_profile_case.buiten_maaiveld = 0
+input_profile_case.buiten_talud = 3
+input_profile_case.buiten_berm_hoogte = 0
+input_profile_case.buiten_berm_breedte = 0
+input_profile_case.kruin_hoogte = 6
+input_profile_case.kruin_breedte = 5
+input_profile_case.binnen_talud = 3
+input_profile_case.binnen_berm_hoogte = 0
+input_profile_case.binnen_berm_breedte = 0
+input_profile_case.binnen_maaiveld = 0
+input_profile_case.pleistoceen = -5
+input_profile_case.aquifer = -2
+
+## Define the scenario case
+scenario_case = KoswatScenario()
+scenario_case.scenario_name = ""
+scenario_case.scenario_section = ""
+scenario_case.d_h = 1
+scenario_case.d_s = 10
+scenario_case.d_p = 30
+scenario_case.kruin_breedte = 5
+scenario_case.buiten_talud = 3
+
+## Define the layers case
+layers_case = dict(
+ base_layer=dict(material=KoswatMaterialType.SAND),
+ coating_layers=[
+ dict(material=KoswatMaterialType.GRASS, depth=0.3),
+ dict(material=KoswatMaterialType.CLAY, depth=0.5),
+ ],
+ )
+
+## Import surroundings
+_surroundings_importer = KoswatSurroundingsImporter()
+_surroundings_importer.traject_loc_shp_file = _shp_trajects_file
+_surroundings = _surroundings_importer.import_from(_test_dir)[0]
+
+assert isinstance(scenario_case, KoswatScenario)
+_base_koswat_profile = KoswatProfileBuilder.with_data(
+ dict(
+ input_profile_data=input_profile_case,
+ layers_data=layers_case,
+ profile_type=KoswatProfileBase,
+ )
+).build()
+
+## Define the run settings based on the previous calculated parameters.
+_run_settings = KoswatRunScenarioSettings()
+_run_settings.scenario = scenario_case
+_run_settings.surroundings = _surroundings
+_run_settings.input_profile_case = _base_koswat_profile
+
+# 2. Run summary
+_multi_loc_multi_prof_cost_builder = KoswatSummaryBuilder()
+_multi_loc_multi_prof_cost_builder.run_scenario_settings = _run_settings
+_summary = _multi_loc_multi_prof_cost_builder.build()
+
+KoswatSummaryExporter().export(_summary, _output_dir)
+
+# 3. Generate plots
+assert isinstance(_summary, KoswatSummary)
+assert any(_summary.locations_profile_report_list)
+for (
+ _reinforcement_profile
+) in ReinforcementProfileBuilderFactory.get_available_reinforcements():
+ assert any(
+ isinstance(
+ _rep_profile.profile_cost_report.reinforced_profile,
+ _reinforcement_profile,
+ )
+ for _rep_profile in _summary.locations_profile_report_list
+ ), f"Profile type {_reinforcement_profile.__name__} not found."
+for _multi_report in _summary.locations_profile_report_list:
+ _mlp_plot = MultiLocationProfileComparisonPlotExporter()
+ _mlp_plot.cost_report = _multi_report
+ _mlp_plot.export_dir = _output_dir
+ _mlp_plot.export()
+