Skip to content

Commit 2950146

Browse files
committed
[processing] fixed saga split rgb for 2.1.4
1 parent 8ac22c5 commit 2950146

File tree

1 file changed

+12
-24
lines changed

1 file changed

+12
-24
lines changed

python/plugins/processing/algs/saga/SplitRGBBands.py

+12-24
Original file line numberDiff line numberDiff line change
@@ -70,30 +70,18 @@ def processAlgorithm(self, progress):
7070
g = self.getOutputValue(SplitRGBBands.G)
7171
b = self.getOutputValue(SplitRGBBands.B)
7272
commands = []
73-
if isWindows():
74-
commands.append('io_gdal 0 -GRIDS "' + temp + '" -FILES "' + input
75-
+ '"')
76-
commands.append('io_gdal 1 -GRIDS "' + temp
77-
+ '_0001.sgrd" -FORMAT 1 -TYPE 0 -FILE "' + r + '"'
78-
)
79-
commands.append('io_gdal 1 -GRIDS "' + temp
80-
+ '_0002.sgrd" -FORMAT 1 -TYPE 0 -FILE "' + g + '"'
81-
)
82-
commands.append('io_gdal 1 -GRIDS "' + temp
83-
+ '_0003.sgrd" -FORMAT 1 -TYPE 0 -FILE "' + b + '"'
84-
)
85-
else:
86-
commands.append('libio_gdal 0 -GRIDS "' + temp + '" -FILES "'
87-
+ input + '"')
88-
commands.append('libio_gdal 1 -GRIDS "' + temp
89-
+ '_0001.sgrd" -FORMAT 1 -TYPE 0 -FILE "' + r + '"'
90-
)
91-
commands.append('libio_gdal 1 -GRIDS "' + temp
92-
+ '_0002.sgrd" -FORMAT 1 -TYPE 0 -FILE "' + g + '"'
93-
)
94-
commands.append('libio_gdal 1 -GRIDS "' + temp
95-
+ '_0003.sgrd" -FORMAT 1 -TYPE 0 -FILE "' + b + '"'
96-
)
73+
version = SagaUtils.getSagaInstalledVersion(True)
74+
trailing = "000" if version != "2.1.4" else ""
75+
lib = "" if isWindows() else "lib"
76+
commands.append('%sio_gdal 0 -GRIDS "%s" -FILES "%s"' % (lib, temp, input)
77+
+ '"')
78+
commands.append('%sio_gdal 1 -GRIDS "%s_%s1.sgrd" -FORMAT 1 -TYPE 0 -FILE "%s"' %(lib, temp, trailing, r)
79+
)
80+
commands.append('%sio_gdal 1 -GRIDS "%s_%s2.sgrd" -FORMAT 1 -TYPE 0 -FILE "%s"' %(lib, temp, trailing, g)
81+
)
82+
commands.append('%sio_gdal 1 -GRIDS "%s_%s3.sgrd" -FORMAT 1 -TYPE 0 -FILE "%s"' %(lib, temp, trailing, b)
83+
)
84+
9785

9886
SagaUtils.createSagaBatchJobFileFromSagaCommands(commands)
9987
SagaUtils.executeSaga(progress)

0 commit comments

Comments
 (0)