R/sagang_regressionkriging.R

Defines functions sagang_regressionkriging

Documented in sagang_regressionkriging

##' QGIS Algorithm provided by SAGA Next Gen Regression kriging (sagang:regressionkriging). ---------------- Arguments ----------------  POINTS: Points 	Argument type:	source 	Acceptable values: 		- Path to a vector layer FIELD: Attribute 	Argument type:	field 	Acceptable values: 		- The name of an existing field 		- ; delimited list of existing field names PREDICTORS: Predictors 	Argument type:	multilayer REGRESSION: Regression 	Argument type:	rasterDestination 	Acceptable values: 		- Path for new raster layer PREDICTION: Prediction 	Argument type:	rasterDestination 	Acceptable values: 		- Path for new raster layer RESIDUALS: Residuals 	Argument type:	rasterDestination 	Acceptable values: 		- Path for new raster layer VARIANCE: Prediction Error 	Argument type:	rasterDestination 	Acceptable values: 		- Path for new raster layer TQUALITY: Error Measure 	Default value:	0 	Argument type:	enum 	Available values: 		- 0: (0) standard deviation 		- 1: (1) variance 	Acceptable values: 		- Number of selected option, e.g. '1' 		- Comma separated list of options, e.g. '1,3' INFO_COEFF: Regression: Coefficients 	Argument type:	vectorDestination 	Acceptable values: 		- Path for new vector layer INFO_MODEL: Regression: Model 	Argument type:	vectorDestination 	Acceptable values: 		- Path for new vector layer INFO_STEPS: Regression: Steps 	Argument type:	vectorDestination 	Acceptable values: 		- Path for new vector layer COORD_X: Include X Coordinate 	Default value:	false 	Argument type:	boolean 	Acceptable values: 		- 1 for true/yes 		- 0 for false/no 		- field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field 		- expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression COORD_Y: Include Y Coordinate 	Default value:	false 	Argument type:	boolean 	Acceptable values: 		- 1 for true/yes 		- 0 for false/no 		- field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field 		- expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression INTERCEPT: Intercept 	Default value:	true 	Argument type:	boolean 	Acceptable values: 		- 1 for true/yes 		- 0 for false/no 		- field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field 		- expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression METHOD: Method 	Default value:	3 	Argument type:	enum 	Available values: 		- 0: (0) include all 		- 1: (1) forward 		- 2: (2) backward 		- 3: (3) stepwise 	Acceptable values: 		- Number of selected option, e.g. '1' 		- Comma separated list of options, e.g. '1,3' P_VALUE: Significance Level 	Default value:	5 	Argument type:	number 	Acceptable values: 		- A numeric value 		- field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field 		- expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression RESAMPLING: Resampling 	Default value:	3 	Argument type:	enum 	Available values: 		- 0: (0) Nearest Neighbour 		- 1: (1) Bilinear Interpolation 		- 2: (2) Bicubic Spline Interpolation 		- 3: (3) B-Spline Interpolation 	Acceptable values: 		- Number of selected option, e.g. '1' 		- Comma separated list of options, e.g. '1,3' VAR_MAXDIST: Maximum Distance 	Default value:	0 	Argument type:	number 	Acceptable values: 		- A numeric value 		- field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field 		- expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression VAR_NCLASSES: Lag Distance Classes 	Default value:	100 	Argument type:	number 	Acceptable values: 		- A numeric value 		- field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field 		- expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression VAR_NSKIP: Skip 	Default value:	1 	Argument type:	number 	Acceptable values: 		- A numeric value 		- field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field 		- expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression VAR_MODEL: Variogram Model 	Default value:	a + b * x 	Argument type:	string 	Acceptable values: 		- String value 		- field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field 		- expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression KRIGING: Kriging Type 	Default value:	0 	Argument type:	enum 	Available values: 		- 0: (0) Simple Kriging 		- 1: (1) Ordinary Kriging 	Acceptable values: 		- Number of selected option, e.g. '1' 		- Comma separated list of options, e.g. '1,3' LOG: Logarithmic Transformation 	Default value:	false 	Argument type:	boolean 	Acceptable values: 		- 1 for true/yes 		- 0 for false/no 		- field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field 		- expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression BLOCK: Block Kriging 	Default value:	false 	Argument type:	boolean 	Acceptable values: 		- 1 for true/yes 		- 0 for false/no 		- field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field 		- expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression DBLOCK: Block Size 	Default value:	100 	Argument type:	number 	Acceptable values: 		- A numeric value 		- field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field 		- expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression SEARCH_RANGE: Search Range 	Default value:	1 	Argument type:	enum 	Available values: 		- 0: (0) local 		- 1: (1) global 	Acceptable values: 		- Number of selected option, e.g. '1' 		- Comma separated list of options, e.g. '1,3' SEARCH_RADIUS: Maximum Search Distance 	Default value:	1000 	Argument type:	number 	Acceptable values: 		- A numeric value 		- field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field 		- expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression SEARCH_POINTS_ALL: Number of Points 	Default value:	1 	Argument type:	enum 	Available values: 		- 0: (0) maximum number of nearest points 		- 1: (1) all points within search distance 	Acceptable values: 		- Number of selected option, e.g. '1' 		- Comma separated list of options, e.g. '1,3' SEARCH_POINTS_MIN: Minimum 	Default value:	16 	Argument type:	number 	Acceptable values: 		- A numeric value 		- field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field 		- expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression SEARCH_POINTS_MAX: Maximum 	Default value:	20 	Argument type:	number 	Acceptable values: 		- A numeric value 		- field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field 		- expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression
##'
##' @title QGIS algorithm - Regression kriging
##'
##' @param POINTS `source` - Points. Path to a vector layer.
##' @param FIELD `field` - Attribute. The name of an existing field. ; delimited list of existing field names.
##' @param PREDICTORS `multilayer` - Predictors. .
##' @param REGRESSION `rasterDestination` - Regression. Path for new raster layer.
##' @param PREDICTION `rasterDestination` - Prediction. Path for new raster layer.
##' @param RESIDUALS `rasterDestination` - Residuals. Path for new raster layer.
##' @param VARIANCE `rasterDestination` - Prediction Error. Path for new raster layer.
##' @param TQUALITY `enum`  of `("(0) standard deviation", "(1) variance")` - Error Measure. Number of selected option, e.g. '1'. Comma separated list of options, e.g. '1,3'.
##' @param INFO_COEFF `vectorDestination` - Regression: Coefficients. Path for new vector layer.
##' @param INFO_MODEL `vectorDestination` - Regression: Model. Path for new vector layer.
##' @param INFO_STEPS `vectorDestination` - Regression: Steps. Path for new vector layer.
##' @param COORD_X `boolean` - Include X Coordinate. 1 for true/yes. 0 for false/no. field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field. expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression.
##' @param COORD_Y `boolean` - Include Y Coordinate. 1 for true/yes. 0 for false/no. field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field. expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression.
##' @param INTERCEPT `boolean` - Intercept. 1 for true/yes. 0 for false/no. field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field. expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression.
##' @param METHOD `enum`  of `("(0) include all", "(1) forward", "(2) backward", "(3) stepwise")` - Method. Number of selected option, e.g. '1'. Comma separated list of options, e.g. '1,3'.
##' @param P_VALUE `number` - Significance Level. A numeric value. field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field. expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression.
##' @param RESAMPLING `enum`  of `("(0) Nearest Neighbour", "(1) Bilinear Interpolation", "(2) Bicubic Spline Interpolation", "(3) B-Spline Interpolation")` - Resampling. Number of selected option, e.g. '1'. Comma separated list of options, e.g. '1,3'.
##' @param VAR_MAXDIST `number` - Maximum Distance. A numeric value. field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field. expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression.
##' @param VAR_NCLASSES `number` - Lag Distance Classes. A numeric value. field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field. expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression.
##' @param VAR_NSKIP `number` - Skip. A numeric value. field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field. expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression.
##' @param VAR_MODEL `string` - Variogram Model. String value. field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field. expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression.
##' @param KRIGING `enum`  of `("(0) Simple Kriging", "(1) Ordinary Kriging")` - Kriging Type. Number of selected option, e.g. '1'. Comma separated list of options, e.g. '1,3'.
##' @param LOG `boolean` - Logarithmic Transformation. 1 for true/yes. 0 for false/no. field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field. expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression.
##' @param BLOCK `boolean` - Block Kriging. 1 for true/yes. 0 for false/no. field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field. expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression.
##' @param DBLOCK `number` - Block Size. A numeric value. field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field. expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression.
##' @param SEARCH_RANGE `enum`  of `("(0) local", "(1) global")` - Search Range. Number of selected option, e.g. '1'. Comma separated list of options, e.g. '1,3'.
##' @param SEARCH_RADIUS `number` - Maximum Search Distance. A numeric value. field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field. expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression.
##' @param SEARCH_POINTS_ALL `enum`  of `("(0) maximum number of nearest points", "(1) all points within search distance")` - Number of Points. Number of selected option, e.g. '1'. Comma separated list of options, e.g. '1,3'.
##' @param SEARCH_POINTS_MIN `number` - Minimum. A numeric value. field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field. expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression.
##' @param SEARCH_POINTS_MAX `number` - Maximum. A numeric value. field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field. expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression.
##' @param ... further parameters passed to `qgisprocess::qgis_run_algorithm()`
##' @param .complete_output logical specifying if complete out of `qgisprocess::qgis_run_algorithm()` should be used (`TRUE`) or first output (most likely the main) should read (`FALSE`). Default value is `TRUE`.
##' @param .quiet logical specifying if parameter `.quiet` for `qgisprocess::qgis_run_algorithm()` Default value is `TRUE`.
##' @param .messages logical specifying if messages from `qgisprocess::qgis_run_algorithm()` should be printed (`TRUE`) or not (`FALSE`). Default value is `FALSE`.
##'
##' @details
##' ## Outputs description
##' * INFO_COEFF - outputVector - Regression: Coefficients
##' * INFO_MODEL - outputVector - Regression: Model
##' * INFO_STEPS - outputVector - Regression: Steps
##' * PREDICTION - outputRaster - Prediction
##' * REGRESSION - outputRaster - Regression
##' * RESIDUALS - outputRaster - Residuals
##' * VARIANCE - outputRaster - Prediction Error
##'
##'
##' @export
##' @md
##' @importFrom qgisprocess qgis_run_algorithm

sagang_regressionkriging <- function(POINTS = qgisprocess:::qgis_default_value(), FIELD = qgisprocess:::qgis_default_value(), PREDICTORS = qgisprocess:::qgis_default_value(), REGRESSION = qgisprocess:::qgis_default_value(), PREDICTION = qgisprocess:::qgis_default_value(), RESIDUALS = qgisprocess:::qgis_default_value(), VARIANCE = qgisprocess:::qgis_default_value(), TQUALITY = qgisprocess:::qgis_default_value(), INFO_COEFF = qgisprocess:::qgis_default_value(), INFO_MODEL = qgisprocess:::qgis_default_value(), INFO_STEPS = qgisprocess:::qgis_default_value(), COORD_X = qgisprocess:::qgis_default_value(), COORD_Y = qgisprocess:::qgis_default_value(), INTERCEPT = qgisprocess:::qgis_default_value(), METHOD = qgisprocess:::qgis_default_value(), P_VALUE = qgisprocess:::qgis_default_value(), RESAMPLING = qgisprocess:::qgis_default_value(), VAR_MAXDIST = qgisprocess:::qgis_default_value(), VAR_NCLASSES = qgisprocess:::qgis_default_value(), VAR_NSKIP = qgisprocess:::qgis_default_value(), VAR_MODEL = qgisprocess:::qgis_default_value(), KRIGING = qgisprocess:::qgis_default_value(), LOG = qgisprocess:::qgis_default_value(), BLOCK = qgisprocess:::qgis_default_value(), DBLOCK = qgisprocess:::qgis_default_value(), SEARCH_RANGE = qgisprocess:::qgis_default_value(), SEARCH_RADIUS = qgisprocess:::qgis_default_value(), SEARCH_POINTS_ALL = qgisprocess:::qgis_default_value(), SEARCH_POINTS_MIN = qgisprocess:::qgis_default_value(), SEARCH_POINTS_MAX = qgisprocess:::qgis_default_value(),..., .complete_output = .complete_output_option(), .quiet = .quiet_option(), .messages = .message_option()) {

  check_algorithm_necessities("sagang:regressionkriging")

  if (.messages){
    output <- qgisprocess::qgis_run_algorithm("sagang:regressionkriging", `POINTS` = POINTS, `FIELD` = FIELD, `PREDICTORS` = PREDICTORS, `REGRESSION` = REGRESSION, `PREDICTION` = PREDICTION, `RESIDUALS` = RESIDUALS, `VARIANCE` = VARIANCE, `TQUALITY` = TQUALITY, `INFO_COEFF` = INFO_COEFF, `INFO_MODEL` = INFO_MODEL, `INFO_STEPS` = INFO_STEPS, `COORD_X` = COORD_X, `COORD_Y` = COORD_Y, `INTERCEPT` = INTERCEPT, `METHOD` = METHOD, `P_VALUE` = P_VALUE, `RESAMPLING` = RESAMPLING, `VAR_MAXDIST` = VAR_MAXDIST, `VAR_NCLASSES` = VAR_NCLASSES, `VAR_NSKIP` = VAR_NSKIP, `VAR_MODEL` = VAR_MODEL, `KRIGING` = KRIGING, `LOG` = LOG, `BLOCK` = BLOCK, `DBLOCK` = DBLOCK, `SEARCH_RANGE` = SEARCH_RANGE, `SEARCH_RADIUS` = SEARCH_RADIUS, `SEARCH_POINTS_ALL` = SEARCH_POINTS_ALL, `SEARCH_POINTS_MIN` = SEARCH_POINTS_MIN, `SEARCH_POINTS_MAX` = SEARCH_POINTS_MAX,..., .quiet = .quiet)
  } else {
    suppressMessages(
      output <- qgisprocess::qgis_run_algorithm("sagang:regressionkriging", `POINTS` = POINTS, `FIELD` = FIELD, `PREDICTORS` = PREDICTORS, `REGRESSION` = REGRESSION, `PREDICTION` = PREDICTION, `RESIDUALS` = RESIDUALS, `VARIANCE` = VARIANCE, `TQUALITY` = TQUALITY, `INFO_COEFF` = INFO_COEFF, `INFO_MODEL` = INFO_MODEL, `INFO_STEPS` = INFO_STEPS, `COORD_X` = COORD_X, `COORD_Y` = COORD_Y, `INTERCEPT` = INTERCEPT, `METHOD` = METHOD, `P_VALUE` = P_VALUE, `RESAMPLING` = RESAMPLING, `VAR_MAXDIST` = VAR_MAXDIST, `VAR_NCLASSES` = VAR_NCLASSES, `VAR_NSKIP` = VAR_NSKIP, `VAR_MODEL` = VAR_MODEL, `KRIGING` = KRIGING, `LOG` = LOG, `BLOCK` = BLOCK, `DBLOCK` = DBLOCK, `SEARCH_RANGE` = SEARCH_RANGE, `SEARCH_RADIUS` = SEARCH_RADIUS, `SEARCH_POINTS_ALL` = SEARCH_POINTS_ALL, `SEARCH_POINTS_MIN` = SEARCH_POINTS_MIN, `SEARCH_POINTS_MAX` = SEARCH_POINTS_MAX,..., .quiet = .quiet)
      )
  }

  if (.complete_output) {
    return(output)
  }
  else{
    qgisprocess::qgis_extract_output(output, "INFO_COEFF")
  }
}
JanCaha/r_package_qgis documentation built on Oct. 1, 2024, 11:50 p.m.