@@ -197,8 +197,12 @@ def select_fmask_2(self):
197197 self .fmask_2 = file_path
198198 self .fmask_entry_2 .setText (file_path .split ('/' )[- 1 ])
199199
200-
201200 def process_data2_nrt (self ):
201+ directory = self .folder_entry .text ()
202+ if not directory :
203+ QMessageBox .critical (self , "Error" , "Please select the working directory!" )
204+ return
205+
202206 if not self .in_fn or not self .deforestation_hrp or not self .mask :
203207 QMessageBox .critical (self , "Error" , "Please select all input files!" )
204208 return
@@ -211,8 +215,6 @@ def process_data2_nrt(self):
211215 QMessageBox .critical (None , "Error" , "All the input raster images must have the same spatial resolution!" )
212216 return
213217
214- directory = self .folder_entry .text ()
215-
216218 # Check if all images have the same number of rows and columns
217219 dimensions = [map_checker .get_image_dimensions (img ) for img in images ]
218220 if len (set (dimensions )) != 1 :
@@ -263,6 +265,11 @@ def process_data2_nrt(self):
263265 QMessageBox .critical (self , "Error" , f"An error occurred during processing: { str (e )} " )
264266
265267 def process_data2 (self ):
268+ directory = self .folder_entry .text ()
269+ if not directory :
270+ QMessageBox .critical (self , "Error" , "Please select the working directory!" )
271+ return
272+
266273 if not self .in_fn :
267274 QMessageBox .critical (self , "Error" , "Please select the input file!" )
268275 return
@@ -280,8 +287,6 @@ def process_data2(self):
280287 QMessageBox .critical (self , "Error" , "NRT value should be a valid number!" )
281288 return
282289
283- directory = self .folder_entry .text ()
284-
285290 n_classes = int (29 )
286291 if not n_classes :
287292 QMessageBox .critical (self , "Error" , "Please enter the number of classes!" )
@@ -338,6 +343,11 @@ def process_data2(self):
338343
339344
340345 def process_data2_2 (self ):
346+ directory_2 = self .folder_entry_2 .text ()
347+ if not directory_2 :
348+ QMessageBox .critical (self , "Error" , "Please select the working directory!" )
349+ return
350+
341351 if not self .in_fn_2 or not self .mask_2 or not self .fmask_2 :
342352 QMessageBox .critical (self , "Error" , "Please select all input files!" )
343353 return
@@ -358,7 +368,6 @@ def process_data2_2(self):
358368 return
359369
360370 n_classes_2 = int (30 )
361- directory_2 = self .folder_entry_2 .text ()
362371 out_fn_2 = self .out_fn_entry_2 .text ()
363372 if not out_fn_2 :
364373 QMessageBox .critical (self , "Error" , "Please enter the name of Vulnerability Map in CAL!" )
@@ -495,6 +504,11 @@ def select_deforestation_hrp(self):
495504 self .deforestation_hrp_entry .setText (file_path3 .split ('/' )[- 1 ])
496505
497506 def process_data3 (self ):
507+ directory = self .folder_entry .text ()
508+ if not directory :
509+ QMessageBox .critical (self , "Error" , "Please select the working directory!" )
510+ return
511+
498512 if not self .risk30_hrp or not self .municipality or not self .deforestation_hrp :
499513 QMessageBox .critical (self , "Error" , "Please select all input files!" )
500514 return
@@ -514,8 +528,6 @@ def process_data3(self):
514528 "All the input raster images must have the same number of rows and columns!" )
515529 return
516530
517- directory = self .folder_entry .text ()
518-
519531 out_fn1 = self .image1_entry .text ()
520532 if not out_fn1 :
521533 QMessageBox .critical (self , "Error" , "Please enter the name for Modeling Region Map in CAL!" )
@@ -667,6 +679,11 @@ def select_density(self):
667679 self .density_entry .setText (file_path .split ('/' )[- 1 ])
668680
669681 def process_data4 (self ):
682+ directory = self .folder_entry .text ()
683+ if not directory :
684+ QMessageBox .critical (self , "Error" , "Please select the working directory!" )
685+ return
686+
670687 if not self .mask or not self .deforestation_hrp or not self .density :
671688 QMessageBox .critical (self , "Error" , "Please select all input files!" )
672689 return
@@ -725,8 +742,6 @@ def process_data4(self):
725742 QMessageBox .critical (self , "Error" , "Please enter the title of plot!" )
726743 return
727744
728- directory = self .folder_entry .text ()
729-
730745 out_fn = self .out_fn_entry .text ()
731746 if not out_fn :
732747 QMessageBox .critical (self , "Error" , "Please enter the name of plot!" )
@@ -923,6 +938,11 @@ def select_fmask_2(self):
923938 self .fmask_entry_2 .setText (file_path .split ('/' )[- 1 ])
924939
925940 def process_data2 (self ):
941+ directory = self .folder_entry .text ()
942+ if not directory :
943+ QMessageBox .critical (self , "Error" , "Please select the working directory!" )
944+ return
945+
926946 if not self .in_fn :
927947 QMessageBox .critical (self , "Error" , "Please select the input file!" )
928948 return
@@ -953,8 +973,6 @@ def process_data2(self):
953973 QMessageBox .critical (self , "Error" , "Number of classes value should be a valid number!" )
954974 return
955975
956- directory = self .folder_entry .text ()
957-
958976 out_fn = self .out_fn_entry .text ()
959977 if not out_fn :
960978 QMessageBox .critical (self , "Error" , "Please enter the name of Vulnerability Map in CNF!" )
@@ -995,6 +1013,11 @@ def process_data2(self):
9951013 QMessageBox .critical (self , "Error" , f"An error occurred during processing: { str (e )} " )
9961014
9971015 def process_data2_2 (self ):
1016+ directory_2 = self .folder_entry_2 .text ()
1017+ if not directory_2 :
1018+ QMessageBox .critical (self , "Error" , "Please select the working directory!" )
1019+ return
1020+
9981021 if not self .in_fn_2 or not self .mask_2 or not self .fmask_2 :
9991022 QMessageBox .critical (self , "Error" , "Please select all input files!" )
10001023 return
@@ -1015,7 +1038,6 @@ def process_data2_2(self):
10151038 return
10161039
10171040 n_classes_2 = int (30 )
1018- directory_2 = self .folder_entry_2 .text ()
10191041 out_fn_2 = self .out_fn_entry_2 .text ()
10201042 if not out_fn_2 :
10211043 QMessageBox .critical (self , "Error" , "Please enter the name of Vulnerability Map in CNF!" )
@@ -1160,6 +1182,11 @@ def select_deforestation_cnf(self):
11601182 self .deforestation_cnf_entry .setText (file_path3 .split ('/' )[- 1 ])
11611183
11621184 def process_data3 (self ):
1185+ directory = self .folder_entry .text ()
1186+ if not directory :
1187+ QMessageBox .critical (self , "Error" , "Please select the working directory!" )
1188+ return
1189+
11631190 if not self .municipality or not self .csv or not self .deforestation_cnf or not self .risk30_vp :
11641191 QMessageBox .critical (self , "Error" , "Please select all input files!" )
11651192 return
@@ -1179,8 +1206,6 @@ def process_data3(self):
11791206 "All the input raster images must have the same number of rows and columns!" )
11801207 return
11811208
1182- directory = self .folder_entry .text ()
1183-
11841209 out_fn1 = self .image1_entry .text ()
11851210 if not out_fn1 :
11861211 QMessageBox .critical (self , "Error" , "Please enter the name of Prediction Modeling Region Map in CNF!" )
@@ -1355,6 +1380,11 @@ def select_density(self):
13551380 self .density_entry .setText (file_path .split ('/' )[- 1 ])
13561381
13571382 def process_data4 (self ):
1383+ directory = self .folder_entry .text ()
1384+ if not directory :
1385+ QMessageBox .critical (self , "Error" , "Please select the working directory!" )
1386+ return
1387+
13581388 if not self .mask or not self .fmask or not self .deforestation_cal or not self .deforestation_hrp or not self .density :
13591389 QMessageBox .critical (self , "Error" , "Please select all input files!" )
13601390 return
@@ -1412,8 +1442,6 @@ def process_data4(self):
14121442 QMessageBox .critical (self , "Error" , "Please enter the title of plot!" )
14131443 return
14141444
1415- directory = self .folder_entry .text ()
1416-
14171445 out_fn = self .out_fn_entry .text ()
14181446 if not out_fn :
14191447 QMessageBox .critical (self , "Error" , "Please enter the name used for the plot, performace chart and assessment polygons!" )
@@ -1628,6 +1656,11 @@ def select_fmask_2(self):
16281656 self .fmask_entry_2 .setText (file_path .split ('/' )[- 1 ])
16291657
16301658 def process_data2 (self ):
1659+ directory = self .folder_entry .text ()
1660+ if not directory :
1661+ QMessageBox .critical (self , "Error" , "Please select the working directory!" )
1662+ return
1663+
16311664 if not self .in_fn :
16321665 QMessageBox .critical (self , "Error" , "Please select the input file!" )
16331666 return
@@ -1658,8 +1691,6 @@ def process_data2(self):
16581691 QMessageBox .critical (self , "Error" , "Number of classes value should be a valid number!" )
16591692 return
16601693
1661- directory = self .folder_entry .text ()
1662-
16631694 out_fn = self .out_fn_entry .text ()
16641695 if not out_fn :
16651696 QMessageBox .critical (self , "Error" , "Please enter the name of Vulnerability Map in HRP!" )
@@ -1700,6 +1731,11 @@ def process_data2(self):
17001731 QMessageBox .critical (self , "Error" , f"An error occurred during processing: { str (e )} " )
17011732
17021733 def process_data2_2 (self ):
1734+ directory_2 = self .folder_entry_2 .text ()
1735+ if not directory_2 :
1736+ QMessageBox .critical (self , "Error" , "Please select the working directory!" )
1737+ return
1738+
17031739 if not self .in_fn_2 or not self .mask_2 or not self .fmask_2 :
17041740 QMessageBox .critical (self , "Error" , "Please select all input files!" )
17051741 return
@@ -1720,7 +1756,6 @@ def process_data2_2(self):
17201756 return
17211757
17221758 n_classes_2 = int (30 )
1723- directory_2 = self .folder_entry_2 .text ()
17241759 out_fn_2 = self .out_fn_entry_2 .text ()
17251760 if not out_fn_2 :
17261761 QMessageBox .critical (self , "Error" , "Please enter the name of Vulnerability Map in HRP!" )
@@ -1851,6 +1886,11 @@ def select_deforestation_hrp(self):
18511886 self .deforestation_hrp_entry .setText (file_path3 .split ('/' )[- 1 ])
18521887
18531888 def process_data3 (self ):
1889+ directory = self .folder_entry .text ()
1890+ if not directory :
1891+ QMessageBox .critical (self , "Error" , "Please select the working directory!" )
1892+ return
1893+
18541894 if not self .risk30_hrp or not self .municipality or not self .deforestation_hrp :
18551895 QMessageBox .critical (self , "Error" , "Please select all input files!" )
18561896 return
@@ -1870,8 +1910,6 @@ def process_data3(self):
18701910 "All the input raster images must have the same number of rows and columns!" )
18711911 return
18721912
1873- directory = self .folder_entry .text ()
1874-
18751913 out_fn1 = self .image1_entry .text ()
18761914 if not out_fn1 :
18771915 QMessageBox .critical (self , "Error" , "Please enter the name for Modeling Region Map in HRP!" )
@@ -2061,6 +2099,11 @@ def select_fmask_2(self):
20612099 self .fmask_entry_2 .setText (file_path .split ('/' )[- 1 ])
20622100
20632101 def process_data2 (self ):
2102+ directory = self .folder_entry .text ()
2103+ if not directory :
2104+ QMessageBox .critical (self , "Error" , "Please select the working directory!" )
2105+ return
2106+
20642107 if not self .in_fn :
20652108 QMessageBox .critical (self , "Error" , "Please select the input file!" )
20662109 return
@@ -2091,8 +2134,6 @@ def process_data2(self):
20912134 QMessageBox .critical (self , "Error" , "Number of classes value should be a valid number!" )
20922135 return
20932136
2094- directory = self .folder_entry .text ()
2095-
20962137 out_fn = self .out_fn_entry .text ()
20972138 if not out_fn :
20982139 QMessageBox .critical (self , "Error" , "Please enter the name of Vulnerability Map in VP!" )
@@ -2133,6 +2174,11 @@ def process_data2(self):
21332174 QMessageBox .critical (self , "Error" , f"An error occurred during processing: { str (e )} " )
21342175
21352176 def process_data2_2 (self ):
2177+ directory_2 = self .folder_entry_2 .text ()
2178+ if not directory_2 :
2179+ QMessageBox .critical (self , "Error" , "Please select the working directory!" )
2180+ return
2181+
21362182 if not self .in_fn_2 or not self .mask_2 or not self .fmask_2 :
21372183 QMessageBox .critical (self , "Error" , "Please select all input files!" )
21382184 return
@@ -2153,7 +2199,6 @@ def process_data2_2(self):
21532199 return
21542200
21552201 n_classes_2 = int (30 )
2156- directory_2 = self .folder_entry_2 .text ()
21572202 out_fn_2 = self .out_fn_entry_2 .text ()
21582203 if not out_fn_2 :
21592204 QMessageBox .critical (self , "Error" , "Please enter the name of Vulnerability Map in VP!" )
@@ -2286,6 +2331,11 @@ def select_risk30_vp(self):
22862331 self .risk30_vp_entry .setText (file_path2 .split ('/' )[- 1 ])
22872332
22882333 def process_data3 (self ):
2334+ directory = self .folder_entry .text ()
2335+ if not directory :
2336+ QMessageBox .critical (self , "Error" , "Please select the working directory!" )
2337+ return
2338+
22892339 if not self .csv or not self .municipality or not self .risk30_vp :
22902340 QMessageBox .critical (self , "Error" , "Please select all input files!" )
22912341 return
@@ -2315,8 +2365,6 @@ def process_data3(self):
23152365 QMessageBox .critical (self , "Error" , "Expected deforestation value should be a valid number!" )
23162366 return
23172367
2318- directory = self .folder_entry .text ()
2319-
23202368 out_fn1 = self .image1_entry .text ()
23212369 if not out_fn1 :
23222370 QMessageBox .critical (self , "Error" , "Please enter the name of Prediction Modeling Region Map in VP!" )
0 commit comments