Cost report module

CostReportProtocol

Bases: Protocol

A Protocol defining the properties of a report in Koswat.

Infrastructure cost calculator

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:
  • tuple[float, float]

    tuple[float, float]: Calculated zone A and B respectively.

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 it is present.

Parameters:
  • zone_a_width (float) –

    Width of zone type A.

  • zone_b_width (float) –

    Width of zone type `B .

Returns:
  • 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 infrastructure is present. It first determines zone A and B and then provides their widths to the inner infrastructure calculators (InfrastructureProfileCostsCalculator).

Parameters:
Returns:
  • list[InfrastructureLocationProfileCostReport]

    list[InfrastructureLocationProfileCostReport]: Collection of reports summarizing the cost-impact of a reinforced_profile.

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.

Quantity cost parameters calculator

CostParameterProtocol

Bases: Protocol

total_cost: float property

The total cost (quantity * unit cost)

total_cost_with_surtax: float property

The total cost including surtaxes

IO

Summary

Summary costs

Summary infrastructure costs

SummaryInfrastructureCostsCsvFomBuilder dataclass

Summary locations

ClusterShpFom dataclass

base_geometry: LineString property

The resulting geometry of all locations excluding the profile's width.

Returns:
  • LineString( LineString ) –

    Geometry representing the cluster coordinates.

get_buffered_geometry(width: float) -> LineString

The base_geometry with an applied buffer (width) that represents the polderside's width.

Parameters:
  • width (float) –

    Profile's polderside width.

Returns:
  • LineString( LineString ) –

    Resulting base_geometry with a buffer.

new_profile_width: float property

The new polderside width.

old_profile_width: float property

The original polderside width.

ClusterCollectionShpFom dataclass

from_summary(koswat_summary: KoswatSummary, cluster_criteria: Callable[[StrategyLocationReinforcement], type[ReinforcementProfileProtocol]] = lambda x: x.current_selected_measure) -> ClusterCollectionShpFom classmethod

Maps the KoswatSummary into a file object model that can be exported into *.shp files.

Parameters:
  • koswat_summary (KoswatSummary) –

    The summary containing the information to export.

  • ])

    (Lambda) Function criteria to group the locations by reinforcement type.

Returns:
  • ClusterCollectionShpFom( ClusterCollectionShpFom ) –

    Dataclass instance that can be directly exported into .shp.

generate_geodataframes() -> ClusterGeoDataFrameOutputFom

Generates all geodataframes of the given clusters. The generated geodataframes correspond to the, base geometry (without buffering), the old and new geometries with their profile's width being buffered to the base geometry.

Returns:

ClusterGeoDataFrameOutputFom

Bases: FileObjectModelProtocol

Data structure to wrap the output generated by ClusterCollectionShpFom.generate_geodataframes.

is_valid() -> bool

Checks that all GeoDataFrame properties are set.

Returns:
  • bool( bool ) –

    Validation result.