water_balance.default | R Documentation |

Calculates the water balance using the method proposed by Thornthwaite & Mather.

## Default S3 method: water_balance( p, pet, taw, aw_initial = taw, max_iter = 256, max_error = 0, sequential = FALSE )

`p` |
precipitation |

`pet` |
potential (maximum) evapotranspiration |

`taw` |
total available soil water |

`aw_initial` |
soil water content at the beginning of calculations. |

`max_iter` |
the maximum number of iterations to perform until it stops (see details). Only valid if sequential is set to FALSE. |

`max_error` |
the maximum allowed difference between the previous and the current calculation (see details). Only valid if sequential is set to FALSE. |

`sequential` |
whether it will calculate a sequential or a cyclical water balance |

The function iterates over each value of p-pet calculating the available soil water (aw) at each step. If sequential is set FALSE and the last value of p-pet is reached, the function returns to the first value of p-pet and calculates a new value for aw. The new aw is compared to the aw calculated previously. It will stop only when the new aw is equal to the old aw, or when the number of iterations exceeds max_iter or the difference between the new aw and the old aw is lesser than max_error. If sequential is set TRUE, then max_error and max_iter values are irrelevant.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.