Skip to content

Commit

Permalink
[processing][saga] Fix definition of Multiple regression points/grids…
Browse files Browse the repository at this point in the history
… alg

Fixes #21146
  • Loading branch information
nyalldawson committed Feb 1, 2019
1 parent 56e465c commit 4f8e231
Show file tree
Hide file tree
Showing 22 changed files with 302 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ Multiple Regression Analysis (Points and Predictor Grids)
statistics_regression
QgsProcessingParameterMultipleLayers|PREDICTORS|Predictors|3|None|False
QgsProcessingParameterFeatureSource|POINTS|Points|-1|None|False
QgsProcessingParameterFeatureSource|ATTRIBUTE|Dependent Variable|5|None|False
QgsProcessingParameterFeatureSource|INFO_COEFF|Details: Coefficients|5|None|True
QgsProcessingParameterFeatureSource|INFO_MODEL|Details: Model|5|None|True
QgsProcessingParameterFeatureSource|INFO_STEPS|Details: Steps|5|None|True
QgsProcessingParameterVectorDestination|RESIDUALS|Residuals
QgsProcessingParameterField|ATTRIBUTE|Dependent Variable|None|POINTS|-1|False|False
QgsProcessingParameterVectorDestination|INFO_COEFF|Details: Coefficients|5|None|True|True
QgsProcessingParameterVectorDestination|INFO_MODEL|Details: Model|5|None|True|True
QgsProcessingParameterVectorDestination|INFO_STEPS|Details: Steps|5|None|True|True
QgsProcessingParameterVectorDestination|RESIDUALS|Residuals|-1|None|True|True
QgsProcessingParameterRasterDestination|REGRESSION|Regression
QgsProcessingParameterRasterDestination|REGRESCORR|Regression with Residual Correction
QgsProcessingParameterRasterDestination|REGRESCORR|Regression with Residual Correction|None|True|True
QgsProcessingParameterEnum|RESAMPLING|Resampling|[0] Nearest Neighbour;[1] Bilinear Interpolation;[2] Bicubic Spline Interpolation;[3] B-Spline Interpolation|False|3
QgsProcessingParameterBoolean|COORD_X|Include X Coordinate|False
QgsProcessingParameterBoolean|COORD_Y|Include Y Coordinate|False
Expand All @@ -17,4 +17,4 @@ QgsProcessingParameterEnum|METHOD|Method|[0] include all;[1] forward;[2] backwar
QgsProcessingParameterNumber|P_VALUE|Significance Level|QgsProcessingParameterNumber.Double|5.000000|False|0.000000|100.000000
QgsProcessingParameterEnum|CROSSVAL|Cross Validation|[0] none;[1] leave one out;[2] 2-fold;[3] k-fold|False|0
QgsProcessingParameterNumber|CROSSVAL_K|Cross Validation Subsamples|QgsProcessingParameterNumber.Integer|10|False|2|None
QgsProcessingParameterEnum|RESIDUAL_COR|Residual Interpolation|[0] Multleve B-Spline Interpolation;[1] Inverse Distance Weighted|False|0
QgsProcessingParameterEnum|RESIDUAL_COR|Residual Interpolation|[0] Multleve B-Spline Interpolation;[1] Inverse Distance Weighted|False|0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
UTF-8
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<SAGA_METADATA>
<HISTORY saga-version="2.3.1">
<MODULE library="statistics_regression" id="1" name="Multiple Regression Analysis (Points and Predictor Grids)">
<OPTION type="grid_system" id="PARAMETERS_GRID_SYSTEM" name="Grid system">
<CELLSIZE>0.0001</CELLSIZE>
<XMIN>18.666347944200002</XMIN>
<XMAX>18.7035479442</XMAX>
<YMIN>45.7767514376</YMIN>
<YMAX>45.8116514376</YMAX>
</OPTION>
<OPTION type="table_field" id="ATTRIBUTE" name="Dependent Variable" index="1">rvalue_1</OPTION>
<OPTION type="choice" id="RESAMPLING" name="Resampling" index="3">B-Spline Interpolation</OPTION>
<OPTION type="boolean" id="COORD_X" name="Include X Coordinate">FALSE</OPTION>
<OPTION type="boolean" id="COORD_Y" name="Include Y Coordinate">FALSE</OPTION>
<OPTION type="boolean" id="INTERCEPT" name="Intercept">TRUE</OPTION>
<OPTION type="choice" id="METHOD" name="Method" index="3">stepwise</OPTION>
<OPTION type="double" id="P_VALUE" name="Significance Level">5.000000</OPTION>
<OPTION type="choice" id="CROSSVAL" name="Cross Validation" index="0">none</OPTION>
<OPTION type="choice" id="RESIDUAL_COR" name="Residual Interpolation" index="0">Multleve B-Spline Interpolation</OPTION>
<INPUT_LIST type="grid_list" id="PREDICTORS" name="Predictors" system="PARAMETERS_GRID_SYSTEM">
<dem type="grid_list" id="PREDICTORS" name="Predictors" system="PARAMETERS_GRID_SYSTEM">
<FILE>/tmp/processing_158a4797a951407ca275f957a94862a4/e678b6f2c3484cf9b60adafa5e69b1d6/dem.sgrd</FILE>
</dem>
</INPUT_LIST>
<INPUT type="shapes" id="POINTS" name="Points">
<FILE>/tmp/processing_158a4797a951407ca275f957a94862a4/f2045b740e8e466293cb61f78c148a83/POINTS.shp</FILE>
</INPUT>
<OUTPUT type="table" id="INFO_COEFF" name="Details: Coefficients">MLRA Coefficients</OUTPUT>
</MODULE>
</HISTORY>
<SOURCE>
<FILE>/home/nyall/dev/QGIS/python/plugins/processing/tests/testdata/expected/saga/multiple_regression_points_grids_coef.dbf</FILE>
<DATABASE>
<FIELDS>
<FIELD TYPE="INTEGER">VAR_ID</FIELD>
<FIELD TYPE="STRING">VAR_NAME</FIELD>
<FIELD TYPE="DOUBLE">REGCOEFF</FIELD>
<FIELD TYPE="DOUBLE">R</FIELD>
<FIELD TYPE="DOUBLE">R2</FIELD>
<FIELD TYPE="DOUBLE">R2_ADJ</FIELD>
<FIELD TYPE="DOUBLE">STD_ERROR</FIELD>
<FIELD TYPE="DOUBLE">T</FIELD>
<FIELD TYPE="DOUBLE">SIG</FIELD>
<FIELD TYPE="DOUBLE">P</FIELD>
</FIELDS>
</DATABASE>
<PROJECTION></PROJECTION>
</SOURCE>
<DESCRIPTION></DESCRIPTION>
</SAGA_METADATA>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<SAGA_METADATA>
<HISTORY saga-version="2.3.1">
<MODULE library="statistics_regression" id="1" name="Multiple Regression Analysis (Points and Predictor Grids)">
<OPTION type="grid_system" id="PARAMETERS_GRID_SYSTEM" name="Grid system">
<CELLSIZE>0.0001</CELLSIZE>
<XMIN>18.666347944200002</XMIN>
<XMAX>18.7035479442</XMAX>
<YMIN>45.7767514376</YMIN>
<YMAX>45.8116514376</YMAX>
</OPTION>
<OPTION type="table_field" id="ATTRIBUTE" name="Dependent Variable" index="1">rvalue_1</OPTION>
<OPTION type="choice" id="RESAMPLING" name="Resampling" index="3">B-Spline Interpolation</OPTION>
<OPTION type="boolean" id="COORD_X" name="Include X Coordinate">FALSE</OPTION>
<OPTION type="boolean" id="COORD_Y" name="Include Y Coordinate">FALSE</OPTION>
<OPTION type="boolean" id="INTERCEPT" name="Intercept">TRUE</OPTION>
<OPTION type="choice" id="METHOD" name="Method" index="3">stepwise</OPTION>
<OPTION type="double" id="P_VALUE" name="Significance Level">5.000000</OPTION>
<OPTION type="choice" id="CROSSVAL" name="Cross Validation" index="0">none</OPTION>
<OPTION type="choice" id="RESIDUAL_COR" name="Residual Interpolation" index="0">Multleve B-Spline Interpolation</OPTION>
<INPUT_LIST type="grid_list" id="PREDICTORS" name="Predictors" system="PARAMETERS_GRID_SYSTEM">
<dem type="grid_list" id="PREDICTORS" name="Predictors" system="PARAMETERS_GRID_SYSTEM">
<FILE>/tmp/processing_158a4797a951407ca275f957a94862a4/e678b6f2c3484cf9b60adafa5e69b1d6/dem.sgrd</FILE>
</dem>
</INPUT_LIST>
<INPUT type="shapes" id="POINTS" name="Points">
<FILE>/tmp/processing_158a4797a951407ca275f957a94862a4/f2045b740e8e466293cb61f78c148a83/POINTS.shp</FILE>
</INPUT>
<OUTPUT type="table" id="INFO_MODEL" name="Details: Model">MLRA Model</OUTPUT>
</MODULE>
</HISTORY>
<SOURCE>
<FILE>/home/nyall/dev/QGIS/python/plugins/processing/tests/testdata/expected/saga/multiple_regression_points_grids_model.dbf</FILE>
<DATABASE>
<FIELDS>
<FIELD TYPE="STRING">PARAMETER</FIELD>
<FIELD TYPE="DOUBLE">VALUE</FIELD>
</FIELDS>
</DATABASE>
<PROJECTION></PROJECTION>
</SOURCE>
<DESCRIPTION></DESCRIPTION>
</SAGA_METADATA>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<SAGA_METADATA>
<HISTORY saga-version="2.3.1">
<MODULE library="statistics_regression" id="1" name="Multiple Regression Analysis (Points and Predictor Grids)">
<OPTION type="grid_system" id="PARAMETERS_GRID_SYSTEM" name="Grid system">
<CELLSIZE>0.0001</CELLSIZE>
<XMIN>18.666347944200002</XMIN>
<XMAX>18.7035479442</XMAX>
<YMIN>45.7767514376</YMIN>
<YMAX>45.8116514376</YMAX>
</OPTION>
<OPTION type="table_field" id="ATTRIBUTE" name="Dependent Variable" index="1">rvalue_1</OPTION>
<OPTION type="choice" id="RESAMPLING" name="Resampling" index="3">B-Spline Interpolation</OPTION>
<OPTION type="boolean" id="COORD_X" name="Include X Coordinate">FALSE</OPTION>
<OPTION type="boolean" id="COORD_Y" name="Include Y Coordinate">FALSE</OPTION>
<OPTION type="boolean" id="INTERCEPT" name="Intercept">TRUE</OPTION>
<OPTION type="choice" id="METHOD" name="Method" index="3">stepwise</OPTION>
<OPTION type="double" id="P_VALUE" name="Significance Level">5.000000</OPTION>
<OPTION type="choice" id="CROSSVAL" name="Cross Validation" index="0">none</OPTION>
<OPTION type="choice" id="RESIDUAL_COR" name="Residual Interpolation" index="0">Multleve B-Spline Interpolation</OPTION>
<INPUT_LIST type="grid_list" id="PREDICTORS" name="Predictors" system="PARAMETERS_GRID_SYSTEM">
<dem type="grid_list" id="PREDICTORS" name="Predictors" system="PARAMETERS_GRID_SYSTEM">
<FILE>/tmp/processing_158a4797a951407ca275f957a94862a4/e678b6f2c3484cf9b60adafa5e69b1d6/dem.sgrd</FILE>
</dem>
</INPUT_LIST>
<INPUT type="shapes" id="POINTS" name="Points">
<FILE>/tmp/processing_158a4797a951407ca275f957a94862a4/f2045b740e8e466293cb61f78c148a83/POINTS.shp</FILE>
</INPUT>
<OUTPUT type="shapes" id="RESIDUALS" name="Residuals">POINTS.rvalue_1 [Residuals]</OUTPUT>
</MODULE>
</HISTORY>
<SOURCE>
<FILE></FILE>
<DATABASE>
<FIELDS>
<FIELD TYPE="DOUBLE">rvalue_1</FIELD>
<FIELD TYPE="DOUBLE">TREND</FIELD>
<FIELD TYPE="DOUBLE">RESIDUAL</FIELD>
</FIELDS>
</DATABASE>
<PROJECTION></PROJECTION>
</SOURCE>
<DESCRIPTION></DESCRIPTION>
</SAGA_METADATA>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<SAGA_METADATA>
<HISTORY saga-version="2.3.1">
<MODULE library="statistics_regression" id="1" name="Multiple Regression Analysis (Points and Predictor Grids)">
<OPTION type="grid_system" id="PARAMETERS_GRID_SYSTEM" name="Grid system">
<CELLSIZE>0.0001</CELLSIZE>
<XMIN>18.666347944200002</XMIN>
<XMAX>18.7035479442</XMAX>
<YMIN>45.7767514376</YMIN>
<YMAX>45.8116514376</YMAX>
</OPTION>
<OPTION type="table_field" id="ATTRIBUTE" name="Dependent Variable" index="1">rvalue_1</OPTION>
<OPTION type="choice" id="RESAMPLING" name="Resampling" index="3">B-Spline Interpolation</OPTION>
<OPTION type="boolean" id="COORD_X" name="Include X Coordinate">FALSE</OPTION>
<OPTION type="boolean" id="COORD_Y" name="Include Y Coordinate">FALSE</OPTION>
<OPTION type="boolean" id="INTERCEPT" name="Intercept">TRUE</OPTION>
<OPTION type="choice" id="METHOD" name="Method" index="3">stepwise</OPTION>
<OPTION type="double" id="P_VALUE" name="Significance Level">5.000000</OPTION>
<OPTION type="choice" id="CROSSVAL" name="Cross Validation" index="0">none</OPTION>
<OPTION type="choice" id="RESIDUAL_COR" name="Residual Interpolation" index="0">Multleve B-Spline Interpolation</OPTION>
<INPUT_LIST type="grid_list" id="PREDICTORS" name="Predictors" system="PARAMETERS_GRID_SYSTEM">
<dem type="grid_list" id="PREDICTORS" name="Predictors" system="PARAMETERS_GRID_SYSTEM">
<FILE>/tmp/processing_158a4797a951407ca275f957a94862a4/e678b6f2c3484cf9b60adafa5e69b1d6/dem.sgrd</FILE>
</dem>
</INPUT_LIST>
<INPUT type="shapes" id="POINTS" name="Points">
<FILE>/tmp/processing_158a4797a951407ca275f957a94862a4/f2045b740e8e466293cb61f78c148a83/POINTS.shp</FILE>
</INPUT>
<OUTPUT type="table" id="INFO_STEPS" name="Details: Steps">MLRA Steps</OUTPUT>
</MODULE>
</HISTORY>
<SOURCE>
<FILE>/home/nyall/dev/QGIS/python/plugins/processing/tests/testdata/expected/saga/multiple_regression_points_grids_steps.dbf</FILE>
<DATABASE>
<FIELDS>
<FIELD TYPE="INTEGER">MODEL</FIELD>
<FIELD TYPE="DOUBLE">R</FIELD>
<FIELD TYPE="DOUBLE">R2</FIELD>
<FIELD TYPE="DOUBLE">R2_ADJ</FIELD>
<FIELD TYPE="DOUBLE">STD_ERROR</FIELD>
<FIELD TYPE="DOUBLE">SSR</FIELD>
<FIELD TYPE="DOUBLE">SSE</FIELD>
<FIELD TYPE="DOUBLE">MSR</FIELD>
<FIELD TYPE="DOUBLE">MSE</FIELD>
<FIELD TYPE="DOUBLE">DF</FIELD>
<FIELD TYPE="DOUBLE">F</FIELD>
<FIELD TYPE="DOUBLE">SIG</FIELD>
<FIELD TYPE="DOUBLE">VAR_F</FIELD>
<FIELD TYPE="DOUBLE">VAR_SIG</FIELD>
<FIELD TYPE="STRING">DIR</FIELD>
<FIELD TYPE="STRING">VARIABLE</FIELD>
</FIELDS>
</DATABASE>
<PROJECTION></PROJECTION>
</SOURCE>
<DESCRIPTION></DESCRIPTION>
</SAGA_METADATA>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
93 changes: 93 additions & 0 deletions python/plugins/processing/tests/testdata/saga_algorithm_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -706,3 +706,96 @@ tests:
CLASSES:
hash: deeb8769979916ab544a824cd5400d4a4207e7df37fbeaaa6e4830af
type: rasterhash

- algorithm: saga:multipleregressionanalysispointsandpredictorgrids
name: Multi regression points predictor grids
params:
ATTRIBUTE: rvalue_1
COORD_X: false
COORD_Y: false
CROSSVAL: 0
CROSSVAL_K: 10
INTERCEPT: true
METHOD: 3
POINTS:
name: custom/saga/points_regression.shp
type: vector
PREDICTORS:
params:
- name: dem.tif
type: raster
type: multi
P_VALUE: 5.0
RESAMPLING: 3
RESIDUAL_COR: 0
results:
INFO_COEFF:
name: expected/saga/multiple_regression_points_grids_coef.dbf
type: vector
compare:
fields:
R:
precision: 2
R2:
precision: 2
R2_ADJ:
precision: 2
STD_ERROR:
precision: 2
T:
precision: 2
SIG:
precision: 6
P:
precision: 6
INFO_MODEL:
name: expected/saga/multiple_regression_points_grids_model.dbf
type: vector
compare:
fields:
VALUE:
precision: 2
INFO_STEPS:
name: expected/saga/multiple_regression_points_grids_steps.dbf
type: vector
compare:
fields:
R:
precision: 2
R2:
precision: 2
R2_ADJ:
precision: 2
STD_ERROR:
precision: 2
SSR:
precision: 2
SSE:
precision: 2
MSR:
precision: 2
MSE:
precision: 2
F:
precision: 2
SIG:
precision: 6
VAR_F:
precision: 2
VAR_SIG:
precision: 6
REGRESCORR:
hash: d70078f0151919949c1e55c1a677f1a7cda6f7514667270af6745c0d
type: rasterhash
REGRESSION:
hash: b3a725ae64eec2aab8de1197f2306a0905c7c38de0dc89d58aadb3cc
type: rasterhash
RESIDUALS:
name: expected/saga/multiple_regression_points_grids_res.shp
type: vector
compare:
fields:
TREND:
precision: 2
RESIDUAL:
precision: 2

0 comments on commit 4f8e231

Please sign in to comment.