fimeval 0.1.48__py3-none-any.whl → 0.1.51__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fimeval/BuildingFootprint/evaluationwithBF.py +6 -0
- fimeval/ContingencyMap/evaluationFIM.py +31 -0
- fimeval/ContingencyMap/fix_permissions.sh +23 -0
- {fimeval-0.1.48.dist-info → fimeval-0.1.51.dist-info}/METADATA +1 -1
- {fimeval-0.1.48.dist-info → fimeval-0.1.51.dist-info}/RECORD +7 -6
- {fimeval-0.1.48.dist-info → fimeval-0.1.51.dist-info}/LICENSE.txt +0 -0
- {fimeval-0.1.48.dist-info → fimeval-0.1.51.dist-info}/WHEEL +0 -0
|
@@ -85,6 +85,7 @@ def GetFloodedBuildingCountInfo(
|
|
|
85
85
|
if "bm" in str(raster1_path).lower():
|
|
86
86
|
count_centroids_in_raster(raster1_path, "Benchmark")
|
|
87
87
|
count_centroids_in_raster(raster2_path, "Candidate")
|
|
88
|
+
|
|
88
89
|
elif "candidate" in str(raster2_path).lower():
|
|
89
90
|
count_centroids_in_raster(raster1_path, "Candidate")
|
|
90
91
|
count_centroids_in_raster(raster2_path, "Benchmark")
|
|
@@ -105,6 +106,9 @@ def GetFloodedBuildingCountInfo(
|
|
|
105
106
|
CSI = TP / (TP + FP + FN) if (TP + FP + FN) > 0 else 0
|
|
106
107
|
FAR = FP / (TP + FP) if (TP + FP) > 0 else 0
|
|
107
108
|
POD = TP / (TP + FN) if (TP + FN) > 0 else 0
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
BDR = (centroid_counts["Candidate"]- centroid_counts["Benchmark"])/centroid_counts["Benchmark"]
|
|
108
112
|
|
|
109
113
|
counts_data = {
|
|
110
114
|
"Category": [
|
|
@@ -116,6 +120,7 @@ def GetFloodedBuildingCountInfo(
|
|
|
116
120
|
"CSI",
|
|
117
121
|
"FAR",
|
|
118
122
|
"POD",
|
|
123
|
+
"Building Deviation Ratio",
|
|
119
124
|
],
|
|
120
125
|
"Building Count": [
|
|
121
126
|
centroid_counts["Candidate"],
|
|
@@ -126,6 +131,7 @@ def GetFloodedBuildingCountInfo(
|
|
|
126
131
|
f"{CSI:.3f}",
|
|
127
132
|
f"{FAR:.3f}",
|
|
128
133
|
f"{POD:.3f}",
|
|
134
|
+
f"{BDR:.3f}",
|
|
129
135
|
],
|
|
130
136
|
}
|
|
131
137
|
|
|
@@ -4,6 +4,8 @@ from pathlib import Path
|
|
|
4
4
|
import geopandas as gpd
|
|
5
5
|
import rasterio
|
|
6
6
|
import shutil
|
|
7
|
+
import subprocess
|
|
8
|
+
import platform
|
|
7
9
|
import pandas as pd
|
|
8
10
|
from rasterio.warp import reproject, Resampling
|
|
9
11
|
from rasterio.io import MemoryFile
|
|
@@ -19,6 +21,30 @@ from .metrics import evaluationmetrics
|
|
|
19
21
|
from .PWBs3 import get_PWB
|
|
20
22
|
from ..utilis import MakeFIMsUniform
|
|
21
23
|
|
|
24
|
+
#giving the permission to the folder
|
|
25
|
+
def is_writable(path):
|
|
26
|
+
"""Check if the directory and its contents are writable."""
|
|
27
|
+
path = Path(path)
|
|
28
|
+
return os.access(path, os.W_OK)
|
|
29
|
+
|
|
30
|
+
def fix_permissions(path):
|
|
31
|
+
path = Path(path).resolve()
|
|
32
|
+
script_path = Path(__file__).parent / "fix_permissions.sh"
|
|
33
|
+
|
|
34
|
+
if not script_path.exists():
|
|
35
|
+
raise FileNotFoundError(f"Shell script not found: {script_path}")
|
|
36
|
+
|
|
37
|
+
if is_writable(path):
|
|
38
|
+
return
|
|
39
|
+
|
|
40
|
+
try:
|
|
41
|
+
result = subprocess.run(["bash", str(script_path), str(path)],
|
|
42
|
+
check=True, capture_output=True, text=True)
|
|
43
|
+
print(result.stdout)
|
|
44
|
+
except subprocess.CalledProcessError as e:
|
|
45
|
+
print(f"Shell script failed:\n{e.stderr}")
|
|
46
|
+
|
|
47
|
+
|
|
22
48
|
# Function for the evalution of the model
|
|
23
49
|
def evaluateFIM(
|
|
24
50
|
benchmark_path, candidate_paths, gdf, folder, method, output_dir, shapefile=None
|
|
@@ -351,7 +377,12 @@ def EvaluateFIM(main_dir, method_name, output_dir, PWB_dir=None, shapefile_dir=N
|
|
|
351
377
|
gdf = get_PWB()
|
|
352
378
|
else:
|
|
353
379
|
gdf = gpd.read_file(PWB_dir)
|
|
380
|
+
|
|
381
|
+
#Grant the permission to the main directory
|
|
382
|
+
print(f"Fixing permissions for {main_dir}...")
|
|
383
|
+
fix_permissions(main_dir)
|
|
354
384
|
|
|
385
|
+
#runt the process
|
|
355
386
|
def process_TIFF(tif_files, folder_dir):
|
|
356
387
|
benchmark_path = None
|
|
357
388
|
candidate_path = []
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
DIR="$1"
|
|
4
|
+
|
|
5
|
+
if [ -z "$DIR" ]; then
|
|
6
|
+
echo "No directory provided."
|
|
7
|
+
exit 1
|
|
8
|
+
fi
|
|
9
|
+
echo "Fixing permissions for: $DIR"
|
|
10
|
+
|
|
11
|
+
UNAME=$(uname)
|
|
12
|
+
if [[ "$UNAME" == "Darwin" || "$UNAME" == "Linux" ]]; then
|
|
13
|
+
chmod -R u+rwX "$DIR"
|
|
14
|
+
echo "Permissions granted for user (u+rwX)"
|
|
15
|
+
|
|
16
|
+
elif [[ "$UNAME" == *"MINGW"* || "$UNAME" == *"MSYS"* || "$UNAME" == *"CYGWIN"* ]]; then
|
|
17
|
+
icacls "$DIR" /grant Everyone:F /T > /dev/null
|
|
18
|
+
echo "Permissions granted for working folder"
|
|
19
|
+
|
|
20
|
+
else
|
|
21
|
+
echo "Unsupported OS: $UNAME"
|
|
22
|
+
exit 1
|
|
23
|
+
fi
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
fimeval/BuildingFootprint/__init__.py,sha256=oP9YWLdo6ANzSQFxYLv7Ku_26AY5NkLNhZLK28ICMLo,109
|
|
2
|
-
fimeval/BuildingFootprint/evaluationwithBF.py,sha256=
|
|
2
|
+
fimeval/BuildingFootprint/evaluationwithBF.py,sha256=mnmcfyNPL_XBg9fIDXJjBWsRDKlCZ8HPjIhzCiFJkb8,14352
|
|
3
3
|
fimeval/ContingencyMap/PWBs3.py,sha256=YAg03jzdplYIstG-pZM1MECse7gYjWrJNKAopjgt3uk,1294
|
|
4
4
|
fimeval/ContingencyMap/__init__.py,sha256=ckps2dyg6aci3TA-3P7oTMcCAcSTz9AA6sndHtZEwdE,259
|
|
5
|
-
fimeval/ContingencyMap/evaluationFIM.py,sha256=
|
|
5
|
+
fimeval/ContingencyMap/evaluationFIM.py,sha256=ZVoSAseQ_tb_WrY0JLZaTc9z3VCjMLt7iw_OY2-Gobc,16796
|
|
6
|
+
fimeval/ContingencyMap/fix_permissions.sh,sha256=prIeJGXwAUO28nhgtCtvcpOxWK-J75rxN4FQ6QjGET4,508
|
|
6
7
|
fimeval/ContingencyMap/methods.py,sha256=kbutfo9FUH-yjvnOXxwLpdErUuebMJ8NjCroNWIYCjo,3299
|
|
7
8
|
fimeval/ContingencyMap/metrics.py,sha256=eEv1zAfmIjyg9OWM1b6-i25q_3jEBmeLZ7JeuvxS1QI,1070
|
|
8
9
|
fimeval/ContingencyMap/plotevaluationmetrics.py,sha256=3bKfPKZnMR39dA3teDVpQBeTFKnF9v_2Vku0JNVGggs,3921
|
|
9
10
|
fimeval/ContingencyMap/printcontingency.py,sha256=Ef0TlGNxvLlrliM2SCkhusgz9BsEGvVOBHAO62YC_QA,5421
|
|
10
11
|
fimeval/__init__.py,sha256=kN114EvzG_BFjd65fKWXg29TqaWvR173EdCN3yj30oc,433
|
|
11
12
|
fimeval/utilis.py,sha256=KNXcR0RvhT_lPqM_8cuAGXMpRtcLMfb_UDqUiMlDevs,7311
|
|
12
|
-
fimeval-0.1.
|
|
13
|
-
fimeval-0.1.
|
|
14
|
-
fimeval-0.1.
|
|
15
|
-
fimeval-0.1.
|
|
13
|
+
fimeval-0.1.51.dist-info/LICENSE.txt,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
|
14
|
+
fimeval-0.1.51.dist-info/METADATA,sha256=ic6uUVb5xRU0RyZMo-CUQ4YPjA_evv_DRBn_kmIqgIk,14848
|
|
15
|
+
fimeval-0.1.51.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
16
|
+
fimeval-0.1.51.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|