R/sagang_potentialincomingsolarradiation.R

Defines functions sagang_potentialincomingsolarradiation

Documented in sagang_potentialincomingsolarradiation

##' QGIS Algorithm provided by SAGA Next Gen Potential incoming solar radiation (sagang:potentialincomingsolarradiation). ---------------- Arguments ----------------  GRD_DEM: Elevation 	Argument type:	raster 	Acceptable values: 		- Path to a raster layer GRD_SVF: Sky View Factor (optional) 	Argument type:	raster 	Acceptable values: 		- Path to a raster layer GRD_VAPOUR: Water Vapour Pressure (mbar) (optional) 	Argument type:	raster 	Acceptable values: 		- Path to a raster layer GRD_VAPOUR_DEFAULT: Default 	Default value:	10 	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 GRD_LINKE: Linke Turbidity Coefficient (optional) 	Argument type:	raster 	Acceptable values: 		- Path to a raster layer GRD_LINKE_DEFAULT: Default 	Default value:	3 	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 GRD_DIRECT: Direct Insolation 	Argument type:	rasterDestination 	Acceptable values: 		- Path for new raster layer GRD_DIFFUS: Diffuse Insolation 	Argument type:	rasterDestination 	Acceptable values: 		- Path for new raster layer GRD_TOTAL: Total Insolation 	Argument type:	rasterDestination 	Acceptable values: 		- Path for new raster layer GRD_RATIO: Direct to Diffuse Ratio 	Argument type:	rasterDestination 	Acceptable values: 		- Path for new raster layer GRD_FLAT: Compare to Flat Terrain 	Argument type:	rasterDestination 	Acceptable values: 		- Path for new raster layer GRD_DURATION: Duration of Insolation 	Argument type:	rasterDestination 	Acceptable values: 		- Path for new raster layer GRD_SUNRISE: Sunrise 	Argument type:	rasterDestination 	Acceptable values: 		- Path for new raster layer GRD_SUNSET: Sunset 	Argument type:	rasterDestination 	Acceptable values: 		- Path for new raster layer SOLARCONST: Solar Constant (W / m_) 	Default value:	1367 	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 LOCALSVF: Local Sky View Factor 	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 UNITS: Units 	Default value:	0 	Argument type:	enum 	Available values: 		- 0: (0) kWh / m_ 		- 1: (1) kJ / m_ 		- 2: (2) J / cm_ 	Acceptable values: 		- Number of selected option, e.g. '1' 		- Comma separated list of options, e.g. '1,3' SHADOW: Shadow 	Default value:	0 	Argument type:	enum 	Available values: 		- 0: (0) slim 		- 1: (1) fat 		- 2: (2) none 	Acceptable values: 		- Number of selected option, e.g. '1' 		- Comma separated list of options, e.g. '1,3' LOCATION: Location 	Default value:	0 	Argument type:	enum 	Available values: 		- 0: (0) constant latitude 		- 1: (1) calculate from grid system 	Acceptable values: 		- Number of selected option, e.g. '1' 		- Comma separated list of options, e.g. '1,3' LATITUDE: Latitude 	Default value:	53 	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 PERIOD: Time Period 	Default value:	1 	Argument type:	enum 	Available values: 		- 0: (0) moment 		- 1: (1) day 		- 2: (2) range of days 	Acceptable values: 		- Number of selected option, e.g. '1' 		- Comma separated list of options, e.g. '1,3' DAY: Day 	Default value:	2021-03-24 	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 DAY_STOP: Last Day 	Default value:	2021-03-24 	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 DAYS_STEP: Resolution (d) 	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 MOMENT: Moment (h) 	Default value:	12 	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 HOUR_STEP: Resolution (h) 	Default value:	0.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 METHOD: Atmospheric Effects 	Default value:	2 	Argument type:	enum 	Available values: 		- 0: (0) Height of Atmosphere and Vapour Pressure 		- 1: (1) Air Pressure, Water and Dust Content 		- 2: (2) Lumped Atmospheric Transmittance 		- 3: (3) Hofierka and Suri 	Acceptable values: 		- Number of selected option, e.g. '1' 		- Comma separated list of options, e.g. '1,3' ATMOSPHERE: Height of Atmosphere (m) 	Default value:	12000 	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 PRESSURE: Barometric Pressure (mbar) 	Default value:	1013 	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 WATER: Water Content (cm) 	Default value:	1.68 	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 DUST: Dust (ppm) 	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 LUMPED: Lumped Atmospheric Transmittance (Percent) 	Default value:	70 	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 - Potential incoming solar radiation
##'
##' @param GRD_DEM `raster` - Elevation. Path to a raster layer.
##' @param GRD_SVF `raster` - Sky View Factor. Path to a raster layer.
##' @param GRD_VAPOUR `raster` - Water Vapour Pressure (mbar). Path to a raster layer.
##' @param GRD_VAPOUR_DEFAULT `number` - Default. 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 GRD_LINKE `raster` - Linke Turbidity Coefficient. Path to a raster layer.
##' @param GRD_LINKE_DEFAULT `number` - Default. 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 GRD_DIRECT `rasterDestination` - Direct Insolation. Path for new raster layer.
##' @param GRD_DIFFUS `rasterDestination` - Diffuse Insolation. Path for new raster layer.
##' @param GRD_TOTAL `rasterDestination` - Total Insolation. Path for new raster layer.
##' @param GRD_RATIO `rasterDestination` - Direct to Diffuse Ratio. Path for new raster layer.
##' @param GRD_FLAT `rasterDestination` - Compare to Flat Terrain. Path for new raster layer.
##' @param GRD_DURATION `rasterDestination` - Duration of Insolation. Path for new raster layer.
##' @param GRD_SUNRISE `rasterDestination` - Sunrise. Path for new raster layer.
##' @param GRD_SUNSET `rasterDestination` - Sunset. Path for new raster layer.
##' @param SOLARCONST `number` - Solar Constant (W \code{/} m_). 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 LOCALSVF `boolean` - Local Sky View Factor. 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 UNITS `enum`  of `("(0) kWh / m_", "(1) kJ / m_", "(2) J / cm_")` - Units. Number of selected option, e.g. '1'. Comma separated list of options, e.g. '1,3'.
##' @param SHADOW `enum`  of `("(0) slim", "(1) fat", "(2) none")` - Shadow. Number of selected option, e.g. '1'. Comma separated list of options, e.g. '1,3'.
##' @param LOCATION `enum`  of `("(0) constant latitude", "(1) calculate from grid system")` - Location. Number of selected option, e.g. '1'. Comma separated list of options, e.g. '1,3'.
##' @param LATITUDE `number` - Latitude. 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 PERIOD `enum`  of `("(0) moment", "(1) day", "(2) range of days")` - Time Period. Number of selected option, e.g. '1'. Comma separated list of options, e.g. '1,3'.
##' @param DAY `string` - Day. 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 DAY_STOP `string` - Last Day. 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 DAYS_STEP `number` - Resolution (d). 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 MOMENT `number` - Moment (h). 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 HOUR_STEP `number` - Resolution (h). 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 METHOD `enum`  of `("(0) Height of Atmosphere and Vapour Pressure", "(1) Air Pressure, Water and Dust Content", "(2) Lumped Atmospheric Transmittance", "(3) Hofierka and Suri")` - Atmospheric Effects. Number of selected option, e.g. '1'. Comma separated list of options, e.g. '1,3'.
##' @param ATMOSPHERE `number` - Height of Atmosphere (m). 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 PRESSURE `number` - Barometric Pressure (mbar). 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 WATER `number` - Water Content (cm). 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 DUST `number` - Dust (ppm). 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 LUMPED `number` - Lumped Atmospheric Transmittance (Percent). 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
##' * GRD_DIFFUS - outputRaster - Diffuse Insolation
##' * GRD_DIRECT - outputRaster - Direct Insolation
##' * GRD_DURATION - outputRaster - Duration of Insolation
##' * GRD_FLAT - outputRaster - Compare to Flat Terrain
##' * GRD_RATIO - outputRaster - Direct to Diffuse Ratio
##' * GRD_SUNRISE - outputRaster - Sunrise
##' * GRD_SUNSET - outputRaster - Sunset
##' * GRD_TOTAL - outputRaster - Total Insolation
##'
##'
##' @export
##' @md
##' @importFrom qgisprocess qgis_run_algorithm

sagang_potentialincomingsolarradiation <- function(GRD_DEM = qgisprocess:::qgis_default_value(), GRD_SVF = qgisprocess:::qgis_default_value(), GRD_VAPOUR = qgisprocess:::qgis_default_value(), GRD_VAPOUR_DEFAULT = qgisprocess:::qgis_default_value(), GRD_LINKE = qgisprocess:::qgis_default_value(), GRD_LINKE_DEFAULT = qgisprocess:::qgis_default_value(), GRD_DIRECT = qgisprocess:::qgis_default_value(), GRD_DIFFUS = qgisprocess:::qgis_default_value(), GRD_TOTAL = qgisprocess:::qgis_default_value(), GRD_RATIO = qgisprocess:::qgis_default_value(), GRD_FLAT = qgisprocess:::qgis_default_value(), GRD_DURATION = qgisprocess:::qgis_default_value(), GRD_SUNRISE = qgisprocess:::qgis_default_value(), GRD_SUNSET = qgisprocess:::qgis_default_value(), SOLARCONST = qgisprocess:::qgis_default_value(), LOCALSVF = qgisprocess:::qgis_default_value(), UNITS = qgisprocess:::qgis_default_value(), SHADOW = qgisprocess:::qgis_default_value(), LOCATION = qgisprocess:::qgis_default_value(), LATITUDE = qgisprocess:::qgis_default_value(), PERIOD = qgisprocess:::qgis_default_value(), DAY = qgisprocess:::qgis_default_value(), DAY_STOP = qgisprocess:::qgis_default_value(), DAYS_STEP = qgisprocess:::qgis_default_value(), MOMENT = qgisprocess:::qgis_default_value(), HOUR_STEP = qgisprocess:::qgis_default_value(), METHOD = qgisprocess:::qgis_default_value(), ATMOSPHERE = qgisprocess:::qgis_default_value(), PRESSURE = qgisprocess:::qgis_default_value(), WATER = qgisprocess:::qgis_default_value(), DUST = qgisprocess:::qgis_default_value(), LUMPED = qgisprocess:::qgis_default_value(),..., .complete_output = .complete_output_option(), .quiet = .quiet_option(), .messages = .message_option()) {

  check_algorithm_necessities("sagang:potentialincomingsolarradiation")

  if (.messages){
    output <- qgisprocess::qgis_run_algorithm("sagang:potentialincomingsolarradiation", `GRD_DEM` = GRD_DEM, `GRD_SVF` = GRD_SVF, `GRD_VAPOUR` = GRD_VAPOUR, `GRD_VAPOUR_DEFAULT` = GRD_VAPOUR_DEFAULT, `GRD_LINKE` = GRD_LINKE, `GRD_LINKE_DEFAULT` = GRD_LINKE_DEFAULT, `GRD_DIRECT` = GRD_DIRECT, `GRD_DIFFUS` = GRD_DIFFUS, `GRD_TOTAL` = GRD_TOTAL, `GRD_RATIO` = GRD_RATIO, `GRD_FLAT` = GRD_FLAT, `GRD_DURATION` = GRD_DURATION, `GRD_SUNRISE` = GRD_SUNRISE, `GRD_SUNSET` = GRD_SUNSET, `SOLARCONST` = SOLARCONST, `LOCALSVF` = LOCALSVF, `UNITS` = UNITS, `SHADOW` = SHADOW, `LOCATION` = LOCATION, `LATITUDE` = LATITUDE, `PERIOD` = PERIOD, `DAY` = DAY, `DAY_STOP` = DAY_STOP, `DAYS_STEP` = DAYS_STEP, `MOMENT` = MOMENT, `HOUR_STEP` = HOUR_STEP, `METHOD` = METHOD, `ATMOSPHERE` = ATMOSPHERE, `PRESSURE` = PRESSURE, `WATER` = WATER, `DUST` = DUST, `LUMPED` = LUMPED,..., .quiet = .quiet)
  } else {
    suppressMessages(
      output <- qgisprocess::qgis_run_algorithm("sagang:potentialincomingsolarradiation", `GRD_DEM` = GRD_DEM, `GRD_SVF` = GRD_SVF, `GRD_VAPOUR` = GRD_VAPOUR, `GRD_VAPOUR_DEFAULT` = GRD_VAPOUR_DEFAULT, `GRD_LINKE` = GRD_LINKE, `GRD_LINKE_DEFAULT` = GRD_LINKE_DEFAULT, `GRD_DIRECT` = GRD_DIRECT, `GRD_DIFFUS` = GRD_DIFFUS, `GRD_TOTAL` = GRD_TOTAL, `GRD_RATIO` = GRD_RATIO, `GRD_FLAT` = GRD_FLAT, `GRD_DURATION` = GRD_DURATION, `GRD_SUNRISE` = GRD_SUNRISE, `GRD_SUNSET` = GRD_SUNSET, `SOLARCONST` = SOLARCONST, `LOCALSVF` = LOCALSVF, `UNITS` = UNITS, `SHADOW` = SHADOW, `LOCATION` = LOCATION, `LATITUDE` = LATITUDE, `PERIOD` = PERIOD, `DAY` = DAY, `DAY_STOP` = DAY_STOP, `DAYS_STEP` = DAYS_STEP, `MOMENT` = MOMENT, `HOUR_STEP` = HOUR_STEP, `METHOD` = METHOD, `ATMOSPHERE` = ATMOSPHERE, `PRESSURE` = PRESSURE, `WATER` = WATER, `DUST` = DUST, `LUMPED` = LUMPED,..., .quiet = .quiet)
      )
  }

  if (.complete_output) {
    return(output)
  }
  else{
    qgisprocess::qgis_extract_output(output, "GRD_DIFFUS")
  }
}
JanCaha/r_package_qgis documentation built on Nov. 3, 2024, 5:25 p.m.