Description Usage Arguments Details Value Examples

In order to compute deficit volumes time series of discharges (either of class 'lfobj' or 'xts') `summary.deficit`

needs to be aware of the unit. Units are stored in the attributes of the time series. `flowunit(x)`

retrieves the current unit from the attributes, `flowunit(x) <- value`

sets a new one.

1 2 3 4 5 6 7 8 9 10 11 |

`x` |
The time seies, either of class 'lfobj' or 'xts'. |

`value` |
a valid character string of length one that can be interpreted as flow unit. See details. |

Currently, just a few functions like `summary.deficit`

and `lfstat:::plot.deficit_dygraph`

make use of the unit stored as an attribute.

Usually flow units are of dimension $L^3 T^-1$. Currently a length $l$ can be on of `c("metre", "cm", "centimetre" "litre")`

, whereas time $T$ can be one in `c("days", "hours", "mins", "secs")`

, possibly abbreviated. The numerator of the fraction (everything befor the literal `"/"`

) is interpreted as the length (superscripts like `"^3"`

are discarded), the denominator as time. E.g. valid units would be `"cm^3/s"`

, `"m^3/day"`

or `"litre/sec"`

.

A character vector of length one, containing the currently used discharge unit.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ```
data(ray)
ray <- as.xts(ray)["1970::1970", ]
# currently discharges are in cubic metres per second
flowunit(ray)
# calculating deficit volumes, for fixed threshold 0.001 m^3/s
(s <- summary(find_droughts(ray, threshold = 0.001)))
# multiplying the discharge by 1000 converts is to litre per second
ray$discharge <- ray$discharge * 1000
# changing the unit accordingly, yields the same volumes
flowunit(ray) <- "l/s"
(ss <- summary(find_droughts(ray, threshold = 1)))
identical(s$volume, ss$volume)
``` |

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.