Skip to content

Commit

Permalink
Update tests for gdal warp
Browse files Browse the repository at this point in the history
  • Loading branch information
DelazJ authored and nyalldawson committed Jun 11, 2019
1 parent 1e2b59a commit 502e18f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 20 deletions.
35 changes: 23 additions & 12 deletions python/plugins/processing/tests/GdalAlgorithmsTest.py
Expand Up @@ -2145,7 +2145,7 @@ def testWarp(self):
'SOURCE_CRS': 'EPSG:3111',
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
['gdalwarp',
'-s_srs EPSG:3111 -t_srs EPSG:4326 -r near -of JPEG ' +
'-s_srs EPSG:3111 -r near -of JPEG ' +
source + ' ' +
outdir + '/check.jpg'])
# with None NODATA value
Expand All @@ -2155,7 +2155,7 @@ def testWarp(self):
'SOURCE_CRS': 'EPSG:3111',
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
['gdalwarp',
'-s_srs EPSG:3111 -t_srs EPSG:4326 -r near -of JPEG ' +
'-s_srs EPSG:3111 -r near -of JPEG ' +
source + ' ' +
outdir + '/check.jpg'])
# with NODATA value
Expand All @@ -2165,7 +2165,7 @@ def testWarp(self):
'SOURCE_CRS': 'EPSG:3111',
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
['gdalwarp',
'-s_srs EPSG:3111 -t_srs EPSG:4326 -dstnodata 9999.0 -r near -of JPEG ' +
'-s_srs EPSG:3111 -dstnodata 9999.0 -r near -of JPEG ' +
source + ' ' +
outdir + '/check.jpg'])
# with "0" NODATA value
Expand All @@ -2175,7 +2175,7 @@ def testWarp(self):
'SOURCE_CRS': 'EPSG:3111',
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
['gdalwarp',
'-s_srs EPSG:3111 -t_srs EPSG:4326 -dstnodata 0.0 -r near -of JPEG ' +
'-s_srs EPSG:3111 -dstnodata 0.0 -r near -of JPEG ' +
source + ' ' +
outdir + '/check.jpg'])
# with "0" NODATA value and custom data type
Expand All @@ -2186,7 +2186,18 @@ def testWarp(self):
'SOURCE_CRS': 'EPSG:3111',
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
['gdalwarp',
'-s_srs EPSG:3111 -t_srs EPSG:4326 -dstnodata 0.0 -r near -ot Float32 -of JPEG ' +
'-s_srs EPSG:3111 -dstnodata 0.0 -r near -ot Float32 -of JPEG ' +
source + ' ' +
outdir + '/check.jpg'])

# with target using EPSG
self.assertEqual(
alg.getConsoleCommands({'INPUT': source,
'SOURCE_CRS': 'EPSG:3111',
'TARGET_CRS': 'EPSG:4326',
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
['gdalwarp',
'-s_srs EPSG:3111 -t_srs EPSG:4326 -r near -of JPEG ' +
source + ' ' +
outdir + '/check.jpg'])

Expand Down Expand Up @@ -2232,7 +2243,7 @@ def testWarp(self):
'TARGET_RESOLUTION': None,
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
['gdalwarp',
'-s_srs EPSG:3111 -t_srs EPSG:4326 -r near -of JPEG ' +
'-s_srs EPSG:3111 -r near -of JPEG ' +
source + ' ' +
outdir + '/check.jpg'])

Expand All @@ -2243,7 +2254,7 @@ def testWarp(self):
'TARGET_RESOLUTION': 10.0,
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
['gdalwarp',
'-s_srs EPSG:3111 -t_srs EPSG:4326 -tr 10.0 10.0 -r near -of JPEG ' +
'-s_srs EPSG:3111 -tr 10.0 10.0 -r near -of JPEG ' +
source + ' ' +
outdir + '/check.jpg'])

Expand All @@ -2254,7 +2265,7 @@ def testWarp(self):
'TARGET_RESOLUTION': 0.0,
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
['gdalwarp',
'-s_srs EPSG:3111 -t_srs EPSG:4326 -r near -of JPEG ' +
'-s_srs EPSG:3111 -r near -of JPEG ' +
source + ' ' +
outdir + '/check.jpg'])

Expand All @@ -2264,7 +2275,7 @@ def testWarp(self):
'EXTRA': '-dstalpha',
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
['gdalwarp',
'-t_srs EPSG:4326 -r near -of JPEG -dstalpha ' +
'-r near -of JPEG -dstalpha ' +
source + ' ' +
outdir + '/check.jpg'])

Expand All @@ -2273,7 +2284,7 @@ def testWarp(self):
'EXTRA': '-dstalpha -srcnodata -9999',
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
['gdalwarp',
'-t_srs EPSG:4326 -r near -of JPEG -dstalpha -srcnodata -9999 ' +
'-r near -of JPEG -dstalpha -srcnodata -9999 ' +
source + ' ' +
outdir + '/check.jpg'])

Expand All @@ -2282,7 +2293,7 @@ def testWarp(self):
'EXTRA': '-dstalpha -srcnodata "-9999 -8888"',
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
['gdalwarp',
'-t_srs EPSG:4326 -r near -of JPEG -dstalpha -srcnodata "-9999 -8888" ' +
'-r near -of JPEG -dstalpha -srcnodata "-9999 -8888" ' +
source + ' ' +
outdir + '/check.jpg'])

Expand All @@ -2291,7 +2302,7 @@ def testWarp(self):
'EXTRA': '',
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
['gdalwarp',
'-t_srs EPSG:4326 -r near -of JPEG ' +
'-r near -of JPEG ' +
source + ' ' +
outdir + '/check.jpg'])

Expand Down
Expand Up @@ -417,22 +417,19 @@ tests:
type: rasterhash

- algorithm: gdal:warpreproject
name: Warp (gdalwarp)
name: Test (gdal:warpreproject)
params:
DATA_TYPE: 6
DATA_TYPE: 0
EXTRA: ''
INPUT:
name: dem.tif
type: raster
MULTITHREADING: false
NODATA: 0.0
OPTIONS: ''
RESAMPLING: 4
SOURCE_CRS: EPSG:4326
TARGET_CRS: EPSG:3857
TARGET_RESOLUTION: 0.0
RESAMPLING: 0
results:
OUTPUT:
hash: 77045222f6f9d8e5fda795d1d5288eae400c51522e621861aeab68e0
hash: 6ced822cc490c7a3d9346b6c8cd4b282eb4e2a9fdd6e7371f6174117
type: rasterhash

# - algorithm: gdal:merge
Expand Down

0 comments on commit 502e18f

Please sign in to comment.