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).
convertFlow(
x,
from = "mm",
to = "mm",
area.km2 = -1,
timestep.default = "days"
)
a numeric vector or time series.
units to convert from (see Details).
units to convert into (see Details).
area (in square kilometres) that flow volume is averaged over. This must be given when converting between measures of depth and measures of volume.
the time step if not specified in from
or
to
.
the original object x
, scaled.
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"
.
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.
flowML <- c(0, 1, 100, 10)
## from megalitres per day to gigalitres per year
convertFlow(flowML, from = "ML / day", to = "GL / yr")
#> [1] 0.00000 0.36525 36.52500 3.65250
## from ML/step to mm/step averaged over 50 km^2
convertFlow(flowML, from = "ML", to = "mm", area = 50)
#> [1] 0.00 0.02 2.00 0.20
## from ML/day to cubic metres per second
(flowCM <- convertFlow(flowML, from = "ML/day", to = "m^3/sec"))
#> [1] 0.00000000 0.01157407 1.15740741 0.11574074
## from cubic metres per second to mm/minute averaged over 0.1 km^2
convertFlow(flowCM, from = "cumecs", to = "mm/15min", area = 0.1)
#> [1] 0.0000000 0.1041667 10.4166667 1.0416667
## 100 mm in inches
convertFlow(100, to = "in")
#> [1] 3.937008