convertFlow {hydromad} R Documentation

## Convert between units of flow volume

### Description

This function converts between units of flow (volumetric throughput), designed mainly for hydrology applications. As a special case, this function can also convert units of volume or units of depth (length).

### Usage

```convertFlow(x, from = "mm", to = "mm", area.km2 = -1,
timestep.default = "days")
```

### Arguments

 `x` a numeric vector or time series. `from` units to convert from (see Details). `to` units to convert into (see Details). `area.km2` area (in square kilometres) that flow volume is averaged over. This must be given when converting between measures of depth and measures of volume. `timestep.default` the time step if not specified in `from` or `to`.

### Details

This function can convert flow rates between different volume units, or different timestep units, or both. Volume can be specified directly, or as a depth and area combination.

The unit specifications `from` and `to` can include a time step, like `"volume / timestep"`. A multiplier may also be included with the time step, like `"volume / N timesteps"`. If no time step is specified in `from` and `to`, then it is taken to be `timestep.default`.

The volume units supported are: (these can be abbreviated)

`mL, cL, dL, L, daL, hL, kL, ML, GL, TL`

`cm^3, dm^3, m^3, km^3, ft^3`

The depth units supported are: (these can be abbreviated)

`mm, cm, metres, km, inches, feet`

The time units supported are: (these can be abbreviated)

`ms, seconds, minutes, hours, days, weeks, months, years / annum`

Additionally, the value `"cumecs"` (cubic metres per second) is equivalent to `"m^3/sec"`.

### Value

the original object `x`, scaled.

### Warning

The time step `"year"` refers to the average length of a year, i.e. 365.25 days (one annum). Similarly, the time step `"month"` refers to the average length of a month, i.e. 365.25 / 12 = 30.4375 days.

### Author(s)

Felix Andrews felix@nfrac.org

`difftime`

### Examples

```flowML <- c(0, 1, 100, 10)
## from megalitres per day to gigalitres per year
convertFlow(flowML, from="ML / day", to="GL / yr")
## from ML/step to mm/step averaged over 50 km^2
convertFlow(flowML, from="ML", to="mm", area=50)
## from ML/day to cubic metres per second
(flowCM <- convertFlow(flowML, from="ML/day", to="m^3/sec"))
## from cubic metres per second to mm/minute averaged over 0.1 km^2
convertFlow(flowCM, from="cumecs", to="mm/15min", area=0.1)
## 100 mm in inches
convertFlow(100, to="in")
```
[Package hydromad version 0.9-18 Index]