@@ -200,6 +200,13 @@ class NodataHandling(str, Enum):
200
200
remove = "remove"
201
201
202
202
203
+ class LocalMoranWeightType (str , Enum ):
204
+ """Weight type for Local Moran's I."""
205
+
206
+ queen = "queen"
207
+ knn = "knn"
208
+
209
+
203
210
RESAMPLING_MAPPING = {
204
211
"nearest" : warp .Resampling .nearest ,
205
212
"bilinear" : warp .Resampling .bilinear ,
@@ -497,6 +504,32 @@ def descriptive_statistics_vector_cli(input_file: Annotated[Path, INPUT_FILE_OPT
497
504
typer .echo ("Descriptive statistics (vector) completed" )
498
505
499
506
507
+ # LOCAL MORAN'S I
508
+ @app .command ()
509
+ def local_morans_i_cli (
510
+ input_vector : Annotated [Path , INPUT_FILE_OPTION ],
511
+ output_vector : Annotated [Path , OUTPUT_FILE_OPTION ],
512
+ column : str = typer .Option (),
513
+ weight_type : LocalMoranWeightType = LocalMoranWeightType .queen ,
514
+ k : int = 4 ,
515
+ permutations : int = 999 ,
516
+ ):
517
+ """Execute Local Moran's I calculation for the data."""
518
+ from eis_toolkit .exploratory_analyses .local_morans_i import local_morans_i
519
+
520
+ typer .echo ("Progress: 10%" )
521
+
522
+ gdf = gpd .read_file (input_vector )
523
+ typer .echo ("Progress: 25%" )
524
+
525
+ out_gdf = local_morans_i (gdf , column , weight_type , k , permutations )
526
+ typer .echo ("Progress: 75%" )
527
+
528
+ out_gdf .to_file (output_vector )
529
+ typer .echo ("Progress: 100%" )
530
+ typer .echo (f"Local Moran's I completed, output vector saved to { output_vector } ." )
531
+
532
+
500
533
# --- RASTER PROCESSING ---
501
534
502
535
0 commit comments