├── requirements.txt ├── core ├── widgets │ ├── QRibbonToolbar │ │ ├── main.css │ │ ├── RibbonPane.css │ │ ├── SmallButton.css │ │ ├── StandardButton.css │ │ ├── Ribbon.css │ │ └── StyleSheets.py │ ├── Settings │ │ └── languageSettings_main.py │ ├── ImportData │ │ └── importData_dialog.py │ ├── FeatureInfo │ │ └── featureInfo_main.py │ ├── ModelInfo │ │ └── modelinfo_main.py │ ├── RasterInfo │ │ └── rasterInfo_main.py │ ├── ResultViewer │ │ ├── resultViewerLogReg_main.py │ │ ├── shared_resultviewer.py │ │ ├── ann_resultviewer.py │ │ └── resultViewerWofE_main.py │ ├── ParameterSelection │ │ └── ParameterSelection_main.py │ └── GeoprocessingTools │ │ └── geoprocessingTools_main.py ├── resources │ ├── qt_de.qm │ ├── geoview_icon.ico │ └── icons.qrc ├── libs │ ├── Reporting │ │ ├── default.docx │ │ └── shared_report.py │ ├── Management │ │ ├── LayerManagement.py │ │ └── Project_configuration.py │ ├── LSAT_Messages │ │ └── messages_main.py │ └── Rasterprepwork │ │ └── rpw_main.py └── uis │ ├── ResultViewer_ui │ ├── PlotViewer.ui │ ├── tabbedResultViewer.ui │ ├── tableViewer.ui │ ├── plotViewer_ui.py │ ├── tableViewer_ui.py │ ├── ResultsContingencyMatrix.ui │ ├── tabbedResultViewer_ui.py │ ├── resultsViewerWofE.ui │ ├── ResultsPairDetails.ui │ ├── ResultsContingencyMatrix_ui.py │ ├── tabbedResultViewerAHP.ui │ ├── resultsViewerWofE_ui.py │ ├── ResultsPairDetails_ui.py │ └── tabbedResultViewerAHP_ui.py │ ├── AttributeTable_ui │ ├── attributeTable.ui │ └── attributeTable_ui.py │ ├── LSAT_main_ui │ ├── mainFrame.ui │ └── mainFrame_ui.py │ ├── ParameterSelection_ui │ ├── ParameterSelection.ui │ └── ParameterSelection_ui.py │ ├── RasterAttributeTable_ui │ ├── AddField.ui │ └── AddField_ui.py │ ├── Settings_ui │ ├── LanguageSettings.ui │ └── LanguageSettings_ui.py │ ├── GeoViewer_ui │ ├── BasicViewer.ui │ └── BasicViewer_ui.py │ ├── LookupRaster_ui │ ├── LookupRaster.ui │ └── LookupRaster_ui.py │ ├── FeatureInfo_ui │ ├── FeatureInfo.ui │ └── FeatureInfo_ui.py │ ├── Geoprocessing_ui │ ├── FlowDirection_ui.ui │ ├── SimpleGUI.ui │ ├── FlowAccumulation_ui.ui │ └── SimpleGUI_ui.py │ ├── ModelBuilder_ui │ └── ExpressionBuilder.ui │ ├── ModelInfo_ui │ ├── ModelInfo.ui │ └── ModelInfo_ui.py │ ├── Contingency_ui │ └── Contingency.ui │ ├── RasterInfo_ui │ └── RasterInfo.ui │ └── Reprojection_ui │ └── Reprojection.ui ├── docs └── html │ └── index.html ├── CITATION.cff ├── .gitignore └── Readme.md /requirements.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BGR-EGHA/LSAT/HEAD/requirements.txt -------------------------------------------------------------------------------- /core/widgets/QRibbonToolbar/main.css: -------------------------------------------------------------------------------- 1 | QWidget{ 2 | background-color: #dfe9f5; 3 | } -------------------------------------------------------------------------------- /core/resources/qt_de.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BGR-EGHA/LSAT/HEAD/core/resources/qt_de.qm -------------------------------------------------------------------------------- /core/libs/Reporting/default.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BGR-EGHA/LSAT/HEAD/core/libs/Reporting/default.docx -------------------------------------------------------------------------------- /core/resources/geoview_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BGR-EGHA/LSAT/HEAD/core/resources/geoview_icon.ico -------------------------------------------------------------------------------- /core/widgets/QRibbonToolbar/RibbonPane.css: -------------------------------------------------------------------------------- 1 | QWidget { 2 | border: 0px solid black; 3 | margin: 0px; 4 | padding: 0px; 5 | } -------------------------------------------------------------------------------- /docs/html/index.html: -------------------------------------------------------------------------------- 1 | The current (git) version of LSAT PM does not include documentation. 2 |
3 | You can get the documentation from GitHub 4 | or read the latest version online on readthedocs.io. 5 |
6 | Release versions (Windows installer) include the documentation. -------------------------------------------------------------------------------- /core/widgets/QRibbonToolbar/SmallButton.css: -------------------------------------------------------------------------------- 1 | QToolButton { 2 | text-align: left; 3 | border: 1px solid transparent; 4 | margin:2px; 5 | } 6 | 7 | QToolButton:hover { 8 | border: 1px solid rgba(120,160,255,60%); 9 | background-color: QLinearGradient(spread:pad, x1: 0, y1: 1, x2: 0, y2: 0, stop: 0 rgba(150,180,200,30%),stop: 0.5 rgba(225,235,245,60%), stop: 1 rgba(225,235,245,30%)); 10 | } 11 | 12 | 13 | QToolButton:pressed{ 14 | border: 1px solid rgba(120,160,255,80%); 15 | background-color: QLinearGradient(spread:pad, x1: 0, y1: 1, x2: 0, y2: 0, stop: 0 rgba(150,180,200,50%),stop: 0.5 rgba(225,235,245,80%), stop: 1 rgba(225,235,245,50%)); 16 | } 17 | 18 | QToolButton:checked{ 19 | border: 1px solid rgba(120,160,255,40%); 20 | background-color: rgba(0,0,0,10%) 21 | } -------------------------------------------------------------------------------- /core/widgets/QRibbonToolbar/StandardButton.css: -------------------------------------------------------------------------------- 1 | QToolButton { 2 | text-align: left; 3 | border: 1px solid transparent; 4 | padding: 0px; 5 | margin-left:2px; 6 | margin-right:2px; 7 | } 8 | 9 | QToolButton:hover { 10 | border: 1px solid rgba(120,160,255,60%); 11 | background-color: QLinearGradient(spread:pad, x1: 0, y1: 1, x2: 0, y2: 0, stop: 0 rgba(150,180,200,30%),stop: 0.5 rgba(225,235,245,60%), stop: 1 rgba(225,235,245,30%)); 12 | } 13 | 14 | QToolButton:pressed{ 15 | border: 1px solid rgba(120,160,255,80%); 16 | background-color: QLinearGradient(spread:pad, x1: 0, y1: 1, x2: 0, y2: 0, stop: 0 rgba(150,180,200,50%),stop: 0.5 rgba(225,235,245,80%), stop: 1 rgba(225,235,245,50%)); 17 | } 18 | 19 | QToolButton:checked{ 20 | border: 1px solid rgba(120,160,255,40%); 21 | background-color: rgba(0,0,0,10%) 22 | } -------------------------------------------------------------------------------- /core/widgets/QRibbonToolbar/Ribbon.css: -------------------------------------------------------------------------------- 1 | QToolBar { 2 | padding: 0px; 3 | } 4 | 5 | QTabWidget:pane { 6 | border-radius: 0px; 7 | margin:0px; 8 | padding: 0px; 9 | background-color: qlineargradient(x1: 0, y1: 1, x2: 0, y2: 0, stop: 0 #efefef, stop: 0.5 #e5e5e5, stop: 1.0 #fdfdfd); 10 | border-bottom: 1px solid rgba(0,0,0,20%); 11 | border-top: 1px solid rgba(0,0,0,20%); 12 | top: -1; 13 | } 14 | QTabWidget{ 15 | 16 | } 17 | 18 | QTabWidget::tab-bar { 19 | left: 3px; 20 | } 21 | 22 | QTabBar::tab { 23 | padding-top: 4px; 24 | padding-bottom: 4px; 25 | padding-left: 30px; 26 | padding-right: 30px; 27 | border-top-left-radius: 3px; 28 | border-top-right-radius: 3px; 29 | margin-right:5px; 30 | color:#2A2A2A; 31 | } 32 | 33 | QTabBar::tab:hover { 34 | background: rgba(76, 40, 50, 30%); 35 | } 36 | 37 | QTabBar::tab:selected{ 38 | background: #5678af; 39 | color: #f7f7f7; 40 | 41 | border: 0px solid rgba(0,0,0,20%); 42 | 43 | } -------------------------------------------------------------------------------- /core/libs/Reporting/shared_report.py: -------------------------------------------------------------------------------- 1 | import docx 2 | import os 3 | 4 | 5 | class shared_report(): 6 | """ 7 | This class bundles a few basic functions used by the other report generators. 8 | """ 9 | 10 | def opentemplate(): 11 | """ 12 | Opens the LSAT Word template (core\\libs\\Reporting\\default.docx) and preps it for editing, 13 | by removing an empty line at the beginning. 14 | """ 15 | templatepath = os.path.join(os.getcwd(), "core", "libs", "Reporting", "default.docx") 16 | doc = docx.Document(templatepath) 17 | # Workaround to remove empty line at the beginning 18 | p = doc.paragraphs[0]._element 19 | p.getparent().remove(p) 20 | p._p = p._element = None 21 | return doc 22 | 23 | def savedoc(outputname, project_path, doc, analysis) -> None: 24 | """ 25 | Saves the document under results\\*analysis*\reports\\*outputname*.docx 26 | doc is the Document object 27 | """ 28 | path = os.path.join(project_path, "results", analysis, "reports", outputname + ".docx") 29 | doc.save(path) 30 | -------------------------------------------------------------------------------- /CITATION.cff: -------------------------------------------------------------------------------- 1 | cff-version: 1.2.0 2 | message: "If you use this software, please cite it as below." 3 | authors: 4 | - family-names: "Torizin" 5 | given-names: "Jewgenij" 6 | orcid: "https://orcid.org/0000-0001-9990-3872" 7 | - family-names: "Schüßler" 8 | given-names: "Nick" 9 | orcid: "https://orcid.org/0000-0002-2271-3007" 10 | - family-names: "Fuchs" 11 | given-names: "Michael" 12 | orcid: "https://orcid.org/0000-0003-2269-9724" 13 | title: "Landslide Susceptibility Assessment Tools Project Manager Suite" 14 | version: 1.0.1 15 | doi: 10.5281/zenodo.6482940 16 | date-released: 2022-04-25 17 | url: "https://github.com/BGR-EGHA/LSAT" 18 | preferred-citation: 19 | type: article 20 | authors: 21 | - family-names: "Torizin" 22 | given-names: "Jewgenij" 23 | orcid: "https://orcid.org/0000-0001-9990-3872" 24 | - family-names: "Schüßler" 25 | given-names: "Nick" 26 | orcid: "https://orcid.org/0000-0002-2271-3007" 27 | - family-names: "Fuchs" 28 | given-names: "Michael" 29 | orcid: "https://orcid.org/0000-0003-2269-9724" 30 | doi: "10.5194/gmd-15-2791-2022" 31 | journal: "Geoscientific Model Development" 32 | start: 2791 33 | end: 2812 34 | title: "Landslide Susceptibility Assessment Tools v1.0.0b – Project Manager Suite: a new modular toolkit for landslide susceptibility assessment" 35 | issue: 7 36 | volume: 15 37 | year: 2022 -------------------------------------------------------------------------------- /core/uis/ResultViewer_ui/PlotViewer.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | GraphicViewer 4 | 5 | 6 | 7 | 0 8 | 0 9 | 817 10 | 626 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 0 27 | 0 28 | 817 29 | 21 30 | 31 | 32 | 33 | 34 | 35 | 36 | toolBar 37 | 38 | 39 | TopToolBarArea 40 | 41 | 42 | false 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /core/widgets/QRibbonToolbar/StyleSheets.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | import inspect 4 | stylesheet_instance = None 5 | 6 | 7 | def get_stylesheet(name): 8 | global stylesheet_instance 9 | if not stylesheet_instance: 10 | stylesheet_instance = Stylesheets() 11 | return stylesheet_instance.get_stylesheet(name) 12 | 13 | 14 | class Stylesheets(object): 15 | def __init__(self): 16 | self._stylesheets = {} 17 | self.fullpath = os.path.dirname(os.path.abspath(inspect.getfile(self.make_stylesheet))) 18 | self.make_stylesheet("main", "main.css") 19 | self.make_stylesheet("Ribbon", "Ribbon.css") 20 | self.make_stylesheet("RibbonPane", "RibbonPane.css") 21 | self.make_stylesheet("StandardButton", "StandardButton.css") 22 | self.make_stylesheet("SmallButton", "SmallButton.css") 23 | 24 | def make_stylesheet(self, name, path): 25 | style_path = os.path.join(self.fullpath, 26 | path) 27 | with open(style_path) as data_file: 28 | stylesheet = data_file.read() 29 | 30 | self._stylesheets[name] = stylesheet 31 | 32 | def get_stylesheet(self, name): 33 | stylesheet = "" 34 | try: 35 | stylesheet = self._stylesheets[name] 36 | except KeyError: 37 | print("stylesheet " + name + " not found") 38 | return stylesheet 39 | -------------------------------------------------------------------------------- /core/widgets/Settings/languageSettings_main.py: -------------------------------------------------------------------------------- 1 | # -*- coding: cp1252 -*- 2 | 3 | import codecs 4 | from PyQt5 import QtGui, QtCore, QtWidgets 5 | from PyQt5.QtCore import * 6 | from PyQt5.QtGui import * 7 | from PyQt5.QtWidgets import * 8 | from PyQt5.QtNetwork import * 9 | from core.uis.Settings_ui.LanguageSettings_ui import Ui_LanguageSettings 10 | from core.libs.Management import Project_configuration as configuration 11 | 12 | 13 | class LanguageSettings(QMainWindow): 14 | def __init__(self, parent=None): 15 | QWidget.__init__(self, parent) 16 | self.ui = Ui_LanguageSettings() 17 | self.ui.setupUi(self) 18 | self.setWindowTitle(self.tr("Language Settings")) 19 | self.setWindowIcon(QIcon(':/icons/Icons/language.png')) 20 | self.config = configuration.Configuration() 21 | language = self.config.getLanguage() 22 | idx = self.ui.comboBox.findText(str(language)) 23 | self.ui.comboBox.setCurrentIndex(idx) 24 | 25 | @pyqtSlot() 26 | def on_applyPushButton_clicked(self): 27 | self.config.config["DEFAULT"]["language"] = str(self.ui.comboBox.currentText()) 28 | with codecs.open("config.ini", 'w', "utf-8") as configfile: 29 | self.config.config.write(configfile) 30 | self.close() 31 | QMessageBox.information(self, self.tr("Restart Application"), self.tr( 32 | "The changes become active after restart of the application!")) 33 | 34 | @pyqtSlot() 35 | def on_cancelPushButton_clicked(self): 36 | self.close() 37 | -------------------------------------------------------------------------------- /core/uis/ResultViewer_ui/tabbedResultViewer.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | tabbedResultViewer 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1000 10 | 750 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 21 | 0 22 | 23 | 24 | 25 | Seite 26 | 27 | 28 | 29 | 30 | 31 | 32 | Info 33 | 34 | 35 | 36 | 37 | Value 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /core/uis/AttributeTable_ui/attributeTable.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | AttributeTable 4 | 5 | 6 | 7 | 0 8 | 0 9 | 792 10 | 530 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | true 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 0 35 | 0 36 | 792 37 | 22 38 | 39 | 40 | 41 | 42 | 43 | 44 | toolBar 45 | 46 | 47 | TopToolBarArea 48 | 49 | 50 | false 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /core/uis/ResultViewer_ui/tableViewer.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | TableViewWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1021 10 | 696 11 | 12 | 13 | 14 | TableViewer 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | true 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 0 36 | 0 37 | 1021 38 | 21 39 | 40 | 41 | 42 | 43 | 44 | toolBar 45 | 46 | 47 | TopToolBarArea 48 | 49 | 50 | false 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /core/uis/LSAT_main_ui/mainFrame.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainFrame 4 | 5 | 6 | 7 | 0 8 | 0 9 | 845 10 | 614 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 0 27 | 0 28 | 845 29 | 18 30 | 31 | 32 | 33 | 34 | File 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | New Project... 47 | 48 | 49 | 50 | 51 | Open Project... 52 | 53 | 54 | 55 | 56 | Exit 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /core/uis/ParameterSelection_ui/ParameterSelection.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ParameterSelection 4 | 5 | 6 | 7 | 0 8 | 0 9 | 600 10 | 600 11 | 12 | 13 | 14 | Parameter Selection 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 90 24 | 25 | 26 | 27 | Layer Name 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | Apply 36 | 37 | 38 | 39 | 40 | 41 | 42 | Select All Layers 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | treeWidget 53 | applyPushButton 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /core/uis/ResultViewer_ui/plotViewer_ui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file '.\PlotViewer.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.14.2 6 | # 7 | # WARNING! All changes made in this file will be lost! 8 | 9 | 10 | from PyQt5 import QtCore, QtGui, QtWidgets 11 | 12 | 13 | class Ui_GraphicViewer(object): 14 | def setupUi(self, GraphicViewer): 15 | GraphicViewer.setObjectName("GraphicViewer") 16 | GraphicViewer.resize(817, 626) 17 | self.centralwidget = QtWidgets.QWidget(GraphicViewer) 18 | self.centralwidget.setObjectName("centralwidget") 19 | self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget) 20 | self.horizontalLayout.setObjectName("horizontalLayout") 21 | self.mainGridLayout = QtWidgets.QGridLayout() 22 | self.mainGridLayout.setObjectName("mainGridLayout") 23 | self.horizontalLayout.addLayout(self.mainGridLayout) 24 | GraphicViewer.setCentralWidget(self.centralwidget) 25 | self.menubar = QtWidgets.QMenuBar(GraphicViewer) 26 | self.menubar.setGeometry(QtCore.QRect(0, 0, 817, 21)) 27 | self.menubar.setObjectName("menubar") 28 | GraphicViewer.setMenuBar(self.menubar) 29 | self.statusbar = QtWidgets.QStatusBar(GraphicViewer) 30 | self.statusbar.setObjectName("statusbar") 31 | GraphicViewer.setStatusBar(self.statusbar) 32 | self.toolBar = QtWidgets.QToolBar(GraphicViewer) 33 | self.toolBar.setObjectName("toolBar") 34 | GraphicViewer.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar) 35 | 36 | self.retranslateUi(GraphicViewer) 37 | QtCore.QMetaObject.connectSlotsByName(GraphicViewer) 38 | 39 | def retranslateUi(self, GraphicViewer): 40 | _translate = QtCore.QCoreApplication.translate 41 | GraphicViewer.setWindowTitle(_translate("GraphicViewer", "MainWindow")) 42 | self.toolBar.setWindowTitle(_translate("GraphicViewer", "toolBar")) 43 | -------------------------------------------------------------------------------- /core/uis/RasterAttributeTable_ui/AddField.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | AddField 4 | 5 | 6 | 7 | 0 8 | 0 9 | 264 10 | 131 11 | 12 | 13 | 14 | Dialog 15 | 16 | 17 | 18 | 19 | 20 | Field Type 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | Field Name 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | Double 39 | 40 | 41 | 42 | 43 | Integer 44 | 45 | 46 | 47 | 48 | Text 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | Apply 57 | 58 | 59 | 60 | 61 | 62 | 63 | Cancel 64 | 65 | 66 | 67 | 68 | 69 | 70 | fieldNameLineEdit 71 | fieldTypeComboBox 72 | applyPushButton 73 | cancelPushButton 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /core/uis/ResultViewer_ui/tableViewer_ui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file '.\tableViewer.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.14.2 6 | # 7 | # WARNING! All changes made in this file will be lost! 8 | 9 | 10 | from PyQt5 import QtCore, QtGui, QtWidgets 11 | 12 | 13 | class Ui_TableViewWidget(object): 14 | def setupUi(self, TableViewWidget): 15 | TableViewWidget.setObjectName("TableViewWidget") 16 | TableViewWidget.resize(1021, 696) 17 | self.centralwidget = QtWidgets.QWidget(TableViewWidget) 18 | self.centralwidget.setObjectName("centralwidget") 19 | self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget) 20 | self.verticalLayout.setObjectName("verticalLayout") 21 | self.mainGridLayout = QtWidgets.QGridLayout() 22 | self.mainGridLayout.setObjectName("mainGridLayout") 23 | self.tableView = QtWidgets.QTableView(self.centralwidget) 24 | self.tableView.setAlternatingRowColors(True) 25 | self.tableView.setObjectName("tableView") 26 | self.mainGridLayout.addWidget(self.tableView, 0, 0, 1, 1) 27 | self.verticalLayout.addLayout(self.mainGridLayout) 28 | TableViewWidget.setCentralWidget(self.centralwidget) 29 | self.statusbar = QtWidgets.QStatusBar(TableViewWidget) 30 | self.statusbar.setObjectName("statusbar") 31 | TableViewWidget.setStatusBar(self.statusbar) 32 | self.menubar = QtWidgets.QMenuBar(TableViewWidget) 33 | self.menubar.setGeometry(QtCore.QRect(0, 0, 1021, 21)) 34 | self.menubar.setObjectName("menubar") 35 | TableViewWidget.setMenuBar(self.menubar) 36 | self.toolBar = QtWidgets.QToolBar(TableViewWidget) 37 | self.toolBar.setObjectName("toolBar") 38 | TableViewWidget.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar) 39 | 40 | self.retranslateUi(TableViewWidget) 41 | QtCore.QMetaObject.connectSlotsByName(TableViewWidget) 42 | 43 | def retranslateUi(self, TableViewWidget): 44 | _translate = QtCore.QCoreApplication.translate 45 | TableViewWidget.setWindowTitle(_translate("TableViewWidget", "TableViewer")) 46 | self.toolBar.setWindowTitle(_translate("TableViewWidget", "toolBar")) 47 | -------------------------------------------------------------------------------- /core/libs/Management/LayerManagement.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import logging 4 | 5 | 6 | class LayerManagement: 7 | ''' 8 | Layer management provide some additional properties which improve 9 | the indexing of the QTreeWidgetItems and QGraphicItems (aka canvas items) 10 | ''' 11 | 12 | def __init__(self): 13 | self.treeContent = {} 14 | self.canvasContent = {} 15 | self.layerCount = 0 16 | 17 | def addCanvasContent(self, item, layerProperties): 18 | ''' 19 | Adds an object and its attributes to the CanvasContent 20 | ''' 21 | self.canvasContent[item] = layerProperties 22 | return self.canvasContent 23 | 24 | def addTreeContent(self, item, layerProperties): 25 | ''' 26 | Adds an object and its attributes to the TreeContent 27 | ''' 28 | self.treeContent[item] = layerProperties 29 | return self.treeContent 30 | 31 | def getPixmapItemByName(self, name): 32 | ''' 33 | Return the pixmap item object by name 34 | ''' 35 | for key, values in self.canvasContent.items(): 36 | if values['Name'] == name: 37 | return key 38 | 39 | def getTreeItemByName(self, name): 40 | ''' 41 | Return the tree widget item object by name 42 | ''' 43 | for key, values in self.treeContent.items(): 44 | if values['Name'] == name: 45 | return key 46 | 47 | def getLayerName(self, item): 48 | ''' 49 | Returns the layer Name 50 | ''' 51 | try: 52 | layerName = self.canvasContent[item]['Name'] 53 | except BaseException: 54 | layerName = self.treeContent[item]['Name'] 55 | return layerName 56 | 57 | def getLayerSourcePath(self, item): 58 | ''' 59 | Returns the Layer source path 60 | ''' 61 | try: 62 | sourcePath = self.canvasContent[item]['Source'] 63 | except BaseException: 64 | sourcePath = self.treeContent[item]['Source'] 65 | return sourcePath 66 | 67 | def removeTreeItemByName(self, name: str) -> None: 68 | ''' 69 | Removes an item from the tree based on its name. 70 | ''' 71 | key = self.getTreeItemByName(name) 72 | self.treeContent.pop(key) -------------------------------------------------------------------------------- /core/uis/AttributeTable_ui/attributeTable_ui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file '.\attributeTable.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.15.4 6 | # 7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is 8 | # run again. Do not edit this file unless you know what you are doing. 9 | 10 | 11 | from PyQt5 import QtCore, QtGui, QtWidgets 12 | 13 | 14 | class Ui_AttributeTable(object): 15 | def setupUi(self, AttributeTable): 16 | AttributeTable.setObjectName("AttributeTable") 17 | AttributeTable.resize(792, 530) 18 | self.centralwidget = QtWidgets.QWidget(AttributeTable) 19 | self.centralwidget.setObjectName("centralwidget") 20 | self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget) 21 | self.horizontalLayout.setObjectName("horizontalLayout") 22 | self.mainGridLayout = QtWidgets.QGridLayout() 23 | self.mainGridLayout.setObjectName("mainGridLayout") 24 | self.tableView = QtWidgets.QTableView(self.centralwidget) 25 | self.tableView.setSortingEnabled(True) 26 | self.tableView.setObjectName("tableView") 27 | self.mainGridLayout.addWidget(self.tableView, 0, 0, 1, 1) 28 | self.horizontalLayout.addLayout(self.mainGridLayout) 29 | AttributeTable.setCentralWidget(self.centralwidget) 30 | self.menubar = QtWidgets.QMenuBar(AttributeTable) 31 | self.menubar.setGeometry(QtCore.QRect(0, 0, 792, 22)) 32 | self.menubar.setObjectName("menubar") 33 | AttributeTable.setMenuBar(self.menubar) 34 | self.statusbar = QtWidgets.QStatusBar(AttributeTable) 35 | self.statusbar.setObjectName("statusbar") 36 | AttributeTable.setStatusBar(self.statusbar) 37 | self.toolBar = QtWidgets.QToolBar(AttributeTable) 38 | self.toolBar.setObjectName("toolBar") 39 | AttributeTable.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar) 40 | 41 | self.retranslateUi(AttributeTable) 42 | QtCore.QMetaObject.connectSlotsByName(AttributeTable) 43 | 44 | def retranslateUi(self, AttributeTable): 45 | _translate = QtCore.QCoreApplication.translate 46 | AttributeTable.setWindowTitle(_translate("AttributeTable", "MainWindow")) 47 | self.toolBar.setWindowTitle(_translate("AttributeTable", "toolBar")) 48 | -------------------------------------------------------------------------------- /core/widgets/ImportData/importData_dialog.py: -------------------------------------------------------------------------------- 1 | from PyQt5.QtCore import * 2 | from PyQt5.QtGui import * 3 | from PyQt5.QtWidgets import * 4 | from core.libs.GDAL_Libs.Layers import Raster 5 | from core.uis.Reprojection_ui.Reprojection_ui import Ui_ProjectionSettings 6 | from core.widgets.RasterInfo.rasterInfo_main import RasterInfo 7 | 8 | 9 | class ReprojectionSettings(QDialog): 10 | """ 11 | Gets called when a function wants the user to define the resamplingytpe for 12 | importData_importRaster.py. Allows the user to pick the kind of reprojection he wants to use. 13 | """ 14 | 15 | def __init__(self, rasterpath, maskpath, parent=None): 16 | super().__init__() 17 | self.ui = Ui_ProjectionSettings() 18 | self.ui.setupUi(self) 19 | self.setWindowIcon(QIcon(':/icons/Icons/LoadRaster_bw.png')) 20 | rasterInfo = RasterInfo(rasterpath) 21 | self.ui.inputRasterInfoGroupBoxGridLayout.addWidget(rasterInfo) 22 | maskInfo = RasterInfo(maskpath) 23 | raster = Raster(rasterpath) 24 | mask = Raster(maskpath) 25 | self.ui.sourceEPSGLineEdit.setText(str(raster.epsg)) 26 | self.ui.targetEPSGLineEdit.setText(str(mask.epsg)) 27 | self.ui.srcCellsizeLineEdit.setText(str(raster.cellsize[0])) 28 | self.ui.targetCellsizeLineEdit.setText(str(mask.cellsize[0])) 29 | self.guessResamplingBasedOnType(raster) 30 | 31 | def guessResamplingBasedOnType(self, raster: object) -> None: 32 | """ 33 | Guesses theresamplingtype based on the type of raster the user wants to import. 34 | Default is Nearest Neighbor which is fine for int/byte types. 35 | """ 36 | if raster.dataType in ("Float32", "CFloat32", "Float64", "CFloat64"): 37 | self.ui.CUBICradioButton.setChecked(True) 38 | 39 | @pyqtSlot() 40 | def on_okPushButton_clicked(self): 41 | """ 42 | Closes the window and defines a class value that can be used by the function that opened 43 | the dialog. 44 | """ 45 | if self.ui.NEARESTradioButton.isChecked(): 46 | self.resamplingType = "NEAREST" 47 | elif self.ui.CUBICradioButton.isChecked(): 48 | self.resamplingType = "CUBIC" 49 | elif self.ui.BILINEARradioButton.isChecked(): 50 | self.resamplingType = "BILINEAR" 51 | self.accept() # Closes the Dialog 52 | -------------------------------------------------------------------------------- /core/uis/ResultViewer_ui/ResultsContingencyMatrix.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ContingencyMatrix 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1000 10 | 750 11 | 12 | 13 | 14 | Contingency Matrix 15 | 16 | 17 | 1.000000000000000 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | Contingency Matrix 27 | 28 | 29 | 30 | 31 | 32 | 33 | Pearson's C 34 | 35 | 36 | 37 | 38 | Cramers' V 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | To see details for input pairs, double-click on the corresponding matrix field. 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 0 68 | 0 69 | 1000 70 | 22 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /core/uis/ResultViewer_ui/tabbedResultViewer_ui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file '.\tabbedResultViewer.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.15.4 6 | # 7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is 8 | # run again. Do not edit this file unless you know what you are doing. 9 | 10 | 11 | from PyQt5 import QtCore, QtGui, QtWidgets 12 | 13 | 14 | class Ui_tabbedResultViewer(object): 15 | def setupUi(self, tabbedResultViewer): 16 | tabbedResultViewer.setObjectName("tabbedResultViewer") 17 | tabbedResultViewer.resize(1000, 750) 18 | self.centralwidget = QtWidgets.QWidget(tabbedResultViewer) 19 | self.centralwidget.setObjectName("centralwidget") 20 | self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget) 21 | self.verticalLayout.setObjectName("verticalLayout") 22 | self.tabWidget = QtWidgets.QTabWidget(self.centralwidget) 23 | self.tabWidget.setObjectName("tabWidget") 24 | self.modelTab = QtWidgets.QWidget() 25 | self.modelTab.setObjectName("modelTab") 26 | self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.modelTab) 27 | self.verticalLayout_2.setObjectName("verticalLayout_2") 28 | self.modelTreeWidget = QtWidgets.QTreeWidget(self.modelTab) 29 | self.modelTreeWidget.setObjectName("modelTreeWidget") 30 | self.verticalLayout_2.addWidget(self.modelTreeWidget) 31 | self.tabWidget.addTab(self.modelTab, "") 32 | self.verticalLayout.addWidget(self.tabWidget) 33 | tabbedResultViewer.setCentralWidget(self.centralwidget) 34 | self.statusbar = QtWidgets.QStatusBar(tabbedResultViewer) 35 | self.statusbar.setObjectName("statusbar") 36 | tabbedResultViewer.setStatusBar(self.statusbar) 37 | 38 | self.retranslateUi(tabbedResultViewer) 39 | self.tabWidget.setCurrentIndex(0) 40 | QtCore.QMetaObject.connectSlotsByName(tabbedResultViewer) 41 | 42 | def retranslateUi(self, tabbedResultViewer): 43 | _translate = QtCore.QCoreApplication.translate 44 | tabbedResultViewer.setWindowTitle(_translate("tabbedResultViewer", "MainWindow")) 45 | self.modelTreeWidget.headerItem().setText(0, _translate("tabbedResultViewer", "Info")) 46 | self.modelTreeWidget.headerItem().setText(1, _translate("tabbedResultViewer", "Value")) 47 | self.tabWidget.setTabText(self.tabWidget.indexOf(self.modelTab), _translate("tabbedResultViewer", "Seite")) 48 | -------------------------------------------------------------------------------- /core/uis/ParameterSelection_ui/ParameterSelection_ui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file '.\ParameterSelection.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.14.2 6 | # 7 | # WARNING! All changes made in this file will be lost! 8 | 9 | 10 | from PyQt5 import QtCore, QtGui, QtWidgets 11 | 12 | 13 | class Ui_ParameterSelection(object): 14 | def setupUi(self, ParameterSelection): 15 | ParameterSelection.setObjectName("ParameterSelection") 16 | ParameterSelection.resize(600, 600) 17 | self.centralwidget = QtWidgets.QWidget(ParameterSelection) 18 | self.centralwidget.setObjectName("centralwidget") 19 | self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget) 20 | self.verticalLayout.setObjectName("verticalLayout") 21 | self.mainGridLayout = QtWidgets.QGridLayout() 22 | self.mainGridLayout.setObjectName("mainGridLayout") 23 | self.treeWidget = QtWidgets.QTreeWidget(self.centralwidget) 24 | self.treeWidget.setObjectName("treeWidget") 25 | self.treeWidget.header().setDefaultSectionSize(90) 26 | self.mainGridLayout.addWidget(self.treeWidget, 1, 0, 1, 2) 27 | self.applyPushButton = QtWidgets.QPushButton(self.centralwidget) 28 | self.applyPushButton.setObjectName("applyPushButton") 29 | self.mainGridLayout.addWidget(self.applyPushButton, 2, 1, 1, 1) 30 | self.toggleselectAllLayersPushButton = QtWidgets.QPushButton(self.centralwidget) 31 | self.toggleselectAllLayersPushButton.setObjectName("toggleselectAllLayersPushButton") 32 | self.mainGridLayout.addWidget(self.toggleselectAllLayersPushButton, 2, 0, 1, 1) 33 | self.verticalLayout.addLayout(self.mainGridLayout) 34 | ParameterSelection.setCentralWidget(self.centralwidget) 35 | 36 | self.retranslateUi(ParameterSelection) 37 | QtCore.QMetaObject.connectSlotsByName(ParameterSelection) 38 | ParameterSelection.setTabOrder(self.treeWidget, self.applyPushButton) 39 | 40 | def retranslateUi(self, ParameterSelection): 41 | _translate = QtCore.QCoreApplication.translate 42 | ParameterSelection.setWindowTitle(_translate("ParameterSelection", "Parameter Selection")) 43 | self.treeWidget.headerItem().setText(0, _translate("ParameterSelection", "Layer Name")) 44 | self.applyPushButton.setText(_translate("ParameterSelection", "Apply")) 45 | self.toggleselectAllLayersPushButton.setText(_translate("ParameterSelection", "Select All Layers")) 46 | -------------------------------------------------------------------------------- /core/uis/LSAT_main_ui/mainFrame_ui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file '.\mainFrame.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.14.2 6 | # 7 | # WARNING! All changes made in this file will be lost! 8 | 9 | 10 | from PyQt5 import QtCore, QtGui, QtWidgets 11 | 12 | 13 | class Ui_MainFrame(object): 14 | def setupUi(self, MainFrame): 15 | MainFrame.setObjectName("MainFrame") 16 | MainFrame.resize(845, 614) 17 | self.centralwidget = QtWidgets.QWidget(MainFrame) 18 | self.centralwidget.setObjectName("centralwidget") 19 | self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget) 20 | self.horizontalLayout.setObjectName("horizontalLayout") 21 | self.mainGridLayout = QtWidgets.QGridLayout() 22 | self.mainGridLayout.setObjectName("mainGridLayout") 23 | self.horizontalLayout.addLayout(self.mainGridLayout) 24 | MainFrame.setCentralWidget(self.centralwidget) 25 | self.menubar = QtWidgets.QMenuBar(MainFrame) 26 | self.menubar.setGeometry(QtCore.QRect(0, 0, 845, 18)) 27 | self.menubar.setObjectName("menubar") 28 | self.menuFile = QtWidgets.QMenu(self.menubar) 29 | self.menuFile.setObjectName("menuFile") 30 | MainFrame.setMenuBar(self.menubar) 31 | self.statusbar = QtWidgets.QStatusBar(MainFrame) 32 | self.statusbar.setObjectName("statusbar") 33 | MainFrame.setStatusBar(self.statusbar) 34 | self.actionNew_Project = QtWidgets.QAction(MainFrame) 35 | self.actionNew_Project.setObjectName("actionNew_Project") 36 | self.actionOpen_Project = QtWidgets.QAction(MainFrame) 37 | self.actionOpen_Project.setObjectName("actionOpen_Project") 38 | self.actionExit = QtWidgets.QAction(MainFrame) 39 | self.actionExit.setObjectName("actionExit") 40 | self.menuFile.addAction(self.actionNew_Project) 41 | self.menuFile.addAction(self.actionOpen_Project) 42 | self.menuFile.addSeparator() 43 | self.menuFile.addAction(self.actionExit) 44 | self.menubar.addAction(self.menuFile.menuAction()) 45 | 46 | self.retranslateUi(MainFrame) 47 | QtCore.QMetaObject.connectSlotsByName(MainFrame) 48 | 49 | def retranslateUi(self, MainFrame): 50 | _translate = QtCore.QCoreApplication.translate 51 | MainFrame.setWindowTitle(_translate("MainFrame", "MainWindow")) 52 | self.menuFile.setTitle(_translate("MainFrame", "File")) 53 | self.actionNew_Project.setText(_translate("MainFrame", "New Project...")) 54 | self.actionOpen_Project.setText(_translate("MainFrame", "Open Project...")) 55 | self.actionExit.setText(_translate("MainFrame", "Exit")) 56 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 98 | __pypackages__/ 99 | 100 | # Celery stuff 101 | celerybeat-schedule 102 | celerybeat.pid 103 | 104 | # SageMath parsed files 105 | *.sage.py 106 | 107 | # Environments 108 | .env 109 | .venv 110 | env/ 111 | venv/ 112 | ENV/ 113 | env.bak/ 114 | venv.bak/ 115 | 116 | # Spyder project settings 117 | .spyderproject 118 | .spyproject 119 | 120 | # Rope project settings 121 | .ropeproject 122 | 123 | # mkdocs documentation 124 | /site 125 | 126 | # mypy 127 | .mypy_cache/ 128 | .dmypy.json 129 | dmypy.json 130 | 131 | # Pyre type checker 132 | .pyre/ 133 | 134 | # pytype static type analyzer 135 | .pytype/ 136 | 137 | # Cython debug symbols 138 | cython_debug/ 139 | *.ini 140 | /.idea/ 141 | -------------------------------------------------------------------------------- /core/libs/Management/Project_configuration.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import codecs 4 | import os 5 | import sys 6 | from PyQt5 import QtCore 7 | from PyQt5.QtGui import * 8 | from PyQt5.QtWidgets import * 9 | import configparser 10 | 11 | 12 | class Configuration: 13 | def __init__(self): 14 | self.configFilePath = "config.ini" 15 | if os.path.exists(self.configFilePath): 16 | self.readConfigfile() 17 | self.validateProjectList() 18 | 19 | else: 20 | self.createDefaultConfigFile() 21 | self.readConfigfile() 22 | 23 | def readConfigfile(self): 24 | self.config = configparser.ConfigParser() 25 | self.config.read(str(self.configFilePath), encoding="utf-8") 26 | 27 | def validateProjectList(self): 28 | ''' 29 | Checks if the projects in the list exist and updates the project list 30 | ''' 31 | projects = self.config["DEFAULT"]["projects"].split(";") 32 | new_list = [] 33 | for path in projects: 34 | if os.path.exists(path): 35 | path = os.path.normpath(path) 36 | new_list.append(path) 37 | else: 38 | pass 39 | if projects != new_list: 40 | self.updateProjectList(new_list) 41 | 42 | def getLanguage(self): 43 | ''' 44 | Returns the project language specified in the config file. 45 | :return: 46 | string Language 47 | ''' 48 | lang = self.config["DEFAULT"]["language"] 49 | return lang 50 | 51 | def getProjects(self): 52 | ''' 53 | Returns project paths from config file. 54 | ''' 55 | path_list = self.config["DEFAULT"]["projects"].split(";") 56 | return path_list 57 | 58 | def updateProjectList(self, new_list): 59 | ''' 60 | Updates the existing project list. 61 | ''' 62 | self.config["DEFAULT"]["projects"] = ";".join(map(str, new_list)) 63 | with codecs.open("config.ini", 'w', "utf-8") as configfile: 64 | self.config.write(configfile) 65 | return 66 | 67 | def updateLanguage(self, language): 68 | """ 69 | Overwrites the language 70 | :param language: string specified language 71 | :return: None 72 | """ 73 | self.config["DEFAULT"]["language"] = str(language) 74 | with codecs.open("config.ini", 'w', "utf-8") as configfile: 75 | self.config.write(configfile) 76 | return 77 | 78 | def createDefaultConfigFile(self): 79 | """ 80 | Creates a default config file 81 | """ 82 | config = configparser.ConfigParser() 83 | config["DEFAULT"] = {"Projects": "", 84 | "Language": "English", 85 | } 86 | with codecs.open("config.ini", 'w', "utf-8") as configfile: 87 | config.write(configfile) 88 | -------------------------------------------------------------------------------- /core/resources/icons.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | Icons/AddField.png 4 | Icons/ahp.png 5 | Icons/ann.png 6 | Icons/aspect.png 7 | Icons/AttributeTable.png 8 | Icons/backDoor.png 9 | Icons/Book.png 10 | Icons/BoundingBox.png 11 | Icons/Chart_Bar_Big.png 12 | Icons/check.png 13 | Icons/cond_prob.png 14 | Icons/Contingency_tab.png 15 | Icons/DeleteField.png 16 | Icons/EuclideanDist.png 17 | Icons/featureInfo.png 18 | Icons/File_Doc_Text_Word.png 19 | Icons/File_Edit.png 20 | Icons/File_Table.png 21 | Icons/File_XLS_Excel.png 22 | Icons/Folder.png 23 | Icons/GeoprocessingTools.png 24 | Icons/geoviewer.png 25 | Icons/Help.png 26 | Icons/hillshade.png 27 | Icons/ImportFeature.png 28 | Icons/ImportFeature_bw.png 29 | Icons/Info.png 30 | Icons/language.png 31 | Icons/Legend.png 32 | Icons/LoadRaster_bw.png 33 | Icons/logisticReg.png 34 | Icons/lookup.png 35 | Icons/LSATLogo.png 36 | Icons/mask.png 37 | Icons/minus.png 38 | Icons/model.png 39 | Icons/model_builder.png 40 | Icons/model_info.png 41 | Icons/Modeler.png 42 | Icons/Modeler_grey.png 43 | Icons/new_project.png 44 | Icons/News.png 45 | Icons/open_project.png 46 | Icons/OpenInExcel.png 47 | Icons/plus.png 48 | Icons/point_shape.png 49 | Icons/polygon_shape.png 50 | Icons/polyline_shape.png 51 | Icons/project_icon.png 52 | Icons/project_info.png 53 | Icons/Properties_bw.png 54 | Icons/proxy.png 55 | Icons/random_subset.png 56 | Icons/raster_icon.png 57 | Icons/raster_info.png 58 | Icons/reclassify.png 59 | Icons/RemoveLayer.png 60 | Icons/reproject.png 61 | Icons/roughness.png 62 | Icons/SaveEdits.png 63 | Icons/SelectByAttributes.png 64 | Icons/SensitivityReclass.png 65 | Icons/Settings.png 66 | Icons/Slope.png 67 | Icons/SplashScreen.png 68 | Icons/Subset_inventory.png 69 | Icons/tpi.png 70 | Icons/Trashbox.png 71 | Icons/TRI.png 72 | Icons/Warning.png 73 | Icons/WordReport.png 74 | Icons/WriteRaster.png 75 | Icons/zoning.png 76 | 77 | 78 | -------------------------------------------------------------------------------- /core/uis/RasterAttributeTable_ui/AddField_ui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file '.\AddField.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.15.6 6 | # 7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is 8 | # run again. Do not edit this file unless you know what you are doing. 9 | 10 | 11 | from PyQt5 import QtCore, QtGui, QtWidgets 12 | 13 | 14 | class Ui_AddField(object): 15 | def setupUi(self, AddField): 16 | AddField.setObjectName("AddField") 17 | AddField.resize(264, 131) 18 | self.gridLayout = QtWidgets.QGridLayout(AddField) 19 | self.gridLayout.setObjectName("gridLayout") 20 | self.fieldTypeLabel = QtWidgets.QLabel(AddField) 21 | self.fieldTypeLabel.setObjectName("fieldTypeLabel") 22 | self.gridLayout.addWidget(self.fieldTypeLabel, 2, 0, 1, 2) 23 | self.fieldNameLineEdit = QtWidgets.QLineEdit(AddField) 24 | self.fieldNameLineEdit.setObjectName("fieldNameLineEdit") 25 | self.gridLayout.addWidget(self.fieldNameLineEdit, 1, 0, 1, 2) 26 | self.fieldNameLabel = QtWidgets.QLabel(AddField) 27 | self.fieldNameLabel.setObjectName("fieldNameLabel") 28 | self.gridLayout.addWidget(self.fieldNameLabel, 0, 0, 1, 2) 29 | self.fieldTypeComboBox = QtWidgets.QComboBox(AddField) 30 | self.fieldTypeComboBox.setObjectName("fieldTypeComboBox") 31 | self.fieldTypeComboBox.addItem("") 32 | self.fieldTypeComboBox.addItem("") 33 | self.fieldTypeComboBox.addItem("") 34 | self.gridLayout.addWidget(self.fieldTypeComboBox, 3, 0, 1, 2) 35 | self.applyPushButton = QtWidgets.QPushButton(AddField) 36 | self.applyPushButton.setObjectName("applyPushButton") 37 | self.gridLayout.addWidget(self.applyPushButton, 4, 0, 1, 1) 38 | self.cancelPushButton = QtWidgets.QPushButton(AddField) 39 | self.cancelPushButton.setObjectName("cancelPushButton") 40 | self.gridLayout.addWidget(self.cancelPushButton, 4, 1, 1, 1) 41 | 42 | self.retranslateUi(AddField) 43 | QtCore.QMetaObject.connectSlotsByName(AddField) 44 | AddField.setTabOrder(self.fieldNameLineEdit, self.fieldTypeComboBox) 45 | AddField.setTabOrder(self.fieldTypeComboBox, self.applyPushButton) 46 | AddField.setTabOrder(self.applyPushButton, self.cancelPushButton) 47 | 48 | def retranslateUi(self, AddField): 49 | _translate = QtCore.QCoreApplication.translate 50 | AddField.setWindowTitle(_translate("AddField", "Dialog")) 51 | self.fieldTypeLabel.setText(_translate("AddField", "Field Type")) 52 | self.fieldNameLabel.setText(_translate("AddField", "Field Name")) 53 | self.fieldTypeComboBox.setItemText(0, _translate("AddField", "Double")) 54 | self.fieldTypeComboBox.setItemText(1, _translate("AddField", "Integer")) 55 | self.fieldTypeComboBox.setItemText(2, _translate("AddField", "Text")) 56 | self.applyPushButton.setText(_translate("AddField", "Apply")) 57 | self.cancelPushButton.setText(_translate("AddField", "Cancel")) 58 | -------------------------------------------------------------------------------- /core/uis/ResultViewer_ui/resultsViewerWofE.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1000 10 | 700 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 0 24 | 25 | 26 | 27 | Seite 28 | 29 | 30 | 31 | 32 | 33 | 34 | Info 35 | 36 | 37 | 38 | 39 | Value 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | Table 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | Graphics 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 0 76 | 0 77 | 1000 78 | 22 79 | 80 | 81 | 82 | 83 | 84 | 85 | toolBar 86 | 87 | 88 | TopToolBarArea 89 | 90 | 91 | false 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /core/uis/ResultViewer_ui/ResultsPairDetails.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ContingencyResults 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1000 10 | 750 11 | 12 | 13 | 14 | Results - Contingency Analysis 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 2 24 | 25 | 26 | 27 | Frequency table 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 | Phi (2x2) 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 0 77 | 0 78 | 1000 79 | 22 80 | 81 | 82 | 83 | 84 | 85 | 86 | mainTabWidget 87 | frequencyTableView 88 | chi2TableView 89 | phiTableView 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /core/uis/Settings_ui/LanguageSettings.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | LanguageSettings 4 | 5 | 6 | 7 | 0 8 | 0 9 | 280 10 | 125 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | Select Language 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | Apply 32 | 33 | 34 | 35 | 36 | 37 | 38 | Cancel 39 | 40 | 41 | 42 | 43 | 44 | 45 | Qt::Horizontal 46 | 47 | 48 | 49 | 40 50 | 20 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | English 60 | 61 | 62 | 63 | 64 | Deutsch 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 0 82 | 0 83 | 280 84 | 18 85 | 86 | 87 | 88 | 89 | 90 | comboBox 91 | cancelPushButton 92 | applyPushButton 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /core/widgets/FeatureInfo/featureInfo_main.py: -------------------------------------------------------------------------------- 1 | # -*- coding: cp1252 -*- 2 | 3 | from osgeo import gdal, ogr, osr, gdalconst 4 | import os 5 | import math 6 | import time 7 | import numpy as np 8 | 9 | from PyQt5 import QtCore, QtGui, QtWidgets, uic 10 | from PyQt5.QtCore import * 11 | from PyQt5.QtGui import * 12 | from PyQt5.QtWidgets import * 13 | import sys 14 | import os 15 | import logging 16 | import webbrowser 17 | from core.uis.FeatureInfo_ui.FeatureInfo_ui import Ui_FeatureInfo 18 | from core.libs.GDAL_Libs.Layers import Feature 19 | 20 | 21 | class FeatureInfo(QMainWindow): 22 | def __init__(self, featurePath, parent=None): 23 | QMainWindow.__init__(self, parent) 24 | self.ui = Ui_FeatureInfo() 25 | self.ui.setupUi(self) 26 | self.setWindowIcon(QIcon(":/icons/Icons/featureInfo.png")) 27 | 28 | self.path = featurePath 29 | self.setWindowTitle(self.tr("Feature info - {}").format(os.path.basename(self.path))) 30 | self.tree = self.ui.treeWidget 31 | self.tree.expandAll() 32 | 33 | self.feat = Feature(self.path) 34 | # set source path 35 | self.populateTopLevelItem(0, str(self.path)) 36 | # set data type 37 | self.populateTopLevelItem(1, str(self.feat.geometryName)) 38 | # set feature count 39 | self.populateTopLevelItem(2, str(self.feat.count)) 40 | # set fields 41 | for i, name in enumerate(self.feat.fieldNames): 42 | item = QTreeWidgetItem() 43 | child_item = self.tree.topLevelItem(3).addChild(item) 44 | self.populateChildItem(3, i, str(name[0]) + " - " + str(name[1])) 45 | 46 | # set epsg code 47 | self.populateChildItem(4, 0, str(self.feat.getEPSG_Code())) 48 | self.populateChildItem(4, 1, str(self.feat.spatialRef.GetAttrValue('PROJCS'))) 49 | 50 | # set Extent 51 | self.populateChildItem(5, 0, str(self.feat.extent[3])) 52 | self.populateChildItem(5, 1, str(self.feat.extent[0])) 53 | self.populateChildItem(5, 2, str(self.feat.extent[1])) 54 | self.populateChildItem(5, 3, str(self.feat.extent[2])) 55 | 56 | self.button = QPushButton(self.tr("Details")) 57 | self.button.setFixedWidth(100) 58 | self.button.clicked.connect(self.EPSG_details) 59 | item = QTreeWidgetItem() 60 | child_item = self.tree.topLevelItem(4).addChild(item) 61 | self.tree.setItemWidget(item, 1, self.button) 62 | 63 | def EPSG_details(self): 64 | string = "https://epsg.io/%s" % (str(self.feat.getEPSG_Code())) 65 | webbrowser.open(string) 66 | 67 | def populateTopLevelItem(self, index, text): 68 | item = self.tree.topLevelItem(index) 69 | item.setText(1, text) 70 | 71 | def populateChildItem(self, index_parent, index_child, text): 72 | item = self.tree.topLevelItem(index_parent) 73 | subitem = item.child(index_child) 74 | subitem.setText(1, text) 75 | 76 | def closeEvent(self, event): 77 | """ 78 | Closes the widget and cleans up data. 79 | :param event: closeEvent 80 | :return: None 81 | """ 82 | del self.feat 83 | -------------------------------------------------------------------------------- /core/uis/GeoViewer_ui/BasicViewer.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Viewer 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1138 10 | 798 11 | 12 | 13 | 14 | Geodata Viewer 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | Qt::WheelFocus 24 | 25 | 26 | Qt::ScrollBarAlwaysOff 27 | 28 | 29 | Qt::ScrollBarAlwaysOff 30 | 31 | 32 | true 33 | 34 | 35 | QGraphicsView::ScrollHandDrag 36 | 37 | 38 | QGraphicsView::AnchorUnderMouse 39 | 40 | 41 | Qt::ContainsItemShape 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | toolBar 53 | 54 | 55 | TopToolBarArea 56 | 57 | 58 | false 59 | 60 | 61 | 62 | 63 | 64 | ../../../../../0_PYTHON_27/3_LSAT_TOOLBOX/ImagePNG/MonteCarlo2.png 65 | 66 | 67 | 68 | Open... 69 | 70 | 71 | true 72 | 73 | 74 | 75 | 76 | Exit... 77 | 78 | 79 | Close the application 80 | 81 | 82 | false 83 | 84 | 85 | 86 | 87 | true 88 | 89 | 90 | true 91 | 92 | 93 | Content window... 94 | 95 | 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /core/widgets/ModelInfo/modelinfo_main.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import os 3 | from PyQt5.QtCore import * 4 | from PyQt5.QtGui import * 5 | from PyQt5.QtWidgets import * 6 | from core.uis.ModelInfo_ui.ModelInfo_ui import Ui_ModelInfo 7 | 8 | 9 | class ModelInfo(QMainWindow): 10 | def __init__(self, filepath, parent=None): 11 | """ 12 | The npz with the the information we feed the ui with gets generated in modelbuilder_calc. 13 | """ 14 | super().__init__() 15 | model = np.load(filepath, allow_pickle=True) 16 | # ui 17 | self.ui = Ui_ModelInfo() 18 | self.ui.setupUi(self) 19 | self.setWindowIcon(QIcon(":/icons/Icons/model_info.png")) 20 | self.setWindowTitle(self.tr("Model Info - {}").format(model["name"])) 21 | # Add information 22 | self.addinfo(model, filepath) 23 | self.ui.treeWidget.header().setSectionResizeMode(QHeaderView.ResizeToContents) 24 | self.ui.treeWidget.expandAll() 25 | self.ui.treeWidget.resizeColumnToContents(1) 26 | 27 | def addinfo(self, model, filepath): 28 | """ 29 | Fills the ui with information about the model. 30 | """ 31 | self.ui.treeWidget.topLevelItem(0).setText(1, filepath) # Path to .npz 32 | self.ui.treeWidget.topLevelItem(1).setText(1, str(round(float(model["auc"]), 2))) # AUC 33 | self.ui.treeWidget.topLevelItem(1).setToolTip(1, str(model["auc"])) 34 | self.ui.treeWidget.topLevelItem(2).setText( 35 | 1, str(len(model["params"]))) # Number of rasters used 36 | for i in range(len(model["params"])): # Paths to the used rasters 37 | tmp = QTreeWidgetItem() 38 | self.ui.treeWidget.topLevelItem(2).addChild(tmp) 39 | tmp.setText(1, model["params"][i]) 40 | self.ui.treeWidget.topLevelItem(3).setText( 41 | 1, str(model["expression"])) # Model generating mathematic expression 42 | self.ui.treeWidget.topLevelItem(4).setText( 43 | 1, str(len(model["unique_values"]))) # Unique values 44 | self.ui.treeWidget.topLevelItem(5).setText( 45 | 1, str(model["analysistype"])) # e.g. Subsampling type 46 | self.ui.treeWidget.topLevelItem(6).setText(1, self._getInputFeature(model)) 47 | if model["randomseed"] != None: # only for on-the-fly subsampled models 48 | self.ui.treeWidget.topLevelItem(7).setText(1, str(model["randomseed"])) 49 | else: 50 | self.ui.treeWidget.takeTopLevelItem(7) 51 | 52 | def _getInputFeature(self, model) -> str: 53 | """ 54 | Gets called by addinfo. 55 | If there is only one input feature we return its path, else we return the directory. 56 | """ 57 | if str(model["analysistype"]) == "Predefined subsamples": # multiple in dir 58 | feature = self.tr("{} predefined features in {}").format( 59 | str(model["samplecount"]), os.path.normpath(str(model["featurepath"]))) 60 | elif str(model["analysistype"]) == "On-the-fly subsampling": # multi from original 61 | feature = self.tr("{} subsampled from {}").format( 62 | str(model["samplecount"]), os.path.normpath(str(model["featurepath"]))) 63 | elif str(model["analysistype"]) == "Single sample": 64 | feature = os.path.normpath(str(model["featurepath"])) 65 | return feature 66 | -------------------------------------------------------------------------------- /core/widgets/RasterInfo/rasterInfo_main.py: -------------------------------------------------------------------------------- 1 | # -*- coding: cp1252 -*- 2 | 3 | from osgeo import gdal, ogr, osr, gdalconst 4 | import os 5 | import math 6 | import time 7 | import numpy as np 8 | import webbrowser 9 | import xml.etree.ElementTree as ET 10 | from PyQt5 import QtCore, QtGui, QtWidgets, uic 11 | from PyQt5.QtCore import * 12 | from PyQt5.QtGui import * 13 | from PyQt5.QtWidgets import * 14 | import sys 15 | import os 16 | import logging 17 | 18 | from core.uis.RasterInfo_ui.RasterInfo_ui import Ui_RasterInfo 19 | from core.libs.GDAL_Libs.Layers import Raster 20 | 21 | 22 | class RasterInfo(QMainWindow): 23 | def __init__(self, rasterPath, parent=None): 24 | QMainWindow.__init__(self, parent) 25 | self.ui = Ui_RasterInfo() 26 | self.ui.setupUi(self) 27 | self.setWindowIcon(QIcon(":/icons/Icons/raster_info.png")) 28 | 29 | self.path = rasterPath 30 | self.setWindowTitle(self.tr("Raster info - {}").format(os.path.basename(self.path))) 31 | self.tree = self.ui.treeWidget 32 | self.tree.expandAll() 33 | 34 | self.raster = Raster(self.path) 35 | # set source path 36 | self.populateTopLevelItem(0, self.path) 37 | # set data type 38 | self.populateTopLevelItem(1, self.raster.dataType) 39 | # set Spatial Reference EPSG 40 | self.populateChildItem(2, 0, str(self.raster.epsg)) 41 | # set Spatial Reference Projection 42 | self.populateChildItem(2, 1, str(self.raster.projName)) 43 | # set Extent 44 | self.populateChildItem(3, 0, str(self.raster.extent[3])) 45 | self.populateChildItem(3, 1, str(self.raster.extent[0])) 46 | self.populateChildItem(3, 2, str(self.raster.extent[1])) 47 | self.populateChildItem(3, 3, str(self.raster.extent[2])) 48 | area = self.raster.cols * self.raster.rows * self.raster.cellsize[0]**2 49 | self.populateChildItem(3, 4, str(area)) 50 | # set Dimensions 51 | self.populateChildItem(4, 0, str(self.raster.cols)) 52 | self.populateChildItem(4, 1, str(self.raster.rows)) 53 | 54 | # set Cellsize 55 | self.populateChildItem(5, 0, str(self.raster.cellsize[0])) 56 | self.populateChildItem(5, 1, str(abs(self.raster.cellsize[1]))) 57 | 58 | self.populateChildItem(6, 0, str(self.raster.min)) 59 | self.populateChildItem(6, 1, str(self.raster.max)) 60 | self.populateChildItem(6, 2, str(self.raster.nodata)) 61 | 62 | self.button = QPushButton(self.tr("Details")) 63 | self.button.setFixedWidth(100) 64 | self.button.clicked.connect(self.EPSG_details) 65 | item = QTreeWidgetItem() 66 | child_item = self.tree.topLevelItem(2).addChild(item) 67 | self.tree.setItemWidget(item, 1, self.button) 68 | 69 | def EPSG_details(self): 70 | string = "https://epsg.io/%s" % (str(self.raster.epsg)) 71 | webbrowser.open(string) 72 | 73 | def closeEvent(self, event): 74 | """ 75 | Closes the widget and cleanup data. 76 | :param event: closeEvent 77 | :return: None 78 | """ 79 | if hasattr(self, "raster"): 80 | del self.raster 81 | 82 | def populateTopLevelItem(self, index, text): 83 | item = self.tree.topLevelItem(index) 84 | item.setText(1, text) 85 | 86 | def populateChildItem(self, index_parent, index_child, text): 87 | item = self.tree.topLevelItem(index_parent) 88 | subitem = item.child(index_child) 89 | subitem.setText(1, text) 90 | -------------------------------------------------------------------------------- /core/uis/ResultViewer_ui/ResultsContingencyMatrix_ui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file '.\ResultsContingencyMatrix.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.15.4 6 | # 7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is 8 | # run again. Do not edit this file unless you know what you are doing. 9 | 10 | 11 | from PyQt5 import QtCore, QtGui, QtWidgets 12 | 13 | 14 | class Ui_ContingencyMatrix(object): 15 | def setupUi(self, ContingencyMatrix): 16 | ContingencyMatrix.setObjectName("ContingencyMatrix") 17 | ContingencyMatrix.resize(1000, 750) 18 | ContingencyMatrix.setWindowOpacity(1.0) 19 | self.centralwidget = QtWidgets.QWidget(ContingencyMatrix) 20 | self.centralwidget.setObjectName("centralwidget") 21 | self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget) 22 | self.horizontalLayout.setObjectName("horizontalLayout") 23 | self.mainGridLayout = QtWidgets.QGridLayout() 24 | self.mainGridLayout.setObjectName("mainGridLayout") 25 | self.matrixGroupBox = QtWidgets.QGroupBox(self.centralwidget) 26 | self.matrixGroupBox.setObjectName("matrixGroupBox") 27 | self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.matrixGroupBox) 28 | self.verticalLayout_5.setObjectName("verticalLayout_5") 29 | self.typeComboBox = QtWidgets.QComboBox(self.matrixGroupBox) 30 | self.typeComboBox.setObjectName("typeComboBox") 31 | self.typeComboBox.addItem("") 32 | self.typeComboBox.addItem("") 33 | self.verticalLayout_5.addWidget(self.typeComboBox) 34 | self.label = QtWidgets.QLabel(self.matrixGroupBox) 35 | self.label.setObjectName("label") 36 | self.verticalLayout_5.addWidget(self.label) 37 | self.horizontalLayout_2 = QtWidgets.QHBoxLayout() 38 | self.horizontalLayout_2.setObjectName("horizontalLayout_2") 39 | self.tableView = QtWidgets.QTableView(self.matrixGroupBox) 40 | self.tableView.setObjectName("tableView") 41 | self.horizontalLayout_2.addWidget(self.tableView) 42 | self.verticalLayout_5.addLayout(self.horizontalLayout_2) 43 | self.mainGridLayout.addWidget(self.matrixGroupBox, 0, 0, 1, 1) 44 | self.horizontalLayout.addLayout(self.mainGridLayout) 45 | ContingencyMatrix.setCentralWidget(self.centralwidget) 46 | self.menubar = QtWidgets.QMenuBar(ContingencyMatrix) 47 | self.menubar.setGeometry(QtCore.QRect(0, 0, 1000, 22)) 48 | self.menubar.setObjectName("menubar") 49 | ContingencyMatrix.setMenuBar(self.menubar) 50 | self.statusbar = QtWidgets.QStatusBar(ContingencyMatrix) 51 | self.statusbar.setObjectName("statusbar") 52 | ContingencyMatrix.setStatusBar(self.statusbar) 53 | 54 | self.retranslateUi(ContingencyMatrix) 55 | QtCore.QMetaObject.connectSlotsByName(ContingencyMatrix) 56 | 57 | def retranslateUi(self, ContingencyMatrix): 58 | _translate = QtCore.QCoreApplication.translate 59 | ContingencyMatrix.setWindowTitle(_translate("ContingencyMatrix", "Contingency Matrix")) 60 | self.matrixGroupBox.setTitle(_translate("ContingencyMatrix", "Contingency Matrix ")) 61 | self.typeComboBox.setItemText(0, _translate("ContingencyMatrix", "Pearson\'s C")) 62 | self.typeComboBox.setItemText(1, _translate("ContingencyMatrix", "Cramers\' V")) 63 | self.label.setText(_translate("ContingencyMatrix", "To see details for input pairs, double-click on the corresponding matrix field.")) 64 | -------------------------------------------------------------------------------- /core/uis/GeoViewer_ui/BasicViewer_ui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file '.\BasicViewer.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.15.4 6 | # 7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is 8 | # run again. Do not edit this file unless you know what you are doing. 9 | 10 | 11 | from PyQt5 import QtCore, QtGui, QtWidgets 12 | 13 | 14 | class Ui_Viewer(object): 15 | def setupUi(self, Viewer): 16 | Viewer.setObjectName("Viewer") 17 | Viewer.resize(1138, 798) 18 | self.centralwidget = QtWidgets.QWidget(Viewer) 19 | self.centralwidget.setObjectName("centralwidget") 20 | self.gridLayout_2 = QtWidgets.QGridLayout(self.centralwidget) 21 | self.gridLayout_2.setObjectName("gridLayout_2") 22 | self.mainGridLayout = QtWidgets.QGridLayout() 23 | self.mainGridLayout.setObjectName("mainGridLayout") 24 | self.graphicsView = QtWidgets.QGraphicsView(self.centralwidget) 25 | self.graphicsView.setFocusPolicy(QtCore.Qt.WheelFocus) 26 | self.graphicsView.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) 27 | self.graphicsView.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) 28 | self.graphicsView.setInteractive(True) 29 | self.graphicsView.setDragMode(QtWidgets.QGraphicsView.ScrollHandDrag) 30 | self.graphicsView.setResizeAnchor(QtWidgets.QGraphicsView.AnchorUnderMouse) 31 | self.graphicsView.setRubberBandSelectionMode(QtCore.Qt.ContainsItemShape) 32 | self.graphicsView.setObjectName("graphicsView") 33 | self.mainGridLayout.addWidget(self.graphicsView, 0, 0, 1, 1) 34 | self.gridLayout_2.addLayout(self.mainGridLayout, 0, 0, 1, 1) 35 | Viewer.setCentralWidget(self.centralwidget) 36 | self.statusbar = QtWidgets.QStatusBar(Viewer) 37 | self.statusbar.setObjectName("statusbar") 38 | Viewer.setStatusBar(self.statusbar) 39 | self.toolBar = QtWidgets.QToolBar(Viewer) 40 | self.toolBar.setObjectName("toolBar") 41 | Viewer.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar) 42 | self.actionOpen = QtWidgets.QAction(Viewer) 43 | icon = QtGui.QIcon() 44 | icon.addPixmap(QtGui.QPixmap(".\\../../../../../0_PYTHON_27/3_LSAT_TOOLBOX/ImagePNG/MonteCarlo2.png"), QtGui.QIcon.Normal, QtGui.QIcon.On) 45 | self.actionOpen.setIcon(icon) 46 | self.actionOpen.setIconVisibleInMenu(True) 47 | self.actionOpen.setObjectName("actionOpen") 48 | self.actionExit = QtWidgets.QAction(Viewer) 49 | self.actionExit.setIconVisibleInMenu(False) 50 | self.actionExit.setObjectName("actionExit") 51 | self.actionContent_window = QtWidgets.QAction(Viewer) 52 | self.actionContent_window.setCheckable(True) 53 | self.actionContent_window.setChecked(True) 54 | self.actionContent_window.setObjectName("actionContent_window") 55 | 56 | self.retranslateUi(Viewer) 57 | QtCore.QMetaObject.connectSlotsByName(Viewer) 58 | 59 | def retranslateUi(self, Viewer): 60 | _translate = QtCore.QCoreApplication.translate 61 | Viewer.setWindowTitle(_translate("Viewer", "Geodata Viewer")) 62 | self.toolBar.setWindowTitle(_translate("Viewer", "toolBar")) 63 | self.actionOpen.setText(_translate("Viewer", "Open...")) 64 | self.actionExit.setText(_translate("Viewer", "Exit...")) 65 | self.actionExit.setToolTip(_translate("Viewer", "Close the application")) 66 | self.actionContent_window.setText(_translate("Viewer", "Content window...")) 67 | -------------------------------------------------------------------------------- /core/widgets/ResultViewer/resultViewerLogReg_main.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import sys 3 | import os 4 | from PyQt5.QtWidgets import * 5 | from PyQt5.QtGui import * 6 | from PyQt5.QtCore import * 7 | from core.libs.GDAL_Libs.Layers import Raster 8 | from core.libs.Analysis.BivariateSolver import WofE 9 | from core.uis.ResultViewer_ui.tabbedResultViewer_ui import Ui_tabbedResultViewer 10 | from core.widgets.ResultViewer.shared_resultviewer import shared_resultfunc, TableModel 11 | 12 | 13 | class ResultsForm(QMainWindow): 14 | def __init__(self, path, result, parent=None): 15 | QWidget.__init__(self, parent) 16 | self.ui = Ui_tabbedResultViewer() 17 | self.ui.setupUi(self) 18 | self.setWindowIcon(QIcon(':/icons/Icons/Chart_Bar_Big.png')) 19 | name = os.path.basename(path) 20 | self.setWindowTitle(self.tr("Results - {}").format(name)) 21 | self.tree = self.ui.modelTreeWidget 22 | self.LoadModelData(result, name, path) 23 | self.LoadRasterData(result) 24 | self.tree.expandAll() 25 | self.tree.header().setSectionResizeMode(QHeaderView.ResizeToContents) 26 | self.tree.header().setStretchLastSection(False) 27 | 28 | def LoadModelData(self, result, name, path): 29 | """ 30 | Loads statistics of the final model from the npz file. 31 | """ 32 | self.ui.tabWidget.setTabText(0, name) 33 | 34 | # set source path 35 | shared_resultfunc.setTopLevelItem(self, 0, self.tr("File Path"), path, self.tree) 36 | # set training dataset 37 | shared_resultfunc.setTopLevelItem( 38 | self, 1, self.tr("Training dataset"), str( 39 | result["training_data"]), self.tree) 40 | 41 | # set input data 42 | shared_resultfunc.setTopLevelItem( 43 | self, 2, self.tr("Explanatory variables"), None, self.tree) 44 | for i, value in enumerate(list(result["data_list"])): 45 | rastertype = value[1] 46 | shared_resultfunc.setChildItem( 47 | self, 2, i, rastertype, str( 48 | list( 49 | result["data_list"])[i][0]), self.tree) 50 | 51 | shared_resultfunc.setTopLevelItem(self, 3, self.tr("Model settings"), None, self.tree) 52 | info_settings = ("penalty", "dual", "tol", "c", "fit_intercept", "intercept_scaling", 53 | "class_weight", "random_state", "solver", "max_iter", 54 | "multi_class", "verbose", "warm_start", "n_jobs", "l1_ratio") 55 | for i, value in enumerate(list(result["settings"])): 56 | shared_resultfunc.setChildItem(self, 3, i, info_settings[i], str(value), self.tree) 57 | 58 | shared_resultfunc.setTopLevelItem(self, 4, self.tr("Model metrics"), None, self.tree) 59 | info = (self.tr("Intercept"), self.tr("AIC"), self.tr("BIC"), self.tr("AICc"), self.tr("AUC")) 60 | values = (result["intercept"][0], result["AIC"], result["BIC"], result["AICc"], result["auc"]) 61 | for i, value in enumerate(values): 62 | shared_resultfunc.setChildItem( 63 | self, 4, i, info[i], "{:.5f}".format(value), self.tree, str(value)) 64 | 65 | def LoadRasterData(self, result): 66 | """ 67 | Loads statistics of individual rasters from the npz File. 68 | """ 69 | for i, table in enumerate(result["Statistics"]): 70 | if i != 0: 71 | model = TableModel(table) 72 | tableView = shared_resultfunc.addTabToWidget(self, result["data_list"][i-1][2], self.ui.tabWidget) 73 | tableView.setModel(model) 74 | tableView.resizeColumnsToContents() 75 | -------------------------------------------------------------------------------- /core/uis/Settings_ui/LanguageSettings_ui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file '.\LanguageSettings.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.14.2 6 | # 7 | # WARNING! All changes made in this file will be lost! 8 | 9 | 10 | from PyQt5 import QtCore, QtGui, QtWidgets 11 | 12 | 13 | class Ui_LanguageSettings(object): 14 | def setupUi(self, LanguageSettings): 15 | LanguageSettings.setObjectName("LanguageSettings") 16 | LanguageSettings.resize(280, 125) 17 | self.centralwidget = QtWidgets.QWidget(LanguageSettings) 18 | self.centralwidget.setObjectName("centralwidget") 19 | self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget) 20 | self.horizontalLayout.setObjectName("horizontalLayout") 21 | self.mainGridLayout = QtWidgets.QGridLayout() 22 | self.mainGridLayout.setObjectName("mainGridLayout") 23 | self.languageGroupBox = QtWidgets.QGroupBox(self.centralwidget) 24 | self.languageGroupBox.setObjectName("languageGroupBox") 25 | self.gridLayout = QtWidgets.QGridLayout(self.languageGroupBox) 26 | self.gridLayout.setObjectName("gridLayout") 27 | self.languageGroupBoxGridLayout = QtWidgets.QGridLayout() 28 | self.languageGroupBoxGridLayout.setObjectName("languageGroupBoxGridLayout") 29 | self.applyPushButton = QtWidgets.QPushButton(self.languageGroupBox) 30 | self.applyPushButton.setObjectName("applyPushButton") 31 | self.languageGroupBoxGridLayout.addWidget(self.applyPushButton, 1, 2, 1, 1) 32 | self.cancelPushButton = QtWidgets.QPushButton(self.languageGroupBox) 33 | self.cancelPushButton.setObjectName("cancelPushButton") 34 | self.languageGroupBoxGridLayout.addWidget(self.cancelPushButton, 1, 1, 1, 1) 35 | spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) 36 | self.languageGroupBoxGridLayout.addItem(spacerItem, 1, 0, 1, 1) 37 | self.comboBox = QtWidgets.QComboBox(self.languageGroupBox) 38 | self.comboBox.setObjectName("comboBox") 39 | self.comboBox.addItem("") 40 | self.comboBox.addItem("") 41 | self.languageGroupBoxGridLayout.addWidget(self.comboBox, 0, 0, 1, 2) 42 | self.gridLayout.addLayout(self.languageGroupBoxGridLayout, 0, 0, 1, 1) 43 | self.mainGridLayout.addWidget(self.languageGroupBox, 0, 0, 1, 1) 44 | self.horizontalLayout.addLayout(self.mainGridLayout) 45 | LanguageSettings.setCentralWidget(self.centralwidget) 46 | self.menubar = QtWidgets.QMenuBar(LanguageSettings) 47 | self.menubar.setGeometry(QtCore.QRect(0, 0, 280, 18)) 48 | self.menubar.setObjectName("menubar") 49 | LanguageSettings.setMenuBar(self.menubar) 50 | 51 | self.retranslateUi(LanguageSettings) 52 | QtCore.QMetaObject.connectSlotsByName(LanguageSettings) 53 | LanguageSettings.setTabOrder(self.comboBox, self.cancelPushButton) 54 | LanguageSettings.setTabOrder(self.cancelPushButton, self.applyPushButton) 55 | 56 | def retranslateUi(self, LanguageSettings): 57 | _translate = QtCore.QCoreApplication.translate 58 | LanguageSettings.setWindowTitle(_translate("LanguageSettings", "MainWindow")) 59 | self.languageGroupBox.setTitle(_translate("LanguageSettings", "Select Language")) 60 | self.applyPushButton.setText(_translate("LanguageSettings", "Apply")) 61 | self.cancelPushButton.setText(_translate("LanguageSettings", "Cancel")) 62 | self.comboBox.setItemText(0, _translate("LanguageSettings", "English")) 63 | self.comboBox.setItemText(1, _translate("LanguageSettings", "Deutsch")) 64 | -------------------------------------------------------------------------------- /core/widgets/ResultViewer/shared_resultviewer.py: -------------------------------------------------------------------------------- 1 | from PyQt5.QtWidgets import * 2 | from PyQt5.QtGui import * 3 | from PyQt5.QtCore import * 4 | 5 | 6 | class TableModel(QAbstractTableModel): 7 | """ 8 | Used to display raster specific information for ANN and LR. 9 | """ 10 | 11 | def __init__(self, indata, parent=None, *args): 12 | QAbstractTableModel.__init__(self, parent) 13 | self.indata = indata 14 | self.header = indata.dtype.names 15 | self.dtypes = [self.indata.dtype[i] for i in range(len(self.header))] 16 | 17 | def rowCount(self, QModelIndex_parent=None, *args, **kwargs): 18 | return self.indata.shape[0] 19 | 20 | def columnCount(self, QModelIndex_parent=None, *args, **kwargs): 21 | return len(self.header) 22 | 23 | def data(self, index, int_role=Qt.DisplayRole): 24 | if int_role == Qt.DisplayRole: 25 | i = index.row() 26 | j = index.column() 27 | if "float" in str(self.dtypes[j]): 28 | return '{:.5f}'.format(self.indata[i][j]) 29 | else: 30 | return '{0}'.format(self.indata[i][j]) 31 | else: 32 | return QVariant() 33 | 34 | def headerData(self, section, orientation, role=Qt.DisplayRole): 35 | if role == Qt.DisplayRole and orientation == Qt.Horizontal: 36 | return self.header[section] 37 | return QAbstractTableModel.headerData(self, section, orientation, role) 38 | 39 | 40 | class shared_resultfunc(): 41 | """ 42 | Bundles function used by both ann_resultviewer and resultViewerLogReg_main.py 43 | """ 44 | 45 | def setTopLevelItem(self, index, info, text, tree, tooltip=None): 46 | """ 47 | index = Row of the Item (0 = top) 48 | info = Text to display in first column 49 | text = Text to display in the second column 50 | tree = the modelTreeWidget object to append to 51 | tooltip = Adds a tooltip to the second column, None by default. 52 | Both info and text can be None -> Empty column 53 | """ 54 | font = QFont() 55 | font.setBold(True) 56 | font.setWeight(75) 57 | tree.addTopLevelItem(QTreeWidgetItem(index)) 58 | item = tree.topLevelItem(index) 59 | item.setText(0, info) 60 | item.setText(1, text) 61 | item.setFont(0, font) 62 | if tooltip: 63 | item.setToolTip(1, tooltip) 64 | 65 | def setChildItem(self, index_parent, index_child, info, text, tree, tooltip=None): 66 | """ 67 | index_parent = Row of the parent Item (0 = top) 68 | index_child = Row of the child under the parent 69 | info = Text to display in first column 70 | text = Text to display in the second column 71 | tree = the modelTreeWidget object to append to 72 | tooltip = Adds a tooltip to the second column, None by default. 73 | Both info and text can be None -> Empty column 74 | """ 75 | item = tree.topLevelItem(index_parent) 76 | item.addChild(QTreeWidgetItem(index_child)) 77 | subitem = item.child(index_child) 78 | subitem.setText(0, info) 79 | subitem.setText(1, text) 80 | if tooltip: 81 | subitem.setToolTip(1, tooltip) 82 | 83 | def addTabToWidget(self, name, tabwidget): 84 | """ 85 | name = Name of the new tab 86 | tabwidget = Tabwidget to append to 87 | Adds a QTableView tab to the tab widget. 88 | Returns QTableView object 89 | """ 90 | tab = QWidget() 91 | tabwidget.addTab(tab, name) 92 | tabGridLayout = QGridLayout(tab) 93 | tableView = QTableView() 94 | tableView.setStyleSheet("QHeaderView::section { background-color:#b7cbeb }") 95 | tabGridLayout.addWidget(tableView) 96 | return tableView 97 | -------------------------------------------------------------------------------- /core/uis/ResultViewer_ui/tabbedResultViewerAHP.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | tabbedResultViewerAHP 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1000 10 | 750 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | QTabWidget::Rounded 18 | 19 | 20 | 21 | 22 | 23 | 24 | 0 25 | 26 | 27 | 28 | Seite 29 | 30 | 31 | 32 | 33 | 34 | 0 35 | 36 | 37 | 38 | General Information 39 | 40 | 41 | 42 | 43 | 44 | 45 | Info 46 | 47 | 48 | 49 | 50 | Value 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | Coefficient priorites 60 | 61 | 62 | 63 | 64 | 65 | false 66 | 67 | 68 | 69 | Raster 70 | 71 | 72 | 73 | 74 | Value 75 | 76 | 77 | 78 | 79 | Coefficient Priority 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | Pairwise raster comparison 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /core/widgets/ParameterSelection/ParameterSelection_main.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import os 4 | import sys 5 | from PyQt5 import QtGui, QtCore, QtWidgets 6 | from PyQt5.QtCore import * 7 | from PyQt5.QtGui import * 8 | from PyQt5.QtWidgets import * 9 | from core.libs.Management.LayerManagement import LayerManagement 10 | from core.libs.GDAL_Libs.Layers import RasterLayer 11 | from core.uis.ParameterSelection_ui.ParameterSelection_ui import Ui_ParameterSelection 12 | 13 | 14 | class ParameterSelection(QMainWindow): 15 | apply_clicked = QtCore.pyqtSignal(list) 16 | 17 | def __init__(self, projectLocation=None, parent=None): 18 | QWidget.__init__(self, parent) 19 | self.ui = Ui_ParameterSelection() 20 | self.ui.setupUi(self) 21 | self.setWindowIcon(QIcon(':/icons/Icons/Settings.png')) 22 | self.allchecked = False 23 | self.projectLocation = projectLocation 24 | self.dataPath = os.path.join(self.projectLocation, "data") 25 | self.paramsPath = os.path.join(self.dataPath, "params") 26 | self.tree = self.ui.treeWidget 27 | 28 | self.LM = LayerManagement() 29 | self.tree.itemChanged.connect(self.updateView) 30 | self.getParams() 31 | self.updateView() 32 | 33 | @pyqtSlot() 34 | def on_toggleselectAllLayersPushButton_clicked(self): 35 | """ 36 | Selects/Deselects all layers in the selection tree widget. 37 | :return: None 38 | """ 39 | root = self.tree.invisibleRootItem() 40 | if self.allchecked: 41 | self.ui.toggleselectAllLayersPushButton.setText(self.tr("Select All Layers")) 42 | setto = Qt.Unchecked 43 | else: 44 | self.ui.toggleselectAllLayersPushButton.setText(self.tr("Deselect All Layers")) 45 | setto = Qt.Checked 46 | for i in range(root.childCount()): 47 | item = self.tree.topLevelItem(i) 48 | # We toggle between selecting and unselecting all parameters 49 | item.setCheckState(0, setto) 50 | self.allchecked = not self.allchecked 51 | self.updateView() 52 | 53 | def getParams(self): 54 | """ 55 | Loads list of parameters included in the params folder 56 | to a tree widget for selection. 57 | :return: None 58 | """ 59 | for file_name in os.listdir(self.paramsPath): 60 | baseName = os.path.splitext(file_name)[0] 61 | file_type = os.path.splitext(file_name)[1].lower() 62 | if file_type == ".tif": 63 | self.layer = RasterLayer(os.path.join(self.paramsPath, file_name)) 64 | item = QTreeWidgetItem() 65 | self.LM.addTreeContent(hash(str(item)), self.layer.properties) 66 | item.setText(0, baseName) 67 | item.setCheckState(0, Qt.Unchecked) 68 | self.tree.addTopLevelItem(item) 69 | 70 | def updateView(self): 71 | count = 0 72 | root = self.tree.invisibleRootItem() 73 | for i in range(root.childCount()): 74 | item = self.tree.topLevelItem(i) 75 | if item.checkState(0): 76 | count += 1 77 | else: 78 | count += 0 79 | if count > 0: 80 | self.ui.applyPushButton.setEnabled(1) 81 | else: 82 | self.ui.applyPushButton.setEnabled(0) 83 | 84 | @pyqtSlot() 85 | def on_applyPushButton_clicked(self): 86 | """ 87 | Emits a signal with a list to the paths of the selected rasters. 88 | """ 89 | root = self.tree.invisibleRootItem() 90 | self.selectedLayers = [] 91 | for i in range(root.childCount()): 92 | item = self.tree.topLevelItem(i) 93 | if item.checkState(0): 94 | self.selectedLayers.append((self.LM.treeContent[hash(str(item))]["Source"])) 95 | self.apply_clicked.emit(self.selectedLayers) 96 | self.close() 97 | -------------------------------------------------------------------------------- /core/widgets/ResultViewer/ann_resultviewer.py: -------------------------------------------------------------------------------- 1 | import os 2 | from PyQt5.QtWidgets import * 3 | from PyQt5.QtGui import * 4 | from PyQt5.QtCore import * 5 | from core.uis.ResultViewer_ui.tabbedResultViewer_ui import Ui_tabbedResultViewer 6 | from core.widgets.ResultViewer.shared_resultviewer import shared_resultfunc, TableModel 7 | 8 | 9 | class ann_resultviewer(QMainWindow): 10 | def __init__(self, projectlocation, filelocation, numpyfile): 11 | """ 12 | numpyfile already is the handle. 13 | """ 14 | super().__init__() 15 | # ui 16 | self.ui = Ui_tabbedResultViewer() 17 | self.ui.setupUi(self) 18 | self.setWindowIcon(QIcon(':/icons/Icons/Chart_Bar_Big.png')) 19 | self.setWindowTitle(self.tr("Results - {}").format(os.path.basename(filelocation))) 20 | self.loadModelData(numpyfile, os.path.basename(filelocation), filelocation) 21 | self.ui.modelTreeWidget.expandAll() 22 | self.ui.modelTreeWidget.header().setSectionResizeMode(QHeaderView.ResizeToContents) 23 | self.ui.modelTreeWidget.header().setStretchLastSection(False) 24 | self.loadRasterData(numpyfile) 25 | 26 | def loadModelData(self, npfile, name, path): 27 | """ 28 | Loads statistics of the resulting model from the npz file. 29 | """ 30 | self.ui.tabWidget.setTabText(0, name) 31 | # path to npz file 32 | shared_resultfunc.setTopLevelItem( 33 | self, 0, self.tr("File Path"), path, self.ui.modelTreeWidget) 34 | # path to used feature file 35 | shared_resultfunc.setTopLevelItem( 36 | self, 1, self.tr("Training dataset"), str( 37 | npfile["featurePath"]), self.ui.modelTreeWidget) 38 | # amount of and paths to used rasters (data_list is best explained in rpw_main.py) 39 | shared_resultfunc.setTopLevelItem(self, 2, self.tr("Explanatory variables"), str( 40 | len(npfile["data_list"])), self.ui.modelTreeWidget) 41 | for i, raster in enumerate(npfile["data_list"]): 42 | rastertype = raster[1] 43 | shared_resultfunc.setChildItem( 44 | self, 2, i, rastertype, raster[0], self.ui.modelTreeWidget) 45 | # sklearn Settings 46 | shared_resultfunc.setTopLevelItem(self, 3, self.tr( 47 | "Model settings"), None, self.ui.modelTreeWidget) 48 | paras = ("hidden_layer_sizes", "activation", "solver", "alpha", "batch_size", 49 | "learning_rate", "learning_rate_init", "power_t", "max_iter", "shuffle", 50 | "random_state", "tol", "verbose", "warm_start", "momentum", "nesterovs_momentum", 51 | "early_stopping", "validation_fraction", "beta_1", "beta_2", "epsilon", 52 | "n_iter_no_change", "max_fun") 53 | for i, para in enumerate(paras): 54 | shared_resultfunc.setChildItem(self, 3, i, para, str( 55 | npfile["settings"][i]), self.ui.modelTreeWidget) 56 | # Model metrics 57 | shared_resultfunc.setTopLevelItem(self, 4, self.tr( 58 | "Model metrics"), None, self.ui.modelTreeWidget) 59 | shared_resultfunc.setChildItem( 60 | self, 4, 0, self.tr("AUC"), "{:.5f}".format( 61 | npfile["auc"]), self.ui.modelTreeWidget, str( 62 | npfile["auc"])) 63 | shared_resultfunc.setChildItem( 64 | self, 4, 1, self.tr("Score"), "{:.5f}".format( 65 | npfile["score"]), self.ui.modelTreeWidget, str( 66 | npfile["score"])) 67 | 68 | def loadRasterData(self, npfile): 69 | """ 70 | Adds a new tab for each raster and adds information. 71 | """ 72 | for i, table in enumerate(npfile["Statistics"]): 73 | if i != 0: 74 | model = TableModel(table) 75 | tableView = shared_resultfunc.addTabToWidget(self, npfile["data_list"][i - 1][2], self.ui.tabWidget) 76 | tableView.setModel(model) 77 | tableView.resizeColumnsToContents() 78 | -------------------------------------------------------------------------------- /core/uis/ResultViewer_ui/resultsViewerWofE_ui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file '.\resultsViewerWofE.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.15.4 6 | # 7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is 8 | # run again. Do not edit this file unless you know what you are doing. 9 | 10 | 11 | from PyQt5 import QtCore, QtGui, QtWidgets 12 | 13 | 14 | class Ui_MainWindow(object): 15 | def setupUi(self, MainWindow): 16 | MainWindow.setObjectName("MainWindow") 17 | MainWindow.resize(1000, 700) 18 | self.centralwidget = QtWidgets.QWidget(MainWindow) 19 | self.centralwidget.setObjectName("centralwidget") 20 | self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget) 21 | self.horizontalLayout.setObjectName("horizontalLayout") 22 | self.mainGridLayout = QtWidgets.QGridLayout() 23 | self.mainGridLayout.setObjectName("mainGridLayout") 24 | self.tabWidget = QtWidgets.QTabWidget(self.centralwidget) 25 | self.tabWidget.setObjectName("tabWidget") 26 | self.tab = QtWidgets.QWidget() 27 | self.tab.setObjectName("tab") 28 | self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.tab) 29 | self.horizontalLayout_3.setObjectName("horizontalLayout_3") 30 | self.modelTreeWidget = QtWidgets.QTreeWidget(self.tab) 31 | self.modelTreeWidget.setObjectName("modelTreeWidget") 32 | self.horizontalLayout_3.addWidget(self.modelTreeWidget) 33 | self.tabWidget.addTab(self.tab, "") 34 | self.tableTab = QtWidgets.QWidget() 35 | self.tableTab.setObjectName("tableTab") 36 | self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.tableTab) 37 | self.horizontalLayout_2.setObjectName("horizontalLayout_2") 38 | self.tableTabGridLayout = QtWidgets.QGridLayout() 39 | self.tableTabGridLayout.setObjectName("tableTabGridLayout") 40 | self.horizontalLayout_2.addLayout(self.tableTabGridLayout) 41 | self.tabWidget.addTab(self.tableTab, "") 42 | self.graphicsTab = QtWidgets.QWidget() 43 | self.graphicsTab.setObjectName("graphicsTab") 44 | self.verticalLayout = QtWidgets.QVBoxLayout(self.graphicsTab) 45 | self.verticalLayout.setObjectName("verticalLayout") 46 | self.graphicsTabGridLayout = QtWidgets.QGridLayout() 47 | self.graphicsTabGridLayout.setObjectName("graphicsTabGridLayout") 48 | self.verticalLayout.addLayout(self.graphicsTabGridLayout) 49 | self.tabWidget.addTab(self.graphicsTab, "") 50 | self.mainGridLayout.addWidget(self.tabWidget, 0, 0, 1, 1) 51 | self.horizontalLayout.addLayout(self.mainGridLayout) 52 | MainWindow.setCentralWidget(self.centralwidget) 53 | self.menubar = QtWidgets.QMenuBar(MainWindow) 54 | self.menubar.setGeometry(QtCore.QRect(0, 0, 1000, 22)) 55 | self.menubar.setObjectName("menubar") 56 | MainWindow.setMenuBar(self.menubar) 57 | self.statusbar = QtWidgets.QStatusBar(MainWindow) 58 | self.statusbar.setObjectName("statusbar") 59 | MainWindow.setStatusBar(self.statusbar) 60 | self.toolBar = QtWidgets.QToolBar(MainWindow) 61 | self.toolBar.setObjectName("toolBar") 62 | MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar) 63 | 64 | self.retranslateUi(MainWindow) 65 | self.tabWidget.setCurrentIndex(0) 66 | QtCore.QMetaObject.connectSlotsByName(MainWindow) 67 | 68 | def retranslateUi(self, MainWindow): 69 | _translate = QtCore.QCoreApplication.translate 70 | MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) 71 | self.modelTreeWidget.headerItem().setText(0, _translate("MainWindow", "Info")) 72 | self.modelTreeWidget.headerItem().setText(1, _translate("MainWindow", "Value")) 73 | self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "Seite")) 74 | self.tabWidget.setTabText(self.tabWidget.indexOf(self.tableTab), _translate("MainWindow", "Table")) 75 | self.tabWidget.setTabText(self.tabWidget.indexOf(self.graphicsTab), _translate("MainWindow", "Graphics")) 76 | self.toolBar.setWindowTitle(_translate("MainWindow", "toolBar")) 77 | -------------------------------------------------------------------------------- /core/uis/LookupRaster_ui/LookupRaster.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | LookupRaster 4 | 5 | 6 | 7 | 0 8 | 0 9 | 530 10 | 250 11 | 12 | 13 | 14 | Lookup 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | Raster 24 | 25 | 26 | 27 | 28 | 29 | 30 | ... 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | Lookup Fields 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | Qt::Horizontal 51 | 52 | 53 | 54 | 40 55 | 20 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | Append attribute table 64 | 65 | 66 | true 67 | 68 | 69 | 70 | 71 | 72 | 73 | Output lookup raster 74 | 75 | 76 | 77 | 78 | 79 | 80 | ... 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | Apply 91 | 92 | 93 | 94 | 95 | 96 | 97 | Cancel 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 0 109 | 0 110 | 530 111 | 22 112 | 113 | 114 | 115 | 116 | 117 | 118 | rasterComboBox 119 | rasterToolButton 120 | lookupFieldComboBox 121 | ratCheckBox 122 | outRasterLineEdit 123 | outRasterToolButton 124 | cancelPushButton 125 | applyPushButton 126 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # LSAT 2 | 3 | 4 | [![DOI](https://zenodo.org/badge/386274608.svg)](https://zenodo.org/badge/latestdoi/386274608) 5 | 6 | LSAT PM (Landslide Susceptibility Assessment Tools Project Manager Suite) was primarily developed to conduct landslide susceptibility analyses, it is not limited to this issue and applies to any other research dealing with supervised spatial binary classification. 7 | We tested LSAT on Windows and Linux (Ubuntu 20.04). LSAT uses Python3 and great packages like PyQt5, sklearn and GDAL. 8 | 9 | LSAT aims to be an easy to use Toolkit. Giving the user more time to focus on their research instead of the inner workings of the tools they use. 10 | 11 | ## How to run LSAT 12 | 13 | The easiest way to run LSAT on Windows is to download the most recent installer [here](https://github.com/BGR-EGHA/LSAT/releases). 14 | 15 | ### Running LSAT from source on Windows 16 | 17 | 1. Make sure you have Python 3 installed (3.10 tested), if not you can get it from [python.org/downloads](https://www.python.org/downloads/). 18 | 2. Download LSAT 19 | 3. Navigate to the LSAT directory and open a PowerShell window (if you downloaded a zipped version you will need to unzip LSAT first). 20 | 4. Create a virtual environment 21 | ``` 22 | python -m venv venv 23 | ``` 24 | 5. Activate the virtual environment (venv should appear in the command line, indicating you were successful) 25 | ``` 26 | .\venv\Scripts\activate 27 | ``` 28 | 6. Install the required packages 29 | ``` 30 | python -m pip install -r requirements.txt 31 | ``` 32 | Additionally to the packages listed in the requirements.txt you will need GDAL (3.6.1 tested). 33 | Unfortunately, GDAL can usually not simply be installed with a pip command. 34 | You can either download a .whl file from [Christoph Gohlkes fantastic repository](https://github.com/cgohlke/geospatial.whl/releases) or 35 | build it yourself. 36 | Installing a .whl file: 37 | ``` 38 | python -m pip install *path to .whl file* 39 | ``` 40 | 41 | 7. Start LSAT PM 42 | ``` 43 | python startMenu_main.py 44 | ``` 45 | 46 | After the initial setup you just need to open the powershell window, activate the venv and start 47 | LSAT PM to run it. 48 | 49 | ### Running LSAT from source on Linux (Ubuntu 20.04.3 tested) 50 | 51 | 1. Download LSAT 52 | 2. Navigate to the LSAT directory and open a Terminal (if you downloaded a zipped version you will need to extract LSAT first). 53 | 3. Install Python packages (venv, pip, python development tools), gdal and libraries for Qt 54 | ``` 55 | sudo apt install python3-venv python3-pip gdal-bin libgdal-dev python3-dev '^libxcb.*-dev' 56 | ``` 57 | 58 | 4. Create a virtual environment 59 | ``` 60 | python3 -m venv venv 61 | ``` 62 | 63 | 5. Activate the virtual environment (venv should appear in the command line, indicating you were successful) 64 | ``` 65 | source venv/bin/activate 66 | ``` 67 | 68 | 6. Install the required packages 69 | ``` 70 | python3 -m pip install -r requirements.txt 71 | ``` 72 | Additionally to the packages listed in the requirements.txt you will need GDAL (3.0.4 tested). 73 | Unfortunately, GDAL can usually not simply be installed with the standard pip command. 74 | You need to specify the version based on the gdal version installed. 75 | To get the installed version run 76 | ``` 77 | ogrinfo --version 78 | ``` 79 | It will output something like: "GDAL $VERSION, released $RELEASEDATE". Now install that version 80 | ``` 81 | python3 -m pip install gdal==$VERSION 82 | ``` 83 | 84 | 7. Start LSAT PM 85 | ``` 86 | python3 startMenu_main.py 87 | ``` 88 | 89 | After the initial setup you just need to open a terminal, activate the venv and start 90 | LSAT PM to run it. 91 | 92 | ## Documentation 93 | 94 | All windows installers come with documentation. 95 | Alternatively you can find the current documentation and documentation for older releases 96 | (see releases) [here](https://github.com/BGR-EGHA/LSAT-Documentation). 97 | An online version of the documentation is available on [readthedocs.io](https://lsat-documentation.readthedocs.io/en/latest/). 98 | 99 | ## Test dataset 100 | 101 | We offer a test dataset to try out LSAT [here](https://github.com/BGR-EGHA/LSAT-TestData). 102 | 103 | ## License 104 | 105 | Distributed under the GPLv3 License, see LICENSE.txt. 106 | 107 | ## Feedback 108 | 109 | Bug reports are welcome! Please use GitHub issues to report bugs. 110 | -------------------------------------------------------------------------------- /core/uis/FeatureInfo_ui/FeatureInfo.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | FeatureInfo 4 | 5 | 6 | 7 | 0 8 | 0 9 | 700 10 | 600 11 | 12 | 13 | 14 | Feature Info 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 150 24 | 25 | 26 | true 27 | 28 | 29 | 30 | Info 31 | 32 | 33 | 34 | 35 | Value 36 | 37 | 38 | 39 | 40 | Source path 41 | 42 | 43 | 44 | 75 45 | true 46 | 47 | 48 | 49 | 50 | 51 | Type 52 | 53 | 54 | 55 | 75 56 | true 57 | 58 | 59 | 60 | 61 | 62 | Feature count 63 | 64 | 65 | 66 | 75 67 | true 68 | 69 | 70 | 71 | 72 | 73 | Fields 74 | 75 | 76 | 77 | 75 78 | true 79 | 80 | 81 | 82 | 83 | 84 | Spatial Reference 85 | 86 | 87 | 88 | 75 89 | true 90 | 91 | 92 | 93 | 94 | EPSG Code 95 | 96 | 97 | 98 | 99 | Projection 100 | 101 | 102 | 103 | 104 | 105 | Extent 106 | 107 | 108 | 109 | 75 110 | true 111 | 112 | 113 | 114 | 115 | top 116 | 117 | 118 | 119 | 120 | left 121 | 122 | 123 | 124 | 125 | right 126 | 127 | 128 | 129 | 130 | bottom 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 0 144 | 0 145 | 700 146 | 22 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /core/uis/Geoprocessing_ui/FlowDirection_ui.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 379 10 | 268 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | Output 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | Output raster 35 | 36 | 37 | 38 | 39 | 40 | 41 | ... 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | Input 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | DEM raster 62 | 63 | 64 | 65 | 66 | 67 | 68 | ... 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | Qt::Horizontal 84 | 85 | 86 | 87 | 40 88 | 20 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | OK 97 | 98 | 99 | 100 | 101 | 102 | 103 | Cancel 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 0 115 | 0 116 | 379 117 | 21 118 | 119 | 120 | 121 | 122 | 123 | 124 | demRasterComboBox 125 | demRasterToolButton 126 | outputRasterLineEdit 127 | outputRasterToolButton 128 | okPushButton 129 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /core/uis/Geoprocessing_ui/SimpleGUI.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | SimpleGUI 4 | 5 | 6 | 7 | 0 8 | 0 9 | 500 10 | 250 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | OK 24 | 25 | 26 | 27 | 28 | 29 | 30 | Qt::Horizontal 31 | 32 | 33 | 34 | 40 35 | 20 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | Input 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | DEM raster 52 | 53 | 54 | 55 | 56 | 57 | 58 | ... 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | Output 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | Output raster 85 | 86 | 87 | 88 | 89 | 90 | 91 | ... 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | Cancel 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 0 115 | 0 116 | 500 117 | 21 118 | 119 | 120 | 121 | 122 | 123 | 124 | demRasterComboBox 125 | demRasterToolButton 126 | outputRasterLineEdit 127 | outputRasterToolButton 128 | cancelPushButton 129 | okPushButton 130 | 131 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /core/libs/LSAT_Messages/messages_main.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from PyQt5 import QtCore, QtGui, QtWidgets 4 | from PyQt5.QtCore import * 5 | from PyQt5.QtGui import * 6 | from PyQt5.QtWidgets import * 7 | 8 | import sys 9 | import os 10 | import logging 11 | 12 | 13 | class Messenger(QMainWindow): 14 | def __init__(self, parent=None): 15 | QWidget.__init__(self, parent) 16 | self.setWindowIcon(QIcon(':/icons/Icons/News.png')) 17 | 18 | def AnalysisCompleted(self): 19 | QMessageBox.information(self, self.tr("Analysis completed!"), 20 | self.tr("Analysis successfully completed!")) 21 | 22 | def WarningOverwriteFile(self): 23 | msg = QMessageBox.warning(self, 24 | self.tr(u"Specified path already exists!"), 25 | self.tr("The file will be overwritten"), 26 | QMessageBox.Ok | QMessageBox.Cancel) 27 | return msg 28 | 29 | def WarningMissingInput(self): 30 | QMessageBox.warning(self, self.tr("Missing input data!"), 31 | self.tr("Please provide inputs to proceed!")) 32 | 33 | def WarningSelect(self): 34 | QMessageBox.warning(self, self.tr("No data selected"), 35 | self.tr("Please select an item to proceed!"), 36 | QtGui.QMessageBox.Ok) 37 | 38 | def InfoExportData(self, output): 39 | QMessageBox.information(self, self.tr("Data successfuly exported!"), 40 | self.tr("Data has been exported to {}!").format(str(output))) 41 | 42 | def InformationConfigurationCompleted(self): 43 | QMessageBox.information(self, self.tr("Settings completed!"), self.tr( 44 | "The settings will be active after restart of the application!")) 45 | 46 | def ErrorDataLoad(self): 47 | QMessageBox.critical(self, self.tr("Failed to load data!"), 48 | self.tr("Failed to open the dataset!")) 49 | 50 | def ErrorLoadProject(self): 51 | QMessageBox.critical(None, self.tr("Failed to load project!"), 52 | self.tr("No metadata! No metadata file found in project directory!")) 53 | 54 | def WarningOnDeleteBasicFile(self): 55 | QMessageBox.warning(self, self.tr("Basic file alert!"), 56 | self.tr("This file cannot be deleted!")) 57 | 58 | def WarningMissingInputs_Project(self): 59 | QMessageBox.warning(self, self.tr("No Project loaded!"), 60 | self.tr("Please create or open an existing project to proceed!")) 61 | 62 | def InfoBoxAnalysisCompleted(self, output): 63 | QMessageBox.information(self, self.tr("Analysis completed!"), 64 | self.tr("Output raster {} is created!".format(str(output)))) 65 | 66 | def ErrorDeleteFile(self): 67 | QMessageBox.critical(self, self.tr("Failed to delete file!"), self.tr( 68 | "Failed to delete file! The file is probably used by another app. Otherwise check permission!")) 69 | 70 | def getLoggingInfo(self, info): 71 | logging.info(info) 72 | 73 | def getLoggingDebug(self, debug): 74 | logging.debug(debug) 75 | 76 | def getLoggingInfoProjectCreated(self, projectLocation): 77 | logging.info(self.tr("Session start. New Project in: {} created").format(projectLocation)) 78 | 79 | def getLoggingInfoOnLoadingProject(self, projectLocation): 80 | logging.info(self.tr("Session start. Loaded Project: {}").format(projectLocation)) 81 | 82 | def getLoggingInfoOnApplicationStart(self, action): 83 | app_name = action.text() 84 | logging.info(self.tr("{} launched! Waiting for input...").format(app_name)) 85 | 86 | def getLoggingInfoOnAnalysisCompleted(self): 87 | logging.info(self.tr("Analysis completed!")) 88 | 89 | def getLoggingInfoOnUserCancelation(self): 90 | logging.info(self.tr("Analysis canceled by user!")) 91 | 92 | def getLoggingInfoDatasetRemoved(self, fileName): 93 | logging.info(self.tr("Dataset {} removed").format(fileName)) 94 | 95 | def WarningMSOfficePackage(self): 96 | QMessageBox.warning(self, self.tr("Operation failed!"), self.tr( 97 | "Could not launch MS Office! Check if MS Office is installed on your PC.")) 98 | 99 | def WarningDataReprojection(self): 100 | QMessageBox.warning(self, self.tr("Dataset does not match the project settings!"), 101 | self.tr("Input data will be reprojected!")) 102 | 103 | def InfoCompletedDataImport(self): 104 | QMessageBox.information(self, self.tr("Successfully completed!"), 105 | self.tr("All data sets have been imported!")) 106 | -------------------------------------------------------------------------------- /core/uis/ResultViewer_ui/ResultsPairDetails_ui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file '.\ResultsPairDetails.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.15.4 6 | # 7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is 8 | # run again. Do not edit this file unless you know what you are doing. 9 | 10 | 11 | from PyQt5 import QtCore, QtGui, QtWidgets 12 | 13 | 14 | class Ui_ContingencyResults(object): 15 | def setupUi(self, ContingencyResults): 16 | ContingencyResults.setObjectName("ContingencyResults") 17 | ContingencyResults.resize(1000, 750) 18 | self.centralwidget = QtWidgets.QWidget(ContingencyResults) 19 | self.centralwidget.setObjectName("centralwidget") 20 | self.horizontalLayout_6 = QtWidgets.QHBoxLayout(self.centralwidget) 21 | self.horizontalLayout_6.setObjectName("horizontalLayout_6") 22 | self.horizontalLayout_5 = QtWidgets.QHBoxLayout() 23 | self.horizontalLayout_5.setObjectName("horizontalLayout_5") 24 | self.mainTabWidget = QtWidgets.QTabWidget(self.centralwidget) 25 | self.mainTabWidget.setObjectName("mainTabWidget") 26 | self.frequencyTab = QtWidgets.QWidget() 27 | self.frequencyTab.setObjectName("frequencyTab") 28 | self.horizontalLayout = QtWidgets.QHBoxLayout(self.frequencyTab) 29 | self.horizontalLayout.setObjectName("horizontalLayout") 30 | self.frequencyTabGridLayout = QtWidgets.QGridLayout() 31 | self.frequencyTabGridLayout.setObjectName("frequencyTabGridLayout") 32 | self.frequencyTableView = QtWidgets.QTableView(self.frequencyTab) 33 | self.frequencyTableView.setObjectName("frequencyTableView") 34 | self.frequencyTabGridLayout.addWidget(self.frequencyTableView, 0, 0, 1, 1) 35 | self.horizontalLayout.addLayout(self.frequencyTabGridLayout) 36 | self.mainTabWidget.addTab(self.frequencyTab, "") 37 | self.chi2Tab = QtWidgets.QWidget() 38 | self.chi2Tab.setObjectName("chi2Tab") 39 | self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.chi2Tab) 40 | self.horizontalLayout_2.setObjectName("horizontalLayout_2") 41 | self.chi2TabGridLayout = QtWidgets.QGridLayout() 42 | self.chi2TabGridLayout.setObjectName("chi2TabGridLayout") 43 | self.chi2TableView = QtWidgets.QTableView(self.chi2Tab) 44 | self.chi2TableView.setObjectName("chi2TableView") 45 | self.chi2TabGridLayout.addWidget(self.chi2TableView, 0, 0, 1, 1) 46 | self.horizontalLayout_2.addLayout(self.chi2TabGridLayout) 47 | self.mainTabWidget.addTab(self.chi2Tab, "") 48 | self.phiTab = QtWidgets.QWidget() 49 | self.phiTab.setObjectName("phiTab") 50 | self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.phiTab) 51 | self.horizontalLayout_3.setObjectName("horizontalLayout_3") 52 | self.phiTabGridLayout = QtWidgets.QGridLayout() 53 | self.phiTabGridLayout.setObjectName("phiTabGridLayout") 54 | self.phiTableView = QtWidgets.QTableView(self.phiTab) 55 | self.phiTableView.setObjectName("phiTableView") 56 | self.phiTabGridLayout.addWidget(self.phiTableView, 0, 0, 1, 1) 57 | self.horizontalLayout_3.addLayout(self.phiTabGridLayout) 58 | self.mainTabWidget.addTab(self.phiTab, "") 59 | self.horizontalLayout_5.addWidget(self.mainTabWidget) 60 | self.horizontalLayout_6.addLayout(self.horizontalLayout_5) 61 | ContingencyResults.setCentralWidget(self.centralwidget) 62 | self.menubar = QtWidgets.QMenuBar(ContingencyResults) 63 | self.menubar.setGeometry(QtCore.QRect(0, 0, 1000, 22)) 64 | self.menubar.setObjectName("menubar") 65 | ContingencyResults.setMenuBar(self.menubar) 66 | self.statusbar = QtWidgets.QStatusBar(ContingencyResults) 67 | self.statusbar.setObjectName("statusbar") 68 | ContingencyResults.setStatusBar(self.statusbar) 69 | 70 | self.retranslateUi(ContingencyResults) 71 | self.mainTabWidget.setCurrentIndex(2) 72 | QtCore.QMetaObject.connectSlotsByName(ContingencyResults) 73 | ContingencyResults.setTabOrder(self.mainTabWidget, self.frequencyTableView) 74 | ContingencyResults.setTabOrder(self.frequencyTableView, self.chi2TableView) 75 | ContingencyResults.setTabOrder(self.chi2TableView, self.phiTableView) 76 | 77 | def retranslateUi(self, ContingencyResults): 78 | _translate = QtCore.QCoreApplication.translate 79 | ContingencyResults.setWindowTitle(_translate("ContingencyResults", "Results - Contingency Analysis")) 80 | self.mainTabWidget.setTabText(self.mainTabWidget.indexOf(self.frequencyTab), _translate("ContingencyResults", "Frequency table")) 81 | self.mainTabWidget.setTabText(self.mainTabWidget.indexOf(self.chi2Tab), _translate("ContingencyResults", "X²")) 82 | self.mainTabWidget.setTabText(self.mainTabWidget.indexOf(self.phiTab), _translate("ContingencyResults", "Phi (2x2)")) 83 | -------------------------------------------------------------------------------- /core/uis/FeatureInfo_ui/FeatureInfo_ui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file '.\FeatureInfo.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.15.4 6 | # 7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is 8 | # run again. Do not edit this file unless you know what you are doing. 9 | 10 | 11 | from PyQt5 import QtCore, QtGui, QtWidgets 12 | 13 | 14 | class Ui_FeatureInfo(object): 15 | def setupUi(self, FeatureInfo): 16 | FeatureInfo.setObjectName("FeatureInfo") 17 | FeatureInfo.resize(700, 600) 18 | self.centralwidget = QtWidgets.QWidget(FeatureInfo) 19 | self.centralwidget.setObjectName("centralwidget") 20 | self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget) 21 | self.horizontalLayout.setObjectName("horizontalLayout") 22 | self.mainGridLayout = QtWidgets.QGridLayout() 23 | self.mainGridLayout.setObjectName("mainGridLayout") 24 | self.treeWidget = QtWidgets.QTreeWidget(self.centralwidget) 25 | self.treeWidget.setObjectName("treeWidget") 26 | item_0 = QtWidgets.QTreeWidgetItem(self.treeWidget) 27 | font = QtGui.QFont() 28 | font.setBold(True) 29 | font.setWeight(75) 30 | item_0.setFont(0, font) 31 | item_0 = QtWidgets.QTreeWidgetItem(self.treeWidget) 32 | font = QtGui.QFont() 33 | font.setBold(True) 34 | font.setWeight(75) 35 | item_0.setFont(0, font) 36 | item_0 = QtWidgets.QTreeWidgetItem(self.treeWidget) 37 | font = QtGui.QFont() 38 | font.setBold(True) 39 | font.setWeight(75) 40 | item_0.setFont(0, font) 41 | item_0 = QtWidgets.QTreeWidgetItem(self.treeWidget) 42 | font = QtGui.QFont() 43 | font.setBold(True) 44 | font.setWeight(75) 45 | item_0.setFont(0, font) 46 | item_0 = QtWidgets.QTreeWidgetItem(self.treeWidget) 47 | font = QtGui.QFont() 48 | font.setBold(True) 49 | font.setWeight(75) 50 | item_0.setFont(0, font) 51 | item_1 = QtWidgets.QTreeWidgetItem(item_0) 52 | item_1 = QtWidgets.QTreeWidgetItem(item_0) 53 | item_0 = QtWidgets.QTreeWidgetItem(self.treeWidget) 54 | font = QtGui.QFont() 55 | font.setBold(True) 56 | font.setWeight(75) 57 | item_0.setFont(0, font) 58 | item_1 = QtWidgets.QTreeWidgetItem(item_0) 59 | item_1 = QtWidgets.QTreeWidgetItem(item_0) 60 | item_1 = QtWidgets.QTreeWidgetItem(item_0) 61 | item_1 = QtWidgets.QTreeWidgetItem(item_0) 62 | self.treeWidget.header().setDefaultSectionSize(150) 63 | self.treeWidget.header().setHighlightSections(True) 64 | self.mainGridLayout.addWidget(self.treeWidget, 0, 0, 1, 1) 65 | self.horizontalLayout.addLayout(self.mainGridLayout) 66 | FeatureInfo.setCentralWidget(self.centralwidget) 67 | self.menubar = QtWidgets.QMenuBar(FeatureInfo) 68 | self.menubar.setGeometry(QtCore.QRect(0, 0, 700, 22)) 69 | self.menubar.setObjectName("menubar") 70 | FeatureInfo.setMenuBar(self.menubar) 71 | self.statusbar = QtWidgets.QStatusBar(FeatureInfo) 72 | self.statusbar.setObjectName("statusbar") 73 | FeatureInfo.setStatusBar(self.statusbar) 74 | 75 | self.retranslateUi(FeatureInfo) 76 | QtCore.QMetaObject.connectSlotsByName(FeatureInfo) 77 | 78 | def retranslateUi(self, FeatureInfo): 79 | _translate = QtCore.QCoreApplication.translate 80 | FeatureInfo.setWindowTitle(_translate("FeatureInfo", "Feature Info")) 81 | self.treeWidget.headerItem().setText(0, _translate("FeatureInfo", "Info")) 82 | self.treeWidget.headerItem().setText(1, _translate("FeatureInfo", "Value")) 83 | __sortingEnabled = self.treeWidget.isSortingEnabled() 84 | self.treeWidget.setSortingEnabled(False) 85 | self.treeWidget.topLevelItem(0).setText(0, _translate("FeatureInfo", "Source path")) 86 | self.treeWidget.topLevelItem(1).setText(0, _translate("FeatureInfo", "Type")) 87 | self.treeWidget.topLevelItem(2).setText(0, _translate("FeatureInfo", "Feature count")) 88 | self.treeWidget.topLevelItem(3).setText(0, _translate("FeatureInfo", "Fields")) 89 | self.treeWidget.topLevelItem(4).setText(0, _translate("FeatureInfo", "Spatial Reference")) 90 | self.treeWidget.topLevelItem(4).child(0).setText(0, _translate("FeatureInfo", "EPSG Code")) 91 | self.treeWidget.topLevelItem(4).child(1).setText(0, _translate("FeatureInfo", "Projection")) 92 | self.treeWidget.topLevelItem(5).setText(0, _translate("FeatureInfo", "Extent")) 93 | self.treeWidget.topLevelItem(5).child(0).setText(0, _translate("FeatureInfo", "top")) 94 | self.treeWidget.topLevelItem(5).child(1).setText(0, _translate("FeatureInfo", "left")) 95 | self.treeWidget.topLevelItem(5).child(2).setText(0, _translate("FeatureInfo", "right")) 96 | self.treeWidget.topLevelItem(5).child(3).setText(0, _translate("FeatureInfo", "bottom")) 97 | self.treeWidget.setSortingEnabled(__sortingEnabled) 98 | -------------------------------------------------------------------------------- /core/uis/ModelBuilder_ui/ExpressionBuilder.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ExpressionBuilder 4 | 5 | 6 | 7 | 0 8 | 0 9 | 682 10 | 676 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | Operators 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | All 34 | 35 | 36 | 37 | 38 | Trigonometric 39 | 40 | 41 | 42 | 43 | Hyperbolic 44 | 45 | 46 | 47 | 48 | Rounding 49 | 50 | 51 | 52 | 53 | Sums, products, differences 54 | 55 | 56 | 57 | 58 | Exponents and logarithms 59 | 60 | 61 | 62 | 63 | Arithmetic 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | Expression 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | Apply 88 | 89 | 90 | 91 | 92 | 93 | 94 | Qt::Horizontal 95 | 96 | 97 | 98 | 40 99 | 20 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | Cancel 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | Layers 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 0 138 | 0 139 | 682 140 | 26 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /core/uis/Geoprocessing_ui/FlowAccumulation_ui.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 379 10 | 309 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | Output 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | Output flow accumulation raster 35 | 36 | 37 | 38 | 39 | 40 | 41 | ... 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | Input 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | Flow direction raster 62 | 63 | 64 | 65 | 66 | 67 | 68 | ... 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | DEM raster 82 | 83 | 84 | 85 | 86 | 87 | 88 | ... 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | Qt::Horizontal 101 | 102 | 103 | 104 | 40 105 | 20 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | Cancel 114 | 115 | 116 | 117 | 118 | 119 | 120 | OK 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 0 132 | 0 133 | 379 134 | 21 135 | 136 | 137 | 138 | 139 | 140 | 141 | flowDirRasterComboBox 142 | flowDirRasterToolButton 143 | demRasterComboBox 144 | demRasterToolButton 145 | outputRasterLineEdit 146 | outputRasterToolButton 147 | 148 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /core/widgets/ResultViewer/resultViewerWofE_main.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from osgeo import gdal, ogr, osr, gdalconst 4 | import sys 5 | import os 6 | import math 7 | import time 8 | import numpy as np 9 | from openpyxl import Workbook 10 | from PyQt5 import QtCore, QtGui, QtWidgets 11 | from PyQt5.QtWidgets import * 12 | from PyQt5.QtGui import * 13 | from PyQt5.QtCore import * 14 | import logging 15 | 16 | from core.libs.GDAL_Libs.Layers import Raster, Feature, RasterLayer 17 | from core.uis.ResultViewer_ui.resultsViewerWofE_ui import Ui_MainWindow 18 | from core.libs.CustomFileDialog.CustomFileDialog import CustomFileDialog 19 | from core.libs.LSAT_Messages.messages_main import Messenger 20 | from core.libs.Reporting.woe_report import woe_report # used to convert info to string 21 | from core.widgets.ResultViewer.plotViewer_main import PlotViewer 22 | from core.widgets.ResultViewer.tableViewer_main import TableViewer 23 | from core.widgets.ResultViewer.shared_resultviewer import shared_resultfunc 24 | 25 | 26 | class ResultViewerWofE(QMainWindow): 27 | def __init__(self, projectLocation, path, layerName, result, parent=None): 28 | QWidget.__init__(self, parent) 29 | self.ui = Ui_MainWindow() 30 | self.ui.setupUi(self) 31 | self.setWindowIcon(QIcon(':/icons/Icons/Chart_Bar_Big.png')) 32 | self.setWindowTitle(self.tr("Results for {}").format(layerName)) 33 | self.loadModelData(path, result) 34 | self.ui.modelTreeWidget.expandAll() 35 | self.ui.modelTreeWidget.header().setSectionResizeMode(QHeaderView.ResizeToContents) 36 | self.ui.modelTreeWidget.header().setStretchLastSection(False) 37 | table = TableViewer(projectLocation, layerName, result, "WoE") 38 | self.ui.tableTabGridLayout.addWidget(table) 39 | graphics = PlotViewer(layerName, result) 40 | self.ui.graphicsTabGridLayout.addWidget(graphics) 41 | 42 | def loadModelData(self, path, result): 43 | """ 44 | Updates first tab with information about the WoE Calculation. 45 | """ 46 | self.ui.tabWidget.setTabText(0, os.path.basename(result["source"][0])) 47 | # path to npz 48 | shared_resultfunc.setTopLevelItem( 49 | self, 0, self.tr("File Path"), path, self.ui.modelTreeWidget) 50 | # path to and info about used feature file 51 | shared_resultfunc.setTopLevelItem( 52 | self, 1, self.tr("Training dataset"), woe_report._get_featurepath( 53 | self, result), self.ui.modelTreeWidget) 54 | shared_resultfunc.setChildItem( 55 | self, 1, 0, self.tr("Subsampling type"), woe_report._get_subsample_type( 56 | self, result["metadata"][3]), self.ui.modelTreeWidget) 57 | shared_resultfunc.setChildItem( 58 | self, 1, 1, self.tr("Sample size [%]"), str( 59 | result["metadata"][2]), self.ui.modelTreeWidget) 60 | shared_resultfunc.setChildItem( 61 | self, 1, 2, self.tr("Number of subsamples"), str( 62 | result["metadata"][4]), self.ui.modelTreeWidget) 63 | if result["metadata"][3] == "2": # only on the fly subsampling can use a random seed 64 | try: 65 | shared_resultfunc.setChildItem( 66 | self, 1, 3, self.tr("Seed used to Initialize random"), str( 67 | result["metadata"][5]), self.ui.modelTreeWidget) 68 | except IndexError: # no seed defined 69 | shared_resultfunc.setChildItem( 70 | self, 1, 3, self.tr("No seed used to initialize random"), "", self.ui.modelTreeWidget) 71 | # path to raster file 72 | shared_resultfunc.setTopLevelItem( 73 | self, 74 | 2, 75 | self.tr("Input raster"), 76 | result["source"][0], 77 | self.ui.modelTreeWidget) 78 | # model metrics 79 | shared_resultfunc.setTopLevelItem(self, 3, self.tr( 80 | "Model metrics"), None, self.ui.modelTreeWidget) 81 | if result["auc"].size == 1: 82 | shared_resultfunc.setChildItem( 83 | self, 3, 0, self.tr("AUC"), "{:.5f}".format( 84 | result["auc"]), self.ui.modelTreeWidget, str( 85 | result["auc"])) 86 | else: 87 | shared_resultfunc.setChildItem( 88 | self, 3, 0, self.tr("Mean AUC"), "{:.5f}".format( 89 | np.nanmean( 90 | result["auc"])), self.ui.modelTreeWidget, str( 91 | result["auc"])) 92 | shared_resultfunc.setChildItem( 93 | self, 3, 1, self.tr("Median AUC"), "{:.5f}".format( 94 | np.nanmedian( 95 | result["auc"])), self.ui.modelTreeWidget, str( 96 | result["auc"])) 97 | shared_resultfunc.setChildItem( 98 | self, 3, 2, self.tr("Minimum AUC"), "{:.5f}".format( 99 | np.nanmin( 100 | result["auc"])), self.ui.modelTreeWidget, str( 101 | result["auc"])) 102 | shared_resultfunc.setChildItem( 103 | self, 3, 3, self.tr("Maximum AUC"), "{:.5f}".format( 104 | np.nanmax( 105 | result["auc"])), self.ui.modelTreeWidget, str( 106 | result["auc"])) 107 | -------------------------------------------------------------------------------- /core/uis/ModelInfo_ui/ModelInfo.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ModelInfo 4 | 5 | 6 | 7 | 0 8 | 0 9 | 700 10 | 600 11 | 12 | 13 | 14 | Model Info 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | false 24 | 25 | 26 | true 27 | 28 | 29 | true 30 | 31 | 32 | 182 33 | 34 | 35 | true 36 | 37 | 38 | false 39 | 40 | 41 | 42 | Info 43 | 44 | 45 | 46 | 47 | Value 48 | 49 | 50 | 51 | 52 | File Path 53 | 54 | 55 | 56 | MS Shell Dlg 2 57 | 8 58 | 75 59 | true 60 | 61 | 62 | 63 | 64 | 65 | AUC 66 | 67 | 68 | 69 | MS Shell Dlg 2 70 | 8 71 | 75 72 | true 73 | 74 | 75 | 76 | 77 | 78 | Input Rasters 79 | 80 | 81 | 82 | MS Shell Dlg 2 83 | 8 84 | 75 85 | true 86 | 87 | 88 | 89 | 90 | 91 | Model generating expression 92 | 93 | 94 | 95 | MS Shell Dlg 2 96 | 8 97 | 75 98 | true 99 | 100 | 101 | 102 | 103 | 104 | Unique Values 105 | 106 | 107 | 108 | MS Shell Dlg 2 109 | 8 110 | 75 111 | true 112 | 113 | 114 | 115 | 116 | 117 | Sampling Type 118 | 119 | 120 | 121 | MS Shell Dlg 2 122 | 8 123 | 75 124 | true 125 | 126 | 127 | 128 | 129 | 130 | Input Feature 131 | 132 | 133 | 134 | MS Shell Dlg 2 135 | 8 136 | 75 137 | true 138 | 139 | 140 | 141 | 142 | 143 | Seed used to Initialize random 144 | 145 | 146 | 147 | MS Shell Dlg 2 148 | 8 149 | 75 150 | true 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 0 164 | 0 165 | 700 166 | 22 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | -------------------------------------------------------------------------------- /core/widgets/GeoprocessingTools/geoprocessingTools_main.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from core.libs.CustomFileDialog.CustomFileDialog import CustomFileDialog 4 | from core.libs.LSAT_Messages.messages_main import Messenger 5 | from core.uis.GeoprocessingTools_ui.GeoprocessingTools_ui import Ui_GeoprocessingTools 6 | from core.widgets.GeoprocessingTools.geoprocessingTools_calc import GeoprocessingToolsWorker 7 | import os 8 | import logging 9 | from PyQt5.QtCore import * 10 | from PyQt5.QtGui import * 11 | from PyQt5.QtWidgets import * 12 | 13 | 14 | class GeoprocessingTools(QMainWindow): 15 | """ 16 | This class is the main platform of the LSAT application. 17 | """ 18 | 19 | def __init__(self, projectLocation=os.getcwd(), parent=None): 20 | """ 21 | Initializes the application. 22 | :param parent: None 23 | """ 24 | QWidget.__init__(self, parent) 25 | self.ui = Ui_GeoprocessingTools() 26 | self.ui.setupUi(self) 27 | self.progress = QProgressBar() 28 | self.statusBar().addPermanentWidget(self.progress) 29 | # Set the window icon 30 | self.setWindowIcon(QIcon(':/icons/Icons/GeoprocessingTools.png')) 31 | 32 | self.fileDialog = CustomFileDialog() 33 | self.projectLocation = projectLocation 34 | self.message = Messenger() 35 | self.thread_status = False 36 | 37 | @pyqtSlot() 38 | def on_featureToolButton_clicked(self): 39 | self.fileDialog.openFeatureFile(self.projectLocation) 40 | if self.fileDialog.exec_() == 1 and self.fileDialog.selectedFiles(): 41 | self.ui.featureLineEdit.setText(os.path.normpath(self.fileDialog.selectedFiles()[0])) 42 | 43 | @pyqtSlot() 44 | def on_methodLayerToolButton_clicked(self): 45 | self.fileDialog.openFeatureFile(self.projectLocation) 46 | if self.fileDialog.exec_() == 1 and self.fileDialog.selectedFiles(): 47 | self.ui.methodLayerLineEdit.setText( 48 | os.path.normpath(self.fileDialog.selectedFiles()[0])) 49 | 50 | @pyqtSlot() 51 | def on_outFeatureToolButton_clicked(self): 52 | self.fileDialog.openFeatureFile(self.projectLocation) 53 | if self.fileDialog.exec_() == 1 and self.fileDialog.selectedFiles(): 54 | file = self.fileDialog.selectedFiles()[0] 55 | if file.lower().endswith(".shp"): 56 | self.ui.outFeatureLineEdit.setText(os.path.normpath(file)) 57 | else: 58 | self.ui.outFeatureLineEdit.setText(os.path.normpath(file+".shp")) 59 | 60 | @pyqtSlot() 61 | def on_cancelPushButton_clicked(self): 62 | """ 63 | Cancels the procedure and closes the application. 64 | :return: None 65 | """ 66 | try: 67 | if self.thread_status: 68 | self.thread.terminate() 69 | self.close() 70 | except Exception as e: 71 | logging.ERROR(str(e)) 72 | self.close() 73 | 74 | @pyqtSlot() 75 | def on_applyPushButton_clicked(self): 76 | try: 77 | if (not self.ui.featureLineEdit.text() or not self.ui.methodLayerLineEdit.text() or 78 | not self.ui.outFeatureLineEdit.text()): 79 | self.message.WarningMissingInput() 80 | return 81 | 82 | self.thread_status = True 83 | self.progress.setRange(0, 0) 84 | self.ui.applyPushButton.setEnabled(False) 85 | 86 | inDataPath = self.ui.featureLineEdit.text() 87 | methodLayerPath = self.ui.methodLayerLineEdit.text() 88 | outDataPath = self.ui.outFeatureLineEdit.text() 89 | processingType = self.ui.processingComboBox.currentIndex() 90 | # 0 - Clip, 1 - Erase, 2 - Intersect, 3 - Symmetrical Difference, 4 - Union 91 | srBox = self.ui.srCheckBox.isChecked() 92 | 93 | options = [] 94 | if self.ui.skipFailuresCheckBox.isChecked(): 95 | options.append("SKIP_FAILURES=YES") 96 | else: 97 | options.append("SKIP_FAILURES=NO") 98 | if self.ui.promoteToMultiCheckBox.isChecked(): 99 | options.append("PROMOTE_TO_MULTI=YES") 100 | else: 101 | options.append("PROMOTE_TO_MULTI=NO") 102 | 103 | # Start the Analysis as Thread 104 | kwargs = (processingType, options, srBox) 105 | self.thread = QThread() 106 | self.worker = GeoprocessingToolsWorker( 107 | inDataPath, methodLayerPath, outDataPath, kwargs) 108 | self.worker.moveToThread(self.thread) 109 | 110 | self.worker.loggingInfoSignal.connect(self.updateLogger) 111 | self.thread.started.connect(self.worker.run) 112 | self.worker.finishSignal.connect(self.done) 113 | self.thread.start() 114 | 115 | except Exception as e: 116 | logging.ERROR(str(e.message)) 117 | 118 | def done(self): 119 | """ 120 | Defines actions after the thread emits the signal "finished()". 121 | :return: None 122 | """ 123 | self.thread.quit() 124 | self.thread_status = False 125 | self.message.getLoggingInfoOnAnalysisCompleted() 126 | self.progress.setRange(0, 100) 127 | self.progress.setValue(100) 128 | self.ui.applyPushButton.setEnabled(True) 129 | 130 | def updateLogger(self, message): 131 | logging.info(str(message)) 132 | -------------------------------------------------------------------------------- /core/uis/Contingency_ui/Contingency.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Contingency 4 | 5 | 6 | 7 | 0 8 | 0 9 | 700 10 | 400 11 | 12 | 13 | 14 | Contingency Analysis 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | Apply 24 | 25 | 26 | 27 | 28 | 29 | 30 | Output 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | Analysis name 39 | 40 | 41 | 42 | 43 | 44 | 45 | <html><head/><body><p>LSAT will create *name*_ctg.npz in \results\statistics\</p></body></html> 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | Input 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | false 66 | 67 | 68 | ... 69 | 70 | 71 | 72 | 73 | 74 | 75 | ... 76 | 77 | 78 | 79 | 80 | 81 | 82 | ... 83 | 84 | 85 | 86 | 87 | 88 | 89 | false 90 | 91 | 92 | 93 | 94 | 95 | 96 | Mask raster 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | Use project reference as default 107 | 108 | 109 | true 110 | 111 | 112 | 113 | 114 | 115 | 116 | ... 117 | 118 | 119 | 120 | 121 | 122 | 123 | Raster datasets 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 0 140 | 0 141 | 700 142 | 22 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /core/uis/LookupRaster_ui/LookupRaster_ui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file '.\LookupRaster.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.15.4 6 | # 7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is 8 | # run again. Do not edit this file unless you know what you are doing. 9 | 10 | 11 | from PyQt5 import QtCore, QtGui, QtWidgets 12 | 13 | 14 | class Ui_LookupRaster(object): 15 | def setupUi(self, LookupRaster): 16 | LookupRaster.setObjectName("LookupRaster") 17 | LookupRaster.resize(530, 250) 18 | self.centralwidget = QtWidgets.QWidget(LookupRaster) 19 | self.centralwidget.setObjectName("centralwidget") 20 | self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget) 21 | self.verticalLayout.setObjectName("verticalLayout") 22 | self.mainGridLayout = QtWidgets.QGridLayout() 23 | self.mainGridLayout.setObjectName("mainGridLayout") 24 | self.rasterLabel = QtWidgets.QLabel(self.centralwidget) 25 | self.rasterLabel.setObjectName("rasterLabel") 26 | self.mainGridLayout.addWidget(self.rasterLabel, 0, 0, 1, 1) 27 | self.rasterToolButton = QtWidgets.QToolButton(self.centralwidget) 28 | self.rasterToolButton.setObjectName("rasterToolButton") 29 | self.mainGridLayout.addWidget(self.rasterToolButton, 1, 2, 1, 1) 30 | self.rasterComboBox = QtWidgets.QComboBox(self.centralwidget) 31 | self.rasterComboBox.setObjectName("rasterComboBox") 32 | self.mainGridLayout.addWidget(self.rasterComboBox, 1, 0, 1, 2) 33 | self.lookupFieldLabel = QtWidgets.QLabel(self.centralwidget) 34 | self.lookupFieldLabel.setObjectName("lookupFieldLabel") 35 | self.mainGridLayout.addWidget(self.lookupFieldLabel, 2, 0, 1, 1) 36 | self.lookupFieldComboBox = QtWidgets.QComboBox(self.centralwidget) 37 | self.lookupFieldComboBox.setObjectName("lookupFieldComboBox") 38 | self.mainGridLayout.addWidget(self.lookupFieldComboBox, 3, 0, 1, 1) 39 | spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) 40 | self.mainGridLayout.addItem(spacerItem, 2, 2, 1, 1) 41 | self.ratCheckBox = QtWidgets.QCheckBox(self.centralwidget) 42 | self.ratCheckBox.setChecked(True) 43 | self.ratCheckBox.setObjectName("ratCheckBox") 44 | self.mainGridLayout.addWidget(self.ratCheckBox, 4, 0, 1, 1) 45 | self.outRasterLabel = QtWidgets.QLabel(self.centralwidget) 46 | self.outRasterLabel.setObjectName("outRasterLabel") 47 | self.mainGridLayout.addWidget(self.outRasterLabel, 5, 0, 1, 1) 48 | self.outRasterToolButton = QtWidgets.QToolButton(self.centralwidget) 49 | self.outRasterToolButton.setObjectName("outRasterToolButton") 50 | self.mainGridLayout.addWidget(self.outRasterToolButton, 6, 2, 1, 1) 51 | self.outRasterLineEdit = QtWidgets.QLineEdit(self.centralwidget) 52 | self.outRasterLineEdit.setObjectName("outRasterLineEdit") 53 | self.mainGridLayout.addWidget(self.outRasterLineEdit, 6, 0, 1, 2) 54 | self.applyPushButton = QtWidgets.QPushButton(self.centralwidget) 55 | self.applyPushButton.setObjectName("applyPushButton") 56 | self.mainGridLayout.addWidget(self.applyPushButton, 7, 2, 1, 1) 57 | self.cancelPushButton = QtWidgets.QPushButton(self.centralwidget) 58 | self.cancelPushButton.setObjectName("cancelPushButton") 59 | self.mainGridLayout.addWidget(self.cancelPushButton, 7, 1, 1, 1) 60 | self.mainGridLayout.setColumnStretch(0, 2) 61 | self.mainGridLayout.setColumnStretch(1, 1) 62 | self.mainGridLayout.setColumnStretch(2, 1) 63 | self.verticalLayout.addLayout(self.mainGridLayout) 64 | LookupRaster.setCentralWidget(self.centralwidget) 65 | self.menubar = QtWidgets.QMenuBar(LookupRaster) 66 | self.menubar.setGeometry(QtCore.QRect(0, 0, 530, 22)) 67 | self.menubar.setObjectName("menubar") 68 | LookupRaster.setMenuBar(self.menubar) 69 | self.statusbar = QtWidgets.QStatusBar(LookupRaster) 70 | self.statusbar.setObjectName("statusbar") 71 | LookupRaster.setStatusBar(self.statusbar) 72 | 73 | self.retranslateUi(LookupRaster) 74 | QtCore.QMetaObject.connectSlotsByName(LookupRaster) 75 | LookupRaster.setTabOrder(self.rasterComboBox, self.rasterToolButton) 76 | LookupRaster.setTabOrder(self.rasterToolButton, self.lookupFieldComboBox) 77 | LookupRaster.setTabOrder(self.lookupFieldComboBox, self.ratCheckBox) 78 | LookupRaster.setTabOrder(self.ratCheckBox, self.outRasterLineEdit) 79 | LookupRaster.setTabOrder(self.outRasterLineEdit, self.outRasterToolButton) 80 | LookupRaster.setTabOrder(self.outRasterToolButton, self.cancelPushButton) 81 | LookupRaster.setTabOrder(self.cancelPushButton, self.applyPushButton) 82 | 83 | def retranslateUi(self, LookupRaster): 84 | _translate = QtCore.QCoreApplication.translate 85 | LookupRaster.setWindowTitle(_translate("LookupRaster", "Lookup")) 86 | self.rasterLabel.setText(_translate("LookupRaster", "Raster")) 87 | self.rasterToolButton.setText(_translate("LookupRaster", "...")) 88 | self.lookupFieldLabel.setText(_translate("LookupRaster", "Lookup Fields")) 89 | self.ratCheckBox.setText(_translate("LookupRaster", "Append attribute table")) 90 | self.outRasterLabel.setText(_translate("LookupRaster", "Output lookup raster")) 91 | self.outRasterToolButton.setText(_translate("LookupRaster", "...")) 92 | self.applyPushButton.setText(_translate("LookupRaster", "Apply")) 93 | self.cancelPushButton.setText(_translate("LookupRaster", "Cancel")) 94 | -------------------------------------------------------------------------------- /core/uis/ModelInfo_ui/ModelInfo_ui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file 'D:\Schuessler.N\Prog\Py\LSATGitHub\core\uis\ModelInfo_ui\ModelInfo.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.15.6 6 | # 7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is 8 | # run again. Do not edit this file unless you know what you are doing. 9 | 10 | 11 | from PyQt5 import QtCore, QtGui, QtWidgets 12 | 13 | 14 | class Ui_ModelInfo(object): 15 | def setupUi(self, ModelInfo): 16 | ModelInfo.setObjectName("ModelInfo") 17 | ModelInfo.resize(700, 600) 18 | self.centralwidget = QtWidgets.QWidget(ModelInfo) 19 | self.centralwidget.setObjectName("centralwidget") 20 | self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget) 21 | self.horizontalLayout.setObjectName("horizontalLayout") 22 | self.mainGridLayout = QtWidgets.QGridLayout() 23 | self.mainGridLayout.setObjectName("mainGridLayout") 24 | self.treeWidget = QtWidgets.QTreeWidget(self.centralwidget) 25 | self.treeWidget.setHeaderHidden(False) 26 | self.treeWidget.setObjectName("treeWidget") 27 | item_0 = QtWidgets.QTreeWidgetItem(self.treeWidget) 28 | font = QtGui.QFont() 29 | font.setFamily("MS Shell Dlg 2") 30 | font.setPointSize(8) 31 | font.setBold(True) 32 | font.setWeight(75) 33 | item_0.setFont(0, font) 34 | item_0 = QtWidgets.QTreeWidgetItem(self.treeWidget) 35 | font = QtGui.QFont() 36 | font.setFamily("MS Shell Dlg 2") 37 | font.setPointSize(8) 38 | font.setBold(True) 39 | font.setWeight(75) 40 | item_0.setFont(0, font) 41 | item_0 = QtWidgets.QTreeWidgetItem(self.treeWidget) 42 | font = QtGui.QFont() 43 | font.setFamily("MS Shell Dlg 2") 44 | font.setPointSize(8) 45 | font.setBold(True) 46 | font.setWeight(75) 47 | item_0.setFont(0, font) 48 | item_0 = QtWidgets.QTreeWidgetItem(self.treeWidget) 49 | font = QtGui.QFont() 50 | font.setFamily("MS Shell Dlg 2") 51 | font.setPointSize(8) 52 | font.setBold(True) 53 | font.setWeight(75) 54 | item_0.setFont(0, font) 55 | item_0 = QtWidgets.QTreeWidgetItem(self.treeWidget) 56 | font = QtGui.QFont() 57 | font.setFamily("MS Shell Dlg 2") 58 | font.setPointSize(8) 59 | font.setBold(True) 60 | font.setWeight(75) 61 | item_0.setFont(0, font) 62 | item_0 = QtWidgets.QTreeWidgetItem(self.treeWidget) 63 | font = QtGui.QFont() 64 | font.setFamily("MS Shell Dlg 2") 65 | font.setPointSize(8) 66 | font.setBold(True) 67 | font.setWeight(75) 68 | item_0.setFont(0, font) 69 | item_0 = QtWidgets.QTreeWidgetItem(self.treeWidget) 70 | font = QtGui.QFont() 71 | font.setFamily("MS Shell Dlg 2") 72 | font.setPointSize(8) 73 | font.setBold(True) 74 | font.setWeight(75) 75 | item_0.setFont(0, font) 76 | item_0 = QtWidgets.QTreeWidgetItem(self.treeWidget) 77 | font = QtGui.QFont() 78 | font.setFamily("MS Shell Dlg 2") 79 | font.setPointSize(8) 80 | font.setBold(True) 81 | font.setWeight(75) 82 | item_0.setFont(0, font) 83 | self.treeWidget.header().setVisible(True) 84 | self.treeWidget.header().setCascadingSectionResizes(True) 85 | self.treeWidget.header().setDefaultSectionSize(182) 86 | self.treeWidget.header().setHighlightSections(True) 87 | self.treeWidget.header().setSortIndicatorShown(False) 88 | self.mainGridLayout.addWidget(self.treeWidget, 0, 0, 1, 1) 89 | self.horizontalLayout.addLayout(self.mainGridLayout) 90 | ModelInfo.setCentralWidget(self.centralwidget) 91 | self.menubar = QtWidgets.QMenuBar(ModelInfo) 92 | self.menubar.setGeometry(QtCore.QRect(0, 0, 700, 22)) 93 | self.menubar.setObjectName("menubar") 94 | ModelInfo.setMenuBar(self.menubar) 95 | self.statusbar = QtWidgets.QStatusBar(ModelInfo) 96 | self.statusbar.setObjectName("statusbar") 97 | ModelInfo.setStatusBar(self.statusbar) 98 | 99 | self.retranslateUi(ModelInfo) 100 | QtCore.QMetaObject.connectSlotsByName(ModelInfo) 101 | 102 | def retranslateUi(self, ModelInfo): 103 | _translate = QtCore.QCoreApplication.translate 104 | ModelInfo.setWindowTitle(_translate("ModelInfo", "Model Info")) 105 | self.treeWidget.headerItem().setText(0, _translate("ModelInfo", "Info")) 106 | self.treeWidget.headerItem().setText(1, _translate("ModelInfo", "Value")) 107 | __sortingEnabled = self.treeWidget.isSortingEnabled() 108 | self.treeWidget.setSortingEnabled(False) 109 | self.treeWidget.topLevelItem(0).setText(0, _translate("ModelInfo", "File Path")) 110 | self.treeWidget.topLevelItem(1).setText(0, _translate("ModelInfo", "AUC")) 111 | self.treeWidget.topLevelItem(2).setText(0, _translate("ModelInfo", "Input Rasters")) 112 | self.treeWidget.topLevelItem(3).setText(0, _translate("ModelInfo", "Model generating expression")) 113 | self.treeWidget.topLevelItem(4).setText(0, _translate("ModelInfo", "Unique Values")) 114 | self.treeWidget.topLevelItem(5).setText(0, _translate("ModelInfo", "Sampling Type")) 115 | self.treeWidget.topLevelItem(6).setText(0, _translate("ModelInfo", "Input Feature")) 116 | self.treeWidget.topLevelItem(7).setText(0, _translate("ModelInfo", "Seed used to Initialize random")) 117 | self.treeWidget.setSortingEnabled(__sortingEnabled) 118 | -------------------------------------------------------------------------------- /core/uis/Geoprocessing_ui/SimpleGUI_ui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file '.\SimpleGUI.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.14.2 6 | # 7 | # WARNING! All changes made in this file will be lost! 8 | 9 | 10 | from PyQt5 import QtCore, QtGui, QtWidgets 11 | 12 | 13 | class Ui_SimpleGUI(object): 14 | def setupUi(self, SimpleGUI): 15 | SimpleGUI.setObjectName("SimpleGUI") 16 | SimpleGUI.resize(500, 250) 17 | self.centralwidget = QtWidgets.QWidget(SimpleGUI) 18 | self.centralwidget.setObjectName("centralwidget") 19 | self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget) 20 | self.horizontalLayout.setObjectName("horizontalLayout") 21 | self.mainGridLayout = QtWidgets.QGridLayout() 22 | self.mainGridLayout.setObjectName("mainGridLayout") 23 | self.okPushButton = QtWidgets.QPushButton(self.centralwidget) 24 | self.okPushButton.setObjectName("okPushButton") 25 | self.mainGridLayout.addWidget(self.okPushButton, 2, 2, 1, 1) 26 | spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) 27 | self.mainGridLayout.addItem(spacerItem, 2, 0, 1, 1) 28 | self.inputGroupBox = QtWidgets.QGroupBox(self.centralwidget) 29 | self.inputGroupBox.setObjectName("inputGroupBox") 30 | self.verticalLayout = QtWidgets.QVBoxLayout(self.inputGroupBox) 31 | self.verticalLayout.setObjectName("verticalLayout") 32 | self.inputGroupBoxGridLayout = QtWidgets.QGridLayout() 33 | self.inputGroupBoxGridLayout.setObjectName("inputGroupBoxGridLayout") 34 | self.demRasterLabel = QtWidgets.QLabel(self.inputGroupBox) 35 | self.demRasterLabel.setObjectName("demRasterLabel") 36 | self.inputGroupBoxGridLayout.addWidget(self.demRasterLabel, 0, 0, 1, 1) 37 | self.demRasterToolButton = QtWidgets.QToolButton(self.inputGroupBox) 38 | self.demRasterToolButton.setObjectName("demRasterToolButton") 39 | self.inputGroupBoxGridLayout.addWidget(self.demRasterToolButton, 1, 1, 1, 1) 40 | self.demRasterComboBox = QtWidgets.QComboBox(self.inputGroupBox) 41 | self.demRasterComboBox.setObjectName("demRasterComboBox") 42 | self.inputGroupBoxGridLayout.addWidget(self.demRasterComboBox, 1, 0, 1, 1) 43 | self.verticalLayout.addLayout(self.inputGroupBoxGridLayout) 44 | self.mainGridLayout.addWidget(self.inputGroupBox, 0, 0, 1, 4) 45 | self.outputGroupBox = QtWidgets.QGroupBox(self.centralwidget) 46 | self.outputGroupBox.setObjectName("outputGroupBox") 47 | self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.outputGroupBox) 48 | self.verticalLayout_2.setObjectName("verticalLayout_2") 49 | self.outputBoxGridLayout = QtWidgets.QGridLayout() 50 | self.outputBoxGridLayout.setObjectName("outputBoxGridLayout") 51 | self.outputRasterLineEdit = QtWidgets.QLineEdit(self.outputGroupBox) 52 | self.outputRasterLineEdit.setObjectName("outputRasterLineEdit") 53 | self.outputBoxGridLayout.addWidget(self.outputRasterLineEdit, 1, 0, 1, 1) 54 | self.outputRasterLabel = QtWidgets.QLabel(self.outputGroupBox) 55 | self.outputRasterLabel.setObjectName("outputRasterLabel") 56 | self.outputBoxGridLayout.addWidget(self.outputRasterLabel, 0, 0, 1, 1) 57 | self.outputRasterToolButton = QtWidgets.QToolButton(self.outputGroupBox) 58 | self.outputRasterToolButton.setObjectName("outputRasterToolButton") 59 | self.outputBoxGridLayout.addWidget(self.outputRasterToolButton, 1, 1, 1, 1) 60 | self.verticalLayout_2.addLayout(self.outputBoxGridLayout) 61 | self.mainGridLayout.addWidget(self.outputGroupBox, 1, 0, 1, 4) 62 | self.cancelPushButton = QtWidgets.QPushButton(self.centralwidget) 63 | self.cancelPushButton.setObjectName("cancelPushButton") 64 | self.mainGridLayout.addWidget(self.cancelPushButton, 2, 1, 1, 1) 65 | self.mainGridLayout.setRowStretch(0, 1) 66 | self.mainGridLayout.setRowStretch(1, 1) 67 | self.horizontalLayout.addLayout(self.mainGridLayout) 68 | SimpleGUI.setCentralWidget(self.centralwidget) 69 | self.menubar = QtWidgets.QMenuBar(SimpleGUI) 70 | self.menubar.setGeometry(QtCore.QRect(0, 0, 500, 21)) 71 | self.menubar.setObjectName("menubar") 72 | SimpleGUI.setMenuBar(self.menubar) 73 | self.statusbar = QtWidgets.QStatusBar(SimpleGUI) 74 | self.statusbar.setObjectName("statusbar") 75 | SimpleGUI.setStatusBar(self.statusbar) 76 | 77 | self.retranslateUi(SimpleGUI) 78 | QtCore.QMetaObject.connectSlotsByName(SimpleGUI) 79 | SimpleGUI.setTabOrder(self.demRasterComboBox, self.demRasterToolButton) 80 | SimpleGUI.setTabOrder(self.demRasterToolButton, self.outputRasterLineEdit) 81 | SimpleGUI.setTabOrder(self.outputRasterLineEdit, self.outputRasterToolButton) 82 | SimpleGUI.setTabOrder(self.outputRasterToolButton, self.cancelPushButton) 83 | SimpleGUI.setTabOrder(self.cancelPushButton, self.okPushButton) 84 | 85 | def retranslateUi(self, SimpleGUI): 86 | _translate = QtCore.QCoreApplication.translate 87 | SimpleGUI.setWindowTitle(_translate("SimpleGUI", "MainWindow")) 88 | self.okPushButton.setText(_translate("SimpleGUI", "OK")) 89 | self.inputGroupBox.setTitle(_translate("SimpleGUI", "Input ")) 90 | self.demRasterLabel.setText(_translate("SimpleGUI", "DEM raster")) 91 | self.demRasterToolButton.setText(_translate("SimpleGUI", "...")) 92 | self.outputGroupBox.setTitle(_translate("SimpleGUI", "Output")) 93 | self.outputRasterLabel.setText(_translate("SimpleGUI", "Output raster")) 94 | self.outputRasterToolButton.setText(_translate("SimpleGUI", "...")) 95 | self.cancelPushButton.setText(_translate("SimpleGUI", "Cancel")) 96 | -------------------------------------------------------------------------------- /core/uis/RasterInfo_ui/RasterInfo.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | RasterInfo 4 | 5 | 6 | 7 | 0 8 | 0 9 | 700 10 | 600 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | true 24 | 25 | 26 | 27 | Info 28 | 29 | 30 | 31 | 32 | Value 33 | 34 | 35 | 36 | 37 | Source path 38 | 39 | 40 | 41 | 75 42 | true 43 | 44 | 45 | 46 | 47 | 48 | Type 49 | 50 | 51 | 52 | 75 53 | true 54 | 55 | 56 | 57 | 58 | 59 | Spatial Reference 60 | 61 | 62 | 63 | 75 64 | true 65 | 66 | 67 | 68 | 69 | EPSG Code 70 | 71 | 72 | 73 | 74 | Projection 75 | 76 | 77 | 78 | 79 | 80 | Extent 81 | 82 | 83 | 84 | 75 85 | true 86 | 87 | 88 | 89 | 90 | top 91 | 92 | 93 | 94 | 95 | left 96 | 97 | 98 | 99 | 100 | right 101 | 102 | 103 | 104 | 105 | bottom 106 | 107 | 108 | 109 | 110 | area in m² 111 | 112 | 113 | 114 | 115 | 116 | Dimensions 117 | 118 | 119 | 120 | 75 121 | true 122 | 123 | 124 | 125 | 126 | Columns 127 | 128 | 129 | 130 | 131 | Rows 132 | 133 | 134 | 135 | 136 | 137 | Cellsize 138 | 139 | 140 | 141 | 75 142 | true 143 | 144 | 145 | 146 | 147 | X 148 | 149 | 150 | 151 | 152 | Y 153 | 154 | 155 | 156 | 157 | 158 | Values 159 | 160 | 161 | 162 | 75 163 | true 164 | 165 | 166 | 167 | 168 | Min 169 | 170 | 171 | 172 | 173 | Max 174 | 175 | 176 | 177 | 178 | NoData 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 0 192 | 0 193 | 700 194 | 22 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | -------------------------------------------------------------------------------- /core/uis/Reprojection_ui/Reprojection.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ProjectionSettings 4 | 5 | 6 | 7 | 0 8 | 0 9 | 850 10 | 550 11 | 12 | 13 | 14 | Import 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 0 26 | 400 27 | 28 | 29 | 30 | Input raster info 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | Qt::Horizontal 43 | 44 | 45 | 46 | 40 47 | 0 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | Reprojection information and settings 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | Source EPSG 66 | 67 | 68 | 69 | 70 | 71 | 72 | false 73 | 74 | 75 | 76 | 77 | 78 | 79 | Source cellsize 80 | 81 | 82 | 83 | 84 | 85 | 86 | false 87 | 88 | 89 | 90 | 91 | 92 | 93 | Target EPSG 94 | 95 | 96 | 97 | 98 | 99 | 100 | false 101 | 102 | 103 | 104 | 105 | 106 | 107 | Target cellsize 108 | 109 | 110 | 111 | 112 | 113 | 114 | false 115 | 116 | 117 | 118 | 119 | 120 | 121 | Resampling Technique 122 | 123 | 124 | 125 | 126 | 127 | 128 | NEAREST 129 | 130 | 131 | true 132 | 133 | 134 | 135 | 136 | 137 | 138 | CUBIC 139 | 140 | 141 | 142 | 143 | 144 | 145 | BILINEAR 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | OK 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | targetEPSGLineEdit 167 | targetCellsizeLineEdit 168 | NEARESTradioButton 169 | BILINEARradioButton 170 | CUBICradioButton 171 | 172 | 173 | 174 | 175 | -------------------------------------------------------------------------------- /core/uis/ResultViewer_ui/tabbedResultViewerAHP_ui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file '.\tabbedResultViewerAHP.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.15.4 6 | # 7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is 8 | # run again. Do not edit this file unless you know what you are doing. 9 | 10 | 11 | from PyQt5 import QtCore, QtGui, QtWidgets 12 | 13 | 14 | class Ui_tabbedResultViewerAHP(object): 15 | def setupUi(self, tabbedResultViewerAHP): 16 | tabbedResultViewerAHP.setObjectName("tabbedResultViewerAHP") 17 | tabbedResultViewerAHP.resize(1000, 750) 18 | tabbedResultViewerAHP.setTabShape(QtWidgets.QTabWidget.Rounded) 19 | self.centralwidget = QtWidgets.QWidget(tabbedResultViewerAHP) 20 | self.centralwidget.setObjectName("centralwidget") 21 | self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget) 22 | self.verticalLayout.setObjectName("verticalLayout") 23 | self.tabWidget = QtWidgets.QTabWidget(self.centralwidget) 24 | self.tabWidget.setObjectName("tabWidget") 25 | self.modelTab = QtWidgets.QWidget() 26 | self.modelTab.setObjectName("modelTab") 27 | self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.modelTab) 28 | self.verticalLayout_2.setObjectName("verticalLayout_2") 29 | self.smallTabWidget = QtWidgets.QTabWidget(self.modelTab) 30 | self.smallTabWidget.setObjectName("smallTabWidget") 31 | self.generalinformation = QtWidgets.QWidget() 32 | self.generalinformation.setObjectName("generalinformation") 33 | self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.generalinformation) 34 | self.verticalLayout_3.setObjectName("verticalLayout_3") 35 | self.modelTreeWidget = QtWidgets.QTreeWidget(self.generalinformation) 36 | self.modelTreeWidget.setObjectName("modelTreeWidget") 37 | self.verticalLayout_3.addWidget(self.modelTreeWidget) 38 | self.smallTabWidget.addTab(self.generalinformation, "") 39 | self.coefficientprios = QtWidgets.QWidget() 40 | self.coefficientprios.setObjectName("coefficientprios") 41 | self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.coefficientprios) 42 | self.verticalLayout_4.setObjectName("verticalLayout_4") 43 | self.coefficientPriosTableWidget = QtWidgets.QTableWidget(self.coefficientprios) 44 | self.coefficientPriosTableWidget.setObjectName("coefficientPriosTableWidget") 45 | self.coefficientPriosTableWidget.setColumnCount(3) 46 | self.coefficientPriosTableWidget.setRowCount(0) 47 | item = QtWidgets.QTableWidgetItem() 48 | self.coefficientPriosTableWidget.setHorizontalHeaderItem(0, item) 49 | item = QtWidgets.QTableWidgetItem() 50 | self.coefficientPriosTableWidget.setHorizontalHeaderItem(1, item) 51 | item = QtWidgets.QTableWidgetItem() 52 | self.coefficientPriosTableWidget.setHorizontalHeaderItem(2, item) 53 | self.coefficientPriosTableWidget.horizontalHeader().setStretchLastSection(False) 54 | self.verticalLayout_4.addWidget(self.coefficientPriosTableWidget) 55 | self.smallTabWidget.addTab(self.coefficientprios, "") 56 | self.pairwiserastercomp = QtWidgets.QWidget() 57 | self.pairwiserastercomp.setObjectName("pairwiserastercomp") 58 | self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.pairwiserastercomp) 59 | self.verticalLayout_5.setObjectName("verticalLayout_5") 60 | self.pairwiseRasterCompTableWidget = QtWidgets.QTableWidget(self.pairwiserastercomp) 61 | self.pairwiseRasterCompTableWidget.setObjectName("pairwiseRasterCompTableWidget") 62 | self.pairwiseRasterCompTableWidget.setColumnCount(0) 63 | self.pairwiseRasterCompTableWidget.setRowCount(0) 64 | self.verticalLayout_5.addWidget(self.pairwiseRasterCompTableWidget) 65 | self.smallTabWidget.addTab(self.pairwiserastercomp, "") 66 | self.verticalLayout_2.addWidget(self.smallTabWidget) 67 | self.tabWidget.addTab(self.modelTab, "") 68 | self.verticalLayout.addWidget(self.tabWidget) 69 | tabbedResultViewerAHP.setCentralWidget(self.centralwidget) 70 | self.statusbar = QtWidgets.QStatusBar(tabbedResultViewerAHP) 71 | self.statusbar.setObjectName("statusbar") 72 | tabbedResultViewerAHP.setStatusBar(self.statusbar) 73 | 74 | self.retranslateUi(tabbedResultViewerAHP) 75 | self.tabWidget.setCurrentIndex(0) 76 | self.smallTabWidget.setCurrentIndex(0) 77 | QtCore.QMetaObject.connectSlotsByName(tabbedResultViewerAHP) 78 | 79 | def retranslateUi(self, tabbedResultViewerAHP): 80 | _translate = QtCore.QCoreApplication.translate 81 | tabbedResultViewerAHP.setWindowTitle(_translate("tabbedResultViewerAHP", "MainWindow")) 82 | self.modelTreeWidget.headerItem().setText(0, _translate("tabbedResultViewerAHP", "Info")) 83 | self.modelTreeWidget.headerItem().setText(1, _translate("tabbedResultViewerAHP", "Value")) 84 | self.smallTabWidget.setTabText(self.smallTabWidget.indexOf(self.generalinformation), _translate("tabbedResultViewerAHP", "General Information")) 85 | item = self.coefficientPriosTableWidget.horizontalHeaderItem(0) 86 | item.setText(_translate("tabbedResultViewerAHP", "Raster")) 87 | item = self.coefficientPriosTableWidget.horizontalHeaderItem(1) 88 | item.setText(_translate("tabbedResultViewerAHP", "Value")) 89 | item = self.coefficientPriosTableWidget.horizontalHeaderItem(2) 90 | item.setText(_translate("tabbedResultViewerAHP", "Coefficient Priority")) 91 | self.smallTabWidget.setTabText(self.smallTabWidget.indexOf(self.coefficientprios), _translate("tabbedResultViewerAHP", "Coefficient priorites")) 92 | self.smallTabWidget.setTabText(self.smallTabWidget.indexOf(self.pairwiserastercomp), _translate("tabbedResultViewerAHP", "Pairwise raster comparison")) 93 | self.tabWidget.setTabText(self.tabWidget.indexOf(self.modelTab), _translate("tabbedResultViewerAHP", "Seite")) 94 | -------------------------------------------------------------------------------- /core/libs/Rasterprepwork/rpw_main.py: -------------------------------------------------------------------------------- 1 | from osgeo import gdal 2 | import numpy as np 3 | import os 4 | from core.libs.GDAL_Libs.Layers import Raster, Feature 5 | 6 | 7 | class rasterprepwork(): 8 | """ 9 | This class bundles data preperation functions currently used by ANN and LR in order to simplify 10 | and streamline LSAT. 11 | """ 12 | 13 | def prepareInputData(self, maskraster, workspacepath, featurePath, data_list): 14 | """ 15 | We create multiple Arrays: 16 | 1. No Data Array of the mask raster 17 | 2. Boolean Landslide Array 18 | 3. Boolean Landslide Array without positions where the No Data Array has no Data 19 | 4. + 5. We also create two Array for every Input Raster based on its type and sorting 20 | one with No Data and one without 21 | """ 22 | noDataArray = self.getNoDataArray(maskraster, data_list) 23 | land_rast_array = self.getLandslideArray(workspacepath, featurePath, maskraster) 24 | # land_rast_array_red is land_rast_array without Values where we have 25 | # NoData in input rasters. 26 | land_rast_array_red = land_rast_array[noDataArray != -9999] 27 | locals_list = [] 28 | full_array_list = [] 29 | # data_list[n][0] = Absolute path to raster 30 | # data_list[n][1] = Type of raster (Continous/Discrete) 31 | # data_list[n][2] = Raster name without extension 32 | for data in data_list: 33 | if data[1] == "Continuous": 34 | minMaxScaledArray_red, minMaxScaledArray = self.getMinMaxScaledArray(data[0], noDataArray) 35 | locals_list.append(minMaxScaledArray_red.ravel()) 36 | full_array_list.append(minMaxScaledArray.ravel()) 37 | else: 38 | # Appending to lists happens in getstackFromCategoricalData() 39 | stack_red, stack = self.getstackFromCategoricalData( 40 | data[0], maskraster, data[2], noDataArray) 41 | # We add every return array to its coressponding list 42 | for n in stack_red: 43 | locals_list.append(n.ravel()) 44 | for n in stack: 45 | full_array_list.append(n.ravel()) 46 | nr_of_unique_parameters = len(locals_list) 47 | stack_red = np.vstack(tuple(locals_list)) 48 | stack_full = np.vstack(tuple(full_array_list)) 49 | labels_red = land_rast_array_red.ravel() 50 | return stack_red, labels_red, stack_full, noDataArray, nr_of_unique_parameters 51 | 52 | def getNoDataArray(self, raster, data_list): 53 | """ 54 | Returns a raster filled with ones and No Data of the size of the Input (raster). If a 55 | Input Raster has No Data at any point this point will be No Data for the whole calculation. 56 | """ 57 | noDataArray = np.ones_like(raster.getArrayFromBand()).astype(np.float32) 58 | for data in data_list: 59 | # data[0] is a string of the absolute Path to the raster 60 | raster = Raster(data[0]) 61 | ar = raster.getArrayFromBand() 62 | noDataArray[np.where(ar == raster.nodata)] = -9999 63 | return noDataArray 64 | 65 | def getLandslideArray(self, workspacepath, featurePath, maskraster): 66 | """ 67 | Creates a boolean Raster from the input feature (featurePath) in workspacepath. maskraster 68 | defines the boundaries of the output raster. 69 | """ 70 | outRaster = os.path.join(workspacepath, "land_rast.tif") 71 | feature = Feature(featurePath) 72 | feature.rasterizeLayer(maskraster.path, outRaster) 73 | LandslideRaster = Raster(outRaster) 74 | LandslideArray = LandslideRaster.getArrayFromBand() 75 | return LandslideArray 76 | 77 | def getMinMaxScaledArray(self, path: str, noDataArray) -> tuple: 78 | """ 79 | Creates 2 normalized arrays with value range [0, 1] from input raster: 80 | NormalizedArray_ascending with NoData and NormalizedArray_ascending_red without. 81 | :return: ndarray, normalized numpy array 82 | """ 83 | raster = Raster(path) 84 | array = raster.getArrayFromBand() 85 | array_red = array[noDataArray != raster.nodata] 86 | # Make NoData nan so it does not influence the scaling 87 | array[array == raster.nodata] = np.nan 88 | minMaxScaledArray = (array - np.nanmin(array)) / \ 89 | (np.nanmax(array) - np.nanmin(array)) 90 | minMaxScaledArray_red = ( 91 | array_red - np.nanmin(array_red)) / (np.nanmax(array_red) - np.nanmin(array_red)) 92 | # Reverse nan back to NoData (-9999) 93 | minMaxScaledArray[np.isnan(minMaxScaledArray)] = raster.nodata 94 | return minMaxScaledArray_red, minMaxScaledArray 95 | 96 | def getstackFromCategoricalData(self, path, maskraster, name, noDataArray): 97 | """ 98 | Creates 2 times n arrays from a raster with n discrete values. The n. output Raster will be 1 where 99 | the n. value is and 0 everywhere else. 100 | stackFromCategoricalData with NoData and stackFromCategoricalData_red without. 101 | """ 102 | raster = Raster(path) 103 | array = raster.getArrayFromBand() 104 | mask_array = maskraster.getArrayFromBand() 105 | unique_array = np.unique(array) 106 | unique_array = unique_array[unique_array != raster.nodata] 107 | stackFromCategoricalData = [] 108 | stackFromCategoricalData_red = [] 109 | 110 | for i in unique_array: 111 | value_array = np.zeros_like(mask_array) 112 | value_array[np.where(array == i)] = 1 113 | stackFromCategoricalData.append(value_array.ravel()) 114 | value_array_red = value_array[noDataArray != raster.nodata] 115 | stackFromCategoricalData_red.append(value_array_red.ravel()) 116 | return stackFromCategoricalData_red, stackFromCategoricalData 117 | --------------------------------------------------------------------------------