Skip to contents

`calculate_damaging()` creates a damage curve for one or more crops.

Usage

calculate_damaging(
  path,
  culture = NULL,
  level = floodam.agri::LEVEL,
  combine = floodam.agri::COMBINE,
  current = floodam.agri::CURRENT,
  hazard = floodam.agri::HAZARD,
  backup = c("sumup", "full"),
  verbose = TRUE,
  file.log = "damage.log",
  update.hazard = FALSE,
  retrieve = FALSE,
  simple = FALSE
)

Arguments

path

list describing where to find useful paths. Result of `init_path()`.

culture

character indicating which crop to consider, if NULL then all crops from the extent are considered, default to NULL.

level

list giving levels for hazard parameters (current, duration, height, week), default to floodam.agri::LEVEL.

combine

list of combine methods for each type of phenomena used to group damaging function. Default to floodam.agri::COMBINE

current

data.frame, correspondance between velocity qualitative classes and their numeric value. Default to floodam.agri::CURRENT.

hazard

character, hazard parameters, default to floodam.agri::HAZARD

backup

character indicating which calculations should be saved. Set to NULL if no calculations should be saved. Default to `c("sumup", "full").

verbose

logical, should the function send some messages while running.

file.log

character, name of journal file. DEFAULT to "damage.log".

update.hazard

logical, should the hazard be updated, default to FALSE.

retrieve

logical, should result be returned. Default to FALSE.

simple

logical, should result be returned as a data.frame or a list.

Value

If `backup` is "sumup", `calculate_damaging()` saves two csv files to the following directory `file.path(path[["output"]][["damage"]], "sumup")` with the same number of rows for each crop in `culture`: * `damage_ where * `damage-disaggregated_ damage and damage to other components (yield, replanting, soil and material).

If `backup` is `full`, a data.frame giving both proportions of damage to a component and total damage for each component is saved in `file.path(path[["output"]][["damage"]], "full")`.

If `retrieve` is TRUE, `calculate_damaging()` will return the damage function for total damage and damage to other components (yield, replanting, soil and material).

If there is no `hazard.csv` file in `path[["output"]][["damage"]]`, a data.frame with the same amount of rows as the damage data.frames indicating the hazard characteristics is saved. To update this file, `update.hazard`. should be set to TRUE.