Skip to content

Commit

Permalink
Add tests for processing reclassification algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 13, 2018
1 parent 8729073 commit 7a15783
Show file tree
Hide file tree
Showing 3 changed files with 169 additions and 0 deletions.
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ogr.maptools.org/ reclassify_layer.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy><gml:null>missing</gml:null></gml:boundedBy>

<gml:featureMember>
<ogr:reclassify_layer fid="reclassify_layer.0">
<ogr:min>1</ogr:min>
<ogr:max>850</ogr:max>
<ogr:value>3</ogr:value>
</ogr:reclassify_layer>
</gml:featureMember>
<gml:featureMember>
<ogr:reclassify_layer fid="reclassify_layer.1">
<ogr:min>850</ogr:min>
<ogr:max>1000</ogr:max>
<ogr:value>4</ogr:value>
</ogr:reclassify_layer>
</gml:featureMember>
</ogr:FeatureCollection>
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://ogr.maptools.org/" xmlns:ogr="http://ogr.maptools.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified" version="1.0">
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/>
<xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
<xs:complexType name="FeatureCollectionType">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureCollectionType">
<xs:attribute name="lockId" type="xs:string" use="optional"/>
<xs:attribute name="scope" type="xs:string" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="reclassify_layer" type="ogr:reclassify_layer_Type" substitutionGroup="gml:_Feature"/>
<xs:complexType name="reclassify_layer_Type">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="min" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:totalDigits value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="max" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:totalDigits value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="value" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:totalDigits value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
103 changes: 103 additions & 0 deletions python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml
Expand Up @@ -5499,5 +5499,108 @@ tests:
name: expected/variable_width_buffer_by_m.gml
type: vector

- algorithm: native:reclassifybytable
name: Reclassify by table
params:
INPUT_RASTER:
name: raster.tif
type: raster
NODATA_FOR_MISSING: false
NO_DATA: -9999.0
RANGE_BOUNDARIES: 0
RASTER_BAND: 1
TABLE:
- 1
- 850
- 3
- 850
- 1000
- 4
results:
OUTPUT:
hash: c29d14f71e8686f7445d53be646fce84702644f159fd0164ac38e861
type: rasterhash

- algorithm: native:reclassifybytable
name: Reclassify by table min <=
params:
INPUT_RASTER:
name: raster.tif
type: raster
NODATA_FOR_MISSING: false
NO_DATA: -9999.0
RANGE_BOUNDARIES: 1
RASTER_BAND: 1
TABLE:
- 1
- 843
- 3
- 843
- 1000
- 4
results:
OUTPUT:
hash: f055b582e4e5abcfa9cce6a69ceb7fac54791ad0d980003f1a23f4b1
type: rasterhash

- algorithm: native:reclassifybytable
name: Reclassify by table use original
params:
INPUT_RASTER:
name: raster.tif
type: raster
NODATA_FOR_MISSING: false
NO_DATA: -9999.0
RANGE_BOUNDARIES: 0
RASTER_BAND: 1
TABLE:
- 1
- 843
- 3
results:
OUTPUT:
hash: 4398ddc5d24b3bf968d9a6e0fbd800344b20880a57915bd50a90e1ba
type: rasterhash

- algorithm: native:reclassifybytable
name: Reclassify by table use nodata
params:
INPUT_RASTER:
name: raster.tif
type: raster
NODATA_FOR_MISSING: true
NO_DATA: -9999.0
RANGE_BOUNDARIES: 0
RASTER_BAND: 1
TABLE:
- 1
- 843
- 3
results:
OUTPUT:
hash: cea558f7e99a0564fef92a96cd8d6b59707d019f1751cb600ab00850
type: rasterhash

- algorithm: native:reclassifybylayer
name: Reclassify by layer
params:
INPUT_RASTER:
name: raster.tif
type: raster
INPUT_TABLE:
name: custom/reclassify_layer.gml
type: vector
MAX_FIELD: max
MIN_FIELD: min
NODATA_FOR_MISSING: false
NO_DATA: -9999.0
RANGE_BOUNDARIES: 0
RASTER_BAND: 1
VALUE_FIELD: value
results:
OUTPUT:
hash: c29d14f71e8686f7445d53be646fce84702644f159fd0164ac38e861
type: rasterhash


# See ../README.md for a description of the file format

0 comments on commit 7a15783

Please sign in to comment.