-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: generate strategies intermediate results (#208)
* chore: Modified definition of `StrategyLocationReinforcement` so it contains the different assigned reinforcements * chore: Small correction to directly display the previous selection if suitable * chore: Corrected summary builder so the strategy to run can be modified dinamically * chore: Small correction to output history of selection measure during strategies * test: Fixed failing tests after merge from `master` * chore: Small rework to track only three items in the selection history * chore: Renaming of outdated references * chore: Corrected code `get_strategy_reinforcemetns` so that the available measures are already ordered based on the current strategy * chore: Added some missing docstrings * chore: Corrections in the selection and output of history selected measures * chore: Correction to output selected measures * chore: Fixed output of steps * test: fixed failing tests * chore: Cleaning selected measures to avoid in-between steps * chore: Added to-do * test: Sync test data * feat: Added new dataclass and modified `StrategyLocationReinforcement` so we can better keep track -per-step- of the history and output it appropriately * chore: Added missing subproject * docs: Extended docstrings * test: added missing tests * test: Updated failing tests * chore: Extended shp export logic to include a new layer to represent the `step` from initial to new * test: fixed failing tests * chore: Small corrections to validate generated geodataframes * test: Updated reference data * chore: fixed failing test * chore: Extracted class for better maintainability * test: Added missing coverage test * docs: Documentation cleanup * chore: Removed todo notes * chore: Created new property to represent both available and filtered measures' * chore: Processed review remarks; Moved dataclass into typedict for performance reasons * test: Fixed failing test
- Loading branch information
Showing
79 changed files
with
724 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
koswat/cost_report/io/summary/summary_locations/cluster_geodataframe_output_fom.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from geopandas import GeoDataFrame | ||
|
||
from koswat.core.io.file_object_model_protocol import FileObjectModelProtocol | ||
|
||
|
||
class ClusterGeoDataFrameOutputFom(FileObjectModelProtocol): | ||
""" | ||
Data structure to wrap the output generated by `ClusterCollectionShpFom.generate_geodataframes`. | ||
""" | ||
|
||
base_layer: GeoDataFrame | None | ||
initial_state: GeoDataFrame | None | ||
new_state: GeoDataFrame | None | ||
|
||
def __init__(self, gdf_tuples: tuple[GeoDataFrame]): | ||
self.base_layer = None | ||
self.initial_state = None | ||
self.new_state = None | ||
|
||
if not gdf_tuples: | ||
return | ||
self.base_layer = gdf_tuples[0] | ||
self.initial_state = gdf_tuples[1] | ||
self.new_state = gdf_tuples[2] | ||
|
||
def is_valid(self) -> bool: | ||
""" | ||
Checks that all `GeoDataFrame` properties are set. | ||
Returns: | ||
bool: Validation result. | ||
""" | ||
|
||
def validate_gdf(gdf: GeoDataFrame | None) -> bool: | ||
return gdf is not None | ||
|
||
return all( | ||
map(validate_gdf, [self.base_layer, self.initial_state, self.new_state]) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.