-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TEST: add test of OTB BandMath application in processing
(cherry picked from commit 1e7018f)
- Loading branch information
1 parent
2c78c54
commit b1c3ca8
Showing
6 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
Binary file added
BIN
+1.28 KB
python/plugins/processing/tests/testdata/expected/otb/raster_bandmath.tif
Binary file not shown.
10 changes: 10 additions & 0 deletions
10
python/plugins/processing/tests/testdata/expected/otb/raster_bandmath.tif.aux.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 18 additions & 0 deletions
18
python/plugins/processing/tests/testdata/otb_algorithm_tests.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|