Commit 58ca96aa authored by Rabotin Michael's avatar Rabotin Michael

Add License and Author Name, add error message if SCR DEM not provided

parent 32664aa7
Version 1.0.0
===========
* Added GNU license and list of author(s)
* Fixed some misspelling in GUI
This diff is collapsed.
HRU delin QGIS plugin
=====================
Install hru-delin in one click!
What is it?
===========
This plugin is an all-in-one package to easily install and use hru-delin on GNU/Linux and Windows.
It has been tested and works on GNU/Linux and Windows with QGIS 3.8, 3.10 and 3.12.
What can I do with it?
======================
For the moment, the plugin's user interface is very basic. You can load a config file (just like you would do with classic hru-delin) and the plugin will run the 4 steps and load/display result files.
You can select which steps you want to run, in case you just want to run a few steps or you already have intermediate results and you want to finish the job.
......@@ -177,7 +177,7 @@ class HruDelin:
def onClosePlugin(self):
"""Cleanup necessary items here when plugin dockwidget is closed"""
#print "** CLOSING Irip"
#print "** CLOSING HRU-delin"
# disconnects
self.dockwidget.closingPlugin.disconnect(self.onClosePlugin)
......@@ -194,7 +194,7 @@ class HruDelin:
def unload(self):
"""Removes the plugin menu item and icon from QGIS GUI."""
#print "** UNLOAD Irip"
#print "** UNLOAD HRU-delin"
for action in self.actions:
self.iface.removePluginMenu(
......
......@@ -200,13 +200,13 @@ class HruDelinDockWidget(QtWidgets.QDockWidget, FORM_CLASS):
message = self.tr('Set this if you already know the area where you want to make the computations.\n\nIf you provide a value here, study area field will be ignored.')
elif oName == 'studyHelpButton':
title = self.tr('Help for study area')
message = self.tr('If you set this, IRIP will compute the related subcatchment area which is the area flowing to the study area.\n\nIf you provide a value here, subcatchment field will be ignored.')
message = self.tr('If you set this, HRU-delin will compute the related subcatchment area which is the area flowing to the study area.\n\nIf you provide a value here, subcatchment field will be ignored.')
elif oName == 'exportHelpButton':
title = self.tr('Help for export')
message = self.tr('You can export project configuration (file paths) to a config (.cfg) file. You can then load this file to run Irip again with this configuration.\n\nThis is usefull to perform the same analysis multiple times or to change just one input file and re-run an analysis.')
message = self.tr('You can export project configuration (file paths) to a config (.cfg) file. You can then load this file to run HRU-delin again with this configuration.\n\nThis is usefull to perform the same analysis multiple times or to change just one input file and re-run an analysis.')
elif oName == 'exportDataHelpButton':
title = self.tr('Help for export data')
message = self.tr('This button allows you to export an archive containing all input data files and a config (.cfg) file.\n\nYou can then send this archive to someone who will directly be able to run the analysis with Irip plugin.')
message = self.tr('This button allows you to export an archive containing all input data files and a config (.cfg) file.\n\nYou can then send this archive to someone who will directly be able to run the analysis with HRU-delin plugin.')
if oName == 'projectPathHelpButton':
title = self.tr('Help for project path')
message = self.tr('This is the path where result directories will be created (results, indicators, tmp and work)')
......@@ -487,7 +487,7 @@ class HruDelinDockWidget(QtWidgets.QDockWidget, FORM_CLASS):
# export relative path only
config = configparser.ConfigParser()
input_dir = 'input_data'
output_dir = 'results_irip_plugin'
output_dir = 'results_HRU-delin_plugin'
config['dir_in'] = {'dir': input_dir}
config['dir_out'] = {'results': output_dir}
......@@ -623,18 +623,18 @@ class HruDelinDockWidget(QtWidgets.QDockWidget, FORM_CLASS):
if not os.path.exists(self.projectPath):
os.mkdir(self.projectPath)
self.intermDir = os.path.join(self.projectPath, 'hrudelin_intermediate')
if os.path.exists(self.intermDir):
shutil.rmtree(self.intermDir)
os.mkdir(self.intermDir)
# self.intermDir = os.path.join(self.projectPath, 'hrudelin_intermediate')
# if os.path.exists(self.intermDir):
# shutil.rmtree(self.intermDir)
# os.mkdir(self.intermDir)
self.finalDir = os.path.join(self.projectPath, 'hrudelin_final')
if os.path.exists(self.finalDir):
shutil.rmtree(self.finalDir)
os.mkdir(self.finalDir)
# self.finalDir = os.path.join(self.projectPath, 'hrudelin_final')
# if os.path.exists(self.finalDir):
# shutil.rmtree(self.finalDir)
# os.mkdir(self.finalDir)
# called after having changed the DEM
# reset all further Irip "chapters"
# reset all further HRU-delin "chapters"
# get project projection from the DEM file
def checkDEM(self):
self.changeProjectPathButton.setVisible(False)
......@@ -664,9 +664,18 @@ class HruDelinDockWidget(QtWidgets.QDockWidget, FORM_CLASS):
# we just get the projection
fd = gdal.Open(self.demPath)
osrProj = osr.SpatialReference(wkt=fd.GetProjection())
if str(osrProj.GetName()) == 'None':
QMessageBox.critical(
self.iface.mainWindow(),
self.tr('Error'),
self.tr('Input Dem as no SCR. Please add one')
)
self.projNum = int(osrProj.GetAttrValue('AUTHORITY', 1))
self.proj = 'EPSG:%s' % self.projNum
self.projObj = QgsCoordinateReferenceSystem(self.projNum, QgsCoordinateReferenceSystem.EpsgCrsId)
self.demLayer = self.displayLayer({
'type': 'raster',
......@@ -774,7 +783,7 @@ class HruDelinDockWidget(QtWidgets.QDockWidget, FORM_CLASS):
## show next GUI elements
#self.groupBoxLanduse.setVisible(True)
#self.groupBoxIripPlus.setVisible(True)
#self.groupBoxHRUdelinPlus.setVisible(True)
#self.landuseLegend1Frame.setVisible(False)
#self.landuseLegend2Frame.setVisible(False)
......@@ -810,7 +819,7 @@ class HruDelinDockWidget(QtWidgets.QDockWidget, FORM_CLASS):
## show next GUI elements
#self.groupBoxLanduse.setVisible(True)
#self.groupBoxIripPlus.setVisible(True)
#self.groupBoxHRUdelinPlus.setVisible(True)
#self.landuseLegend1Frame.setVisible(False)
#self.landuseLegend2Frame.setVisible(False)
......@@ -850,7 +859,7 @@ class HruDelinDockWidget(QtWidgets.QDockWidget, FORM_CLASS):
## show next GUI elements
#self.groupBoxLanduse.setVisible(True)
#self.groupBoxIripPlus.setVisible(True)
#self.groupBoxHRUdelinPlus.setVisible(True)
#self.landuseLegend1Frame.setVisible(False)
#self.landuseLegend2Frame.setVisible(False)
......
......@@ -23,7 +23,7 @@
</size>
</property>
<property name="windowTitle">
<string>IRIP</string>
<string>HRU-delin</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QVBoxLayout" name="verticalLayout_2">
......@@ -66,7 +66,7 @@
<x>0</x>
<y>0</y>
<width>407</width>
<height>654</height>
<height>644</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
......
......@@ -11,13 +11,13 @@ name=hru-delin
qgisMinimumVersion=3.0
description=HRU delineation
version=0.1
author=IRSTEA
email=a@a
author=INRAE - UR RIVERLY
email=michael.rabotin@inrae.fr
about=This plugin is a port of hru-delin v7 "standalone"
about=This plugin is a port of hru-delin v6.0 "standalone"
tracker=https://gitlab.irstea.fr/julien.veyssier/hru-delin-qgis
repository=https://gitlab.irstea.fr/julien.veyssier/hru-delin-qgis
tracker=https://gitlab.irstea.fr/hru-delin-dev/hru-delin-qgis
repository=https://gitlab.irstea.fr/hru-delin-dev/hru-delin-qgis
# End of mandatory metadata
# Recommended items:
......
......@@ -3,7 +3,7 @@
git checkout l10n_master
git reset --hard HEAD~100
git pull origin l10n_master
rm -rf /tmp/irip_translation ; cp -r i18n/crowdin /tmp/irip_translation
rm -rf /tmp/hru-delin_translation ; cp -r i18n/crowdin /tmp/hru-delin_translation
git checkout master
mv `find /tmp/hru-delin_translation -name "*.ts"` i18n/
rm -rf /tmp/hru-delin_translation
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment