Skip to content

Commit 52ba5d1

Browse files
committed
Fix issue in CBA where given attribute values were not recognized due to whitespaces
1 parent 686777b commit 52ba5d1

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

eis_toolkit/cli.py

+3
Original file line numberDiff line numberDiff line change
@@ -2041,6 +2041,9 @@ def cell_based_association_cli(
20412041
geodataframe = gpd.read_file(input_vector)
20422042
typer.echo("Progress: 25%")
20432043

2044+
if subset_target_attribute_values is not None:
2045+
subset_target_attribute_values = [value.strip() for value in subset_target_attribute_values]
2046+
20442047
cell_based_association(
20452048
cell_size=cell_size,
20462049
geodata=[geodataframe],

eis_toolkit/vector_processing/cell_based_association.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,8 @@ def cell_based_association(
9090
raise InvalidColumnException("Targeted column not found in the GeoDataFrame.")
9191

9292
for i, subset in enumerate(subset_target_attribute_values):
93-
if subset is not None:
94-
for value in subset:
95-
if value not in geodata[i][column[i]].unique():
96-
raise InvalidParameterValueException("Subset of value(s) not found in the targeted column.")
93+
if subset is not None and not all(value in geodata[i][column[i]].tolist() for value in subset):
94+
raise InvalidParameterValueException("Subset of value(s) not found in the targeted column.")
9795

9896
# Computation
9997
for i, data in enumerate(geodata):

0 commit comments

Comments
 (0)