Skip to content

Commit 7a15783

Browse files
committed
Add tests for processing reclassification algorithms
1 parent 8729073 commit 7a15783

File tree

3 files changed

+169
-0
lines changed

3 files changed

+169
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ogr:FeatureCollection
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://ogr.maptools.org/ reclassify_layer.xsd"
5+
xmlns:ogr="http://ogr.maptools.org/"
6+
xmlns:gml="http://www.opengis.net/gml">
7+
<gml:boundedBy><gml:null>missing</gml:null></gml:boundedBy>
8+
9+
<gml:featureMember>
10+
<ogr:reclassify_layer fid="reclassify_layer.0">
11+
<ogr:min>1</ogr:min>
12+
<ogr:max>850</ogr:max>
13+
<ogr:value>3</ogr:value>
14+
</ogr:reclassify_layer>
15+
</gml:featureMember>
16+
<gml:featureMember>
17+
<ogr:reclassify_layer fid="reclassify_layer.1">
18+
<ogr:min>850</ogr:min>
19+
<ogr:max>1000</ogr:max>
20+
<ogr:value>4</ogr:value>
21+
</ogr:reclassify_layer>
22+
</gml:featureMember>
23+
</ogr:FeatureCollection>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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">
3+
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/>
4+
<xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
5+
<xs:complexType name="FeatureCollectionType">
6+
<xs:complexContent>
7+
<xs:extension base="gml:AbstractFeatureCollectionType">
8+
<xs:attribute name="lockId" type="xs:string" use="optional"/>
9+
<xs:attribute name="scope" type="xs:string" use="optional"/>
10+
</xs:extension>
11+
</xs:complexContent>
12+
</xs:complexType>
13+
<xs:element name="reclassify_layer" type="ogr:reclassify_layer_Type" substitutionGroup="gml:_Feature"/>
14+
<xs:complexType name="reclassify_layer_Type">
15+
<xs:complexContent>
16+
<xs:extension base="gml:AbstractFeatureType">
17+
<xs:sequence>
18+
<xs:element name="min" nillable="true" minOccurs="0" maxOccurs="1">
19+
<xs:simpleType>
20+
<xs:restriction base="xs:integer">
21+
<xs:totalDigits value="10"/>
22+
</xs:restriction>
23+
</xs:simpleType>
24+
</xs:element>
25+
<xs:element name="max" nillable="true" minOccurs="0" maxOccurs="1">
26+
<xs:simpleType>
27+
<xs:restriction base="xs:integer">
28+
<xs:totalDigits value="10"/>
29+
</xs:restriction>
30+
</xs:simpleType>
31+
</xs:element>
32+
<xs:element name="value" nillable="true" minOccurs="0" maxOccurs="1">
33+
<xs:simpleType>
34+
<xs:restriction base="xs:integer">
35+
<xs:totalDigits value="10"/>
36+
</xs:restriction>
37+
</xs:simpleType>
38+
</xs:element>
39+
</xs:sequence>
40+
</xs:extension>
41+
</xs:complexContent>
42+
</xs:complexType>
43+
</xs:schema>

python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml

+103
Original file line numberDiff line numberDiff line change
@@ -5499,5 +5499,108 @@ tests:
54995499
name: expected/variable_width_buffer_by_m.gml
55005500
type: vector
55015501

5502+
- algorithm: native:reclassifybytable
5503+
name: Reclassify by table
5504+
params:
5505+
INPUT_RASTER:
5506+
name: raster.tif
5507+
type: raster
5508+
NODATA_FOR_MISSING: false
5509+
NO_DATA: -9999.0
5510+
RANGE_BOUNDARIES: 0
5511+
RASTER_BAND: 1
5512+
TABLE:
5513+
- 1
5514+
- 850
5515+
- 3
5516+
- 850
5517+
- 1000
5518+
- 4
5519+
results:
5520+
OUTPUT:
5521+
hash: c29d14f71e8686f7445d53be646fce84702644f159fd0164ac38e861
5522+
type: rasterhash
5523+
5524+
- algorithm: native:reclassifybytable
5525+
name: Reclassify by table min <=
5526+
params:
5527+
INPUT_RASTER:
5528+
name: raster.tif
5529+
type: raster
5530+
NODATA_FOR_MISSING: false
5531+
NO_DATA: -9999.0
5532+
RANGE_BOUNDARIES: 1
5533+
RASTER_BAND: 1
5534+
TABLE:
5535+
- 1
5536+
- 843
5537+
- 3
5538+
- 843
5539+
- 1000
5540+
- 4
5541+
results:
5542+
OUTPUT:
5543+
hash: f055b582e4e5abcfa9cce6a69ceb7fac54791ad0d980003f1a23f4b1
5544+
type: rasterhash
5545+
5546+
- algorithm: native:reclassifybytable
5547+
name: Reclassify by table use original
5548+
params:
5549+
INPUT_RASTER:
5550+
name: raster.tif
5551+
type: raster
5552+
NODATA_FOR_MISSING: false
5553+
NO_DATA: -9999.0
5554+
RANGE_BOUNDARIES: 0
5555+
RASTER_BAND: 1
5556+
TABLE:
5557+
- 1
5558+
- 843
5559+
- 3
5560+
results:
5561+
OUTPUT:
5562+
hash: 4398ddc5d24b3bf968d9a6e0fbd800344b20880a57915bd50a90e1ba
5563+
type: rasterhash
5564+
5565+
- algorithm: native:reclassifybytable
5566+
name: Reclassify by table use nodata
5567+
params:
5568+
INPUT_RASTER:
5569+
name: raster.tif
5570+
type: raster
5571+
NODATA_FOR_MISSING: true
5572+
NO_DATA: -9999.0
5573+
RANGE_BOUNDARIES: 0
5574+
RASTER_BAND: 1
5575+
TABLE:
5576+
- 1
5577+
- 843
5578+
- 3
5579+
results:
5580+
OUTPUT:
5581+
hash: cea558f7e99a0564fef92a96cd8d6b59707d019f1751cb600ab00850
5582+
type: rasterhash
5583+
5584+
- algorithm: native:reclassifybylayer
5585+
name: Reclassify by layer
5586+
params:
5587+
INPUT_RASTER:
5588+
name: raster.tif
5589+
type: raster
5590+
INPUT_TABLE:
5591+
name: custom/reclassify_layer.gml
5592+
type: vector
5593+
MAX_FIELD: max
5594+
MIN_FIELD: min
5595+
NODATA_FOR_MISSING: false
5596+
NO_DATA: -9999.0
5597+
RANGE_BOUNDARIES: 0
5598+
RASTER_BAND: 1
5599+
VALUE_FIELD: value
5600+
results:
5601+
OUTPUT:
5602+
hash: c29d14f71e8686f7445d53be646fce84702644f159fd0164ac38e861
5603+
type: rasterhash
5604+
55025605

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

0 commit comments

Comments
 (0)