mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-07 00:15:48 -04:00
TEST: add test of OTB BandMath application in processing
This commit is contained in:
parent
8c7d772f22
commit
1e7018f0cc
@ -12,4 +12,6 @@ IF(ENABLE_TESTS)
|
||||
ADD_PYTHON_TEST(ProcessingGdalAlgorithmsTest GdalAlgorithmsTest.py)
|
||||
ADD_PYTHON_TEST(ProcessingGrass7AlgorithmsImageryTest Grass7AlgorithmsImageryTest.py)
|
||||
ADD_PYTHON_TEST(ProcessingGrass7AlgorithmsRasterTest Grass7AlgorithmsRasterTest.py)
|
||||
#TODO uncomment when OTB is installed on Travis CI instance
|
||||
#ADD_PYTHON_TEST(ProcessingOTBAlgorithmsTest OTBAlgorithmsTest.py)
|
||||
ENDIF(ENABLE_TESTS)
|
||||
|
58
python/plugins/processing/tests/OTBAlgorithmsTest.py
Normal file
58
python/plugins/processing/tests/OTBAlgorithmsTest.py
Normal file
@ -0,0 +1,58 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
***************************************************************************
|
||||
OTBAlgorithmTests.py
|
||||
---------------------
|
||||
Date : August 2016
|
||||
Copyright : (C) 2016 by Manuel Grizonnet
|
||||
Email : manuel.grizonnet@cnes.fr
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************
|
||||
"""
|
||||
|
||||
__author__ = 'Manuel Grizonnet'
|
||||
__date__ = 'August 2016'
|
||||
__copyright__ = '(C) 2016, Manuel Grizonnet'
|
||||
|
||||
# This will get replaced with a git SHA1 when you do a git archive
|
||||
|
||||
__revision__ = ':%H$'
|
||||
|
||||
import AlgorithmsTestBase
|
||||
|
||||
import nose2
|
||||
import shutil
|
||||
|
||||
from qgis.testing import (
|
||||
start_app,
|
||||
unittest
|
||||
)
|
||||
|
||||
|
||||
class TestOTBAlgorithms(unittest.TestCase, AlgorithmsTestBase.AlgorithmsTest):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
start_app()
|
||||
from processing.core.Processing import Processing
|
||||
Processing.initialize()
|
||||
cls.cleanup_paths = []
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
for path in cls.cleanup_paths:
|
||||
shutil.rmtree(path)
|
||||
|
||||
def test_definition_file(self):
|
||||
return 'otb_algorithm_tests.yaml'
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
nose2.main()
|
20
python/plugins/processing/tests/data/raster.tif.aux.xml
Normal file
20
python/plugins/processing/tests/data/raster.tif.aux.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<PAMDataset>
|
||||
<PAMRasterBand band="1">
|
||||
<Histograms>
|
||||
<HistItem>
|
||||
<HistMin>825.8245192307693</HistMin>
|
||||
<HistMax>899.1754807692307</HistMax>
|
||||
<BucketCount>208</BucketCount>
|
||||
<IncludeOutOfRange>0</IncludeOutOfRange>
|
||||
<Approximate>0</Approximate>
|
||||
<HistCounts>4|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|6|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|6|0|0|0|0|0|4|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|9|0|0|0|0|0|6|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|10|0|0|0|0|4|0|0|0|0|0|0|0|0|6|0|0|0|0|9|0|0|0|0|0|6|0|0|0|0|0|0|0|0|0|0|4|0|0|9|0|0|0|0|0|0|0|0|0|0|0|0|0|6|0|0|0|0|0|6|0|0|6|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|13|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|6</HistCounts>
|
||||
</HistItem>
|
||||
</Histograms>
|
||||
<Metadata>
|
||||
<MDI key="STATISTICS_MAXIMUM">899</MDI>
|
||||
<MDI key="STATISTICS_MEAN">865.86666666667</MDI>
|
||||
<MDI key="STATISTICS_MINIMUM">826</MDI>
|
||||
<MDI key="STATISTICS_STDDEV">17.808206597584</MDI>
|
||||
</Metadata>
|
||||
</PAMRasterBand>
|
||||
</PAMDataset>
|
BIN
python/plugins/processing/tests/testdata/expected/otb/raster_bandmath.tif
vendored
Normal file
BIN
python/plugins/processing/tests/testdata/expected/otb/raster_bandmath.tif
vendored
Normal file
Binary file not shown.
10
python/plugins/processing/tests/testdata/expected/otb/raster_bandmath.tif.aux.xml
vendored
Normal file
10
python/plugins/processing/tests/testdata/expected/otb/raster_bandmath.tif.aux.xml
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<PAMDataset>
|
||||
<PAMRasterBand band="1">
|
||||
<Metadata>
|
||||
<MDI key="STATISTICS_MAXIMUM">255</MDI>
|
||||
<MDI key="STATISTICS_MEAN">4.5535714285714</MDI>
|
||||
<MDI key="STATISTICS_MINIMUM">0</MDI>
|
||||
<MDI key="STATISTICS_STDDEV">33.770189539453</MDI>
|
||||
</Metadata>
|
||||
</PAMRasterBand>
|
||||
</PAMDataset>
|
18
python/plugins/processing/tests/testdata/otb_algorithm_tests.yaml
vendored
Normal file
18
python/plugins/processing/tests/testdata/otb_algorithm_tests.yaml
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
# See ../README.md for a description of the file format
|
||||
|
||||
tests:
|
||||
- algorithm: otb:bandmath
|
||||
name: Test (otb:bandmath)
|
||||
params:
|
||||
!!python/unicode '-exp': im1b1==826?255:0
|
||||
!!python/unicode '-il':
|
||||
params:
|
||||
- name: raster.tif
|
||||
type: raster
|
||||
type: multi
|
||||
!!python/unicode '-ram': 128
|
||||
results:
|
||||
!!python/unicode '-out':
|
||||
hash: a8acb8da3cf40a156fe26f815588a7cbf8f3c8f6b3c226968b1eab1e
|
||||
type: rasterhash
|
||||
|
Loading…
x
Reference in New Issue
Block a user