Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
LETG
Rename bands
Commits
a4cd5a7b
Commit
a4cd5a7b
authored
Sep 16, 2021
by
PIERSON Julie
Browse files
cleaning unused code and import
parent
9dba9ffe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
9 deletions
+4
-9
BandTableWidget.py
BandTableWidget.py
+3
-6
merge_rename_bands_algorithm.py
merge_rename_bands_algorithm.py
+1
-3
No files found.
BandTableWidget.py
View file @
a4cd5a7b
...
...
@@ -33,7 +33,6 @@ from qgis.PyQt.QtWidgets import (QTreeWidgetItem,
from
qgis.core
import
(
QgsApplication
,
QgsProject
,
QgsMapLayer
,
QgsRasterLayer
,
QgsMapLayerProxyModel
)
from
processing.gui.wrappers
import
WidgetWrapper
from
osgeo
import
gdal
...
...
@@ -57,6 +56,9 @@ class BandTableWidget(BASE, WIDGET):
# when alg is launched by user, display bands in table of 1st raster layer
self
.
layerChanged
()
# this is how to display a message for debugging
#QMessageBox.information(None, self.tr('window name'), self.tr('message'))
# when user changes selected layer in combobox
def
layerChanged
(
self
):
...
...
@@ -66,7 +68,6 @@ class BandTableWidget(BASE, WIDGET):
layer
=
self
.
cmbLayers
.
currentLayer
()
# if there is one
if
layer
!=
None
:
#QMessageBox.information(None, self.tr('tralala'), self.tr(str(layer.name())))
input_raster
=
gdal
.
Open
(
layer
.
source
())
# get number of bands in raster
nbands
=
input_raster
.
RasterCount
...
...
@@ -143,7 +144,6 @@ class BandTableWidget(BASE, WIDGET):
if
item
:
row
=
[
item
.
text
(
0
),
item
.
text
(
1
),
item
.
text
(
2
)]
band_names
.
append
(
row
)
#QMessageBox.information(None, self.tr('tralala'), self.tr(str(band_names)))
return
band_names
def
setLayer
(
self
,
layer
):
...
...
@@ -184,14 +184,11 @@ class BandTableWidget(BASE, WIDGET):
allValues
+=
';'
# adding input layer path to values
allValues
+=
self
.
cmbLayers
.
currentLayer
().
source
()
# allValues = [self.cmbLayers.currentLayer().source()]
# allValues += self.bandNames()
allValues
+=
';'
# adding table content to values
for
b
in
self
.
bandNames
():
allValues
+=
'{0},{1},{2};'
.
format
(
b
[
0
],
b
[
1
],
b
[
2
])
return
allValues
[:
-
1
]
#return allValues
class
BandTableWidgetWrapper
(
WidgetWrapper
):
...
...
merge_rename_bands_algorithm.py
View file @
a4cd5a7b
...
...
@@ -31,9 +31,7 @@ __copyright__ = '(C) 2021 by J. Pierson, UMR 6554 LETG, CNRS'
__revision__
=
'$Format:%H$'
from
qgis.PyQt.QtCore
import
QCoreApplication
from
qgis.core
import
(
QgsProcessing
,
QgsProcessingAlgorithm
,
QgsRasterLayer
,
from
qgis.core
import
(
QgsProcessingAlgorithm
,
QgsProcessingParameterDefinition
,
QgsProcessingParameterRasterDestination
)
from
osgeo
import
gdal
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment