Skip to content

Commit

Permalink
repaired version test
Browse files Browse the repository at this point in the history
  • Loading branch information
dieuska committed Sep 2, 2024
1 parent f21c930 commit 4684146
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
2 changes: 1 addition & 1 deletion brdr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
datefmt="%d-%b-%y %H:%M:%S",
)

__version__ = "0.1.1"
__version__ = "0.2.0"
31 changes: 18 additions & 13 deletions brdr/aligner.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@
from brdr.loader import Loader
from brdr.logger import Logger
from brdr.typings import ProcessResult
from brdr.utils import diffs_from_dict_series, merge_dict_series, merge_dict, multipolygons_to_singles
from brdr.utils import (
diffs_from_dict_series,
merge_dict_series,
merge_dict,
multipolygons_to_singles,
)
from brdr.utils import geojson_from_dict
from brdr.utils import get_breakpoints_zerostreak
from brdr.utils import get_series_geojson_dict
Expand Down Expand Up @@ -145,7 +150,7 @@ def __init__(
# Default EPSG:31370 (Lambert72), alternative: EPSG:3812 (Lambert2008)
self.CRS = crs
# this parameter is used to treat multipolygon as single polygons. So polygons with ID spliiter are seperately evaluated and merged on result.
self.MULTI_AS_SINGLE_MODUS = True
self.multi_as_single_modus = True
self.logger.feedback_info("Aligner initialized")

def buffer_distance(self):
Expand Down Expand Up @@ -300,7 +305,7 @@ def predictor(
self,
relevant_distances=np.arange(0, 300, 10, dtype=int) / 100,
od_strategy=OpenbaarDomeinStrategy.SNAP_SINGLE_SIDE,
threshold_overlap_percentage=50
threshold_overlap_percentage=50,
):
"""
Predicts the 'most interesting' relevant distances for changes in thematic elements based on a distance series.
Expand Down Expand Up @@ -350,7 +355,7 @@ def predictor(
threshold_overlap_percentage=threshold_overlap_percentage,
)
dict_thematic = self.dict_thematic
if self.MULTI_AS_SINGLE_MODUS:
if self.multi_as_single_modus:
dict_series = merge_dict_series(dict_series)
dict_thematic = merge_dict(self.dict_thematic)

Expand Down Expand Up @@ -532,7 +537,7 @@ def get_results_as_dict(self):
Args:
merged (bool, optional): Whether to merge the results for each thematic element. Defaults to True.
"""
if self.MULTI_AS_SINGLE_MODUS:
if self.multi_as_single_modus:
return merge_process_results(self.dict_result)
return self.dict_result

Expand All @@ -545,7 +550,7 @@ def get_results_as_geojson(self, formula=False):
merged (bool, optional): Whether to merge the results for each thematic element. Defaults to True.
"""
results_dict = self.dict_result
if self.MULTI_AS_SINGLE_MODUS:
if self.multi_as_single_modus:
results_dict = merge_process_results(results_dict)

return self.get_predictions_as_geojson(
Expand Down Expand Up @@ -1000,17 +1005,17 @@ def load_thematic_data(self, loader: Loader):
dict_thematic, self.dict_thematic_properties, self.dict_thematic_source = (
loader.load_data()
)
if self.MULTI_AS_SINGLE_MODUS:
if self.multi_as_single_modus:
dict_thematic = multipolygons_to_singles(dict_thematic)
#TODO:Does these dicts has to be split when multi_to_single?
#dict_thematic_properties =
#dict_thematic_source =
# TODO:Does these dicts has to be split when multi_to_single?
# dict_thematic_properties =
# dict_thematic_source =
self.dict_thematic = dict_thematic
#self.dict_thematic_properties = dict_thematic_properties
#self.dict_thematic_source = dict_thematic_source

# self.dict_thematic_properties = dict_thematic_properties
# self.dict_thematic_source = dict_thematic_source

# Deprecated loader methods

def load_thematic_data_geojson(self, thematic_input, name_thematic_id):
logging.warning("deprecated method, use load_thematic_data instead")
loader = GeoJsonLoader(thematic_input, name_thematic_id)
Expand Down
9 changes: 5 additions & 4 deletions brdr/grb.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
get_collection,
dict_series_by_keys,
get_collection_by_partition,
geojson_to_dicts, merge_dict,
geojson_to_dicts,
merge_dict,
)

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -76,7 +77,7 @@ def get_geoms_affected_by_grb_change(
date_start=date.today(),
date_end=date.today(),
one_by_one=False,
border_distance=0
border_distance=0,
):
"""
Get a dictionary of thematic geometries that are affected bij GRB-changes in a specific timespan
Expand All @@ -96,8 +97,8 @@ def get_geoms_affected_by_grb_change(
"""
dict_thematic = aligner.dict_thematic
if aligner.MULTI_AS_SINGLE_MODUS:
dict_thematic=merge_dict(dict_thematic)
if aligner.multi_as_single_modus:
dict_thematic = merge_dict(dict_thematic)
crs = aligner.CRS
affected_dict: dict[str, BaseGeometry] = {}
unchanged_dict: dict[str, BaseGeometry] = {}
Expand Down

0 comments on commit 4684146

Please sign in to comment.