From ed2944c194a5eded644b0f567cabbdb30d6ec23b Mon Sep 17 00:00:00 2001 From: Tobias Koetter Date: Mon, 18 Sep 2023 18:46:41 +0200 Subject: [PATCH 1/4] Fix problem with empty min constraint values during configure --- knime_extension/src/nodes/spatialclustering.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/knime_extension/src/nodes/spatialclustering.py b/knime_extension/src/nodes/spatialclustering.py index 80539661..c1b6f0ca 100644 --- a/knime_extension/src/nodes/spatialclustering.py +++ b/knime_extension/src/nodes/spatialclustering.py @@ -785,17 +785,21 @@ class MSSCConstraints: ) def get_capacities(self): + if ( + not self.capacities or self.capacities.isspace() + ): # return empty array if capacities string is empty + return [] return [float(x) for x in self.capacities.split(";")] def get_columns(self, schema): return self.columns.apply(schema).column_names def validate_settings(self, schema): - cols = self.get_columns(schema) - caps = self.get_capacities() - if len(cols) != len(caps): + cols = len(self.get_columns(schema)) + caps = len(self.get_capacities()) + if cols != caps: raise knext.InvalidParametersError( - "Please provide a capacity value for each selected constrained column." + f"Please provide a minimum constraint value for each selected constrained column ({caps} vs {cols})." ) From 3806332e5a09a3dd3738bc2361c9d7cf73954e95 Mon Sep 17 00:00:00 2001 From: Lingbo Liu Date: Tue, 19 Sep 2023 10:06:39 -0400 Subject: [PATCH 2/4] update isolation tackler-revise temp filed name --- knime_extension/src/nodes/spatialclustering.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knime_extension/src/nodes/spatialclustering.py b/knime_extension/src/nodes/spatialclustering.py index c1b6f0ca..7c62e793 100644 --- a/knime_extension/src/nodes/spatialclustering.py +++ b/knime_extension/src/nodes/spatialclustering.py @@ -1337,7 +1337,7 @@ def MergeIsolated(tmpMixedClusFC, theClus): lyr5 = tmpMixedClusFC[tmpMixedClusFC.index == theClus] theClusID = lyr5.FinalClus.to_list()[0] # get satified layer out - lyr6 = tmpMixedClusFC[tmpMixedClusFC[isolateid] == 0] + lyr6 = tmpMixedClusFC[tmpMixedClusFC["isolate"] == 0] # get weight wq = libpysal.weights.Rook.from_dataframe(tmpMixedClusFC) w_mix = wq.neighbors From 485288692f5a4b22e38369015b620e923a670de7 Mon Sep 17 00:00:00 2001 From: Lingbo Liu Date: Tue, 19 Sep 2023 13:11:41 -0400 Subject: [PATCH 3/4] update PeanoCurve with corrected power function --- knime_extension/src/nodes/spatialclustering.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/knime_extension/src/nodes/spatialclustering.py b/knime_extension/src/nodes/spatialclustering.py index 7c62e793..34796f7f 100644 --- a/knime_extension/src/nodes/spatialclustering.py +++ b/knime_extension/src/nodes/spatialclustering.py @@ -705,7 +705,7 @@ def execute(self, exec_context: knext.ExecutionContext, input_1): import pandas as pd import numpy as np - k = 2 ^ self.grid_k + k = 2**self.grid_k gdf0 = knut.load_geo_data_frame(input_1, self.geo_col, exec_context) gdf = gp.GeoDataFrame(geometry=gdf0.geometry, crs=gdf0.crs) @@ -759,7 +759,7 @@ def Peano(x, y, k): for i in range(gdf.shape[0]): x = gdf.loc[(gdf.theid == i), "unitx"].item() y = gdf.loc[(gdf.theid == i), "unity"].item() - gdf.loc[(gdf.theid == i), "peanoorder"] = Peano(x, y, self.grid_k) + gdf.loc[(gdf.theid == i), "peanoorder"] = Peano(x, y, k) exec_context.set_progress( i / row_count, f"Processing row {i} of {row_count}" ) From 26589b8e0beb87f9e3f21a8b1e6056251c282636 Mon Sep 17 00:00:00 2001 From: Tobias Koetter Date: Tue, 19 Sep 2023 21:02:43 +0200 Subject: [PATCH 4/4] Remove unused pyecharts dependency --- knime_extension/geospatial_env.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/knime_extension/geospatial_env.yml b/knime_extension/geospatial_env.yml index 7e943357..628779a8 100644 --- a/knime_extension/geospatial_env.yml +++ b/knime_extension/geospatial_env.yml @@ -35,4 +35,3 @@ dependencies: - pointpats=2.3.0 - pip: - ipinfo==4.4.3 - - pyecharts==2.0.4