Skip to content

Commit

Permalink
Fixes some checks in post-stratify option
Browse files Browse the repository at this point in the history
  • Loading branch information
XavierCLL committed Jul 23, 2024
1 parent 42cc145 commit 0eb9fd4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions core/sampling_design.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def do_simple_random_sampling():
return
if AcATaMa.dockwidget.QGBox_SimpRSwithCR.isChecked():
if not valid_file_selected_in(AcATaMa.dockwidget.QCBox_CategMap_SimpRS, "categorical map"):
iface.messageBar().pushMessage("AcATaMa", "Error, post-stratify option is enabled but not configured",
level=Qgis.Warning, duration=10)
return

# get and define some variables
Expand All @@ -66,7 +68,7 @@ def do_simple_random_sampling():
if not classes_selected:
raise Exception
except:
iface.messageBar().pushMessage("AcATaMa", "Error, post-stratify option enabled but none of the classes were selected",
iface.messageBar().pushMessage("AcATaMa", "Error, post-stratify option is enabled but none of the classes were selected",
level=Qgis.Warning, duration=10)
return
else:
Expand Down Expand Up @@ -360,6 +362,11 @@ def do_systematic_sampling():
# first check input files requirements
if not valid_file_selected_in(AcATaMa.dockwidget.QCBox_ThematicMap, "thematic map"):
return
if AcATaMa.dockwidget.QGBox_SystSwithCR.isChecked():
if not valid_file_selected_in(AcATaMa.dockwidget.QCBox_CategMap_SystS, "categorical map"):
iface.messageBar().pushMessage("AcATaMa", "Error, post-stratify option enabled but not configured",
level=Qgis.Warning, duration=10)
return

# get and define some variables
thematic_map = Map(file_selected_combo_box=AcATaMa.dockwidget.QCBox_ThematicMap,
Expand All @@ -378,7 +385,7 @@ def do_systematic_sampling():
if not classes_selected:
raise Exception
except:
iface.messageBar().pushMessage("AcATaMa", "Error, post-stratify option enabled but none of the classes were selected",
iface.messageBar().pushMessage("AcATaMa", "Error, post-stratify option is enabled but none of the classes were selected",
level=Qgis.Warning, duration=10)
return
else:
Expand Down

0 comments on commit 0eb9fd4

Please sign in to comment.