Skip to content

Commit

Permalink
[processing] Add unit tests for reclassify using nulls
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 13, 2018
1 parent 7c1dcfa commit 0da3069
Show file tree
Hide file tree
Showing 3 changed files with 112 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_nulls.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_nulls fid="1">
<ogr:min xsi:nil="true"/>
<ogr:max>850</ogr:max>
<ogr:value>3</ogr:value>
</ogr:reclassify_layer_nulls>
</gml:featureMember>
<gml:featureMember>
<ogr:reclassify_layer_nulls fid="2">
<ogr:min>850</ogr:min>
<ogr:max xsi:nil="true"/>
<ogr:value>4</ogr:value>
</ogr:reclassify_layer_nulls>
</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_nulls" type="ogr:reclassify_layer_nulls_Type" substitutionGroup="gml:_Feature"/>
<xs:complexType name="reclassify_layer_nulls_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>
46 changes: 46 additions & 0 deletions python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml
Expand Up @@ -5581,6 +5581,29 @@ tests:
hash: cea558f7e99a0564fef92a96cd8d6b59707d019f1751cb600ab00850
type: rasterhash

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

- algorithm: native:reclassifybylayer
name: Reclassify by layer
params:
Expand All @@ -5602,5 +5625,28 @@ tests:
hash: c29d14f71e8686f7445d53be646fce84702644f159fd0164ac38e861
type: rasterhash

- algorithm: native:reclassifybylayer
name: Reclassify by layer with nulls
params:
DATA_TYPE: 5
INPUT_RASTER:
name: raster.tif
type: raster
INPUT_TABLE:
name: custom/reclassify_layer_nulls.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 0da3069

Please sign in to comment.