-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_folders.py
118 lines (88 loc) · 3.2 KB
/
setup_folders.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Run this file while in the main folder
import os
parent_folders = ["data", "results"]
for f in parent_folders:
if not os.path.exists(f):
os.mkdir(f)
print("Successfully created folder: " + f)
# make subfolders for data
data_subfolders = ["input", "processed"]
for f in data_subfolders:
if not os.path.exists("data/" + f):
os.mkdir("data/" + f)
# Make input data subfolders
data_subsubfolders = [
"municipalities",
"population",
"socioeconomic",
"urban",
]
for f in data_subsubfolders:
if not os.path.exists("data/input/" + f):
os.mkdir("data/input/" + f)
print("Successfully created folder: data/input/" + f)
# make subfolders for results
results_subfolders = [
"density_maps",
"density_plots",
"component_maps",
"component_plots",
"correlation",
"reach_maps",
"reach_plots",
"summary_stats",
"spatial_autocorrelation",
"clustering",
"equity",
]
for f in results_subfolders:
if not os.path.exists("results/" + f):
os.mkdir("results/" + f)
print("Successfully created folder: results/" + f)
area_folders = ["municipal", "socio", "hexgrid"]
for f in results_subfolders[:5]:
for a in area_folders:
if not os.path.exists("results/" + f + "/" + a):
os.mkdir("results/" + f + "/" + a)
print("Successfully created folder: results/" + f + "/" + a)
# make subfolders for clustering results
cluster_equity_subfolders = ["plots", "maps", "data"]
for f in cluster_equity_subfolders:
if not os.path.exists("results/clustering/" + f):
os.mkdir("results/clustering/" + f)
print("Successfully created folder: results/clustering/" + f)
if not os.path.exists("results/equity/" + f):
os.mkdir("results/equity/" + f)
print("Successfully created folder: results/equity/" + f)
result_type_subfolders = ["density", "fragmentation", "reach"]
f = "spatial_autocorrelation"
for r in result_type_subfolders:
if not os.path.exists("results/" + f + "/" + r):
os.mkdir("results/" + f + "/" + r)
print("Successfully created folder: results/" + f + "/" + r)
if r in ("fragmentation", "density"): # no muni or socio folders in reach
for a in area_folders:
if not os.path.exists("results/" + f + "/" + r + "/" + a):
os.mkdir("results/" + f + "/" + r + "/" + a)
print(
"Successfully created folder: results/" + f + "/" + r + "/" + a
)
elif r == "reach":
if not os.path.exists("results/" + f + "/" + r + "/" + "hexgrid"):
os.mkdir("results/" + f + "/" + r + "/" + "hexgrid")
print(
"Successfully created folder: results/"
+ f
+ "/"
+ r
+ "/"
+ "hexgrid"
)
fp = "results/spatial_autocorrelation/sensitivity_test"
if not os.path.exists(fp):
os.mkdir(fp)
print("Successfully created folder: " + fp)
fp = "results/spatial_autocorrelation/socio_pop"
if not os.path.exists(fp):
os.mkdir(fp)
print("Successfully created folder: " + fp)