Last data update: 2014.03.03

R: Unit conversion for flow rates
ConvertFlowUnitsR Documentation

Unit conversion for flow rates

Description

Converts volumetric flow (cfs, cms, cmd) to depth flow rate over a watershed (mm/d). Or, it converts a depth flow rate to volumetric (mm/d to cfs)

Usage

ConvertFlowUnits(cfs = NULL, cmd=NULL, cms = NULL, WA, mmd = NULL, AREAunits = "mi2")

Arguments

cfs

Input flow in cubic feet per second

cmd

Input flow in cubic meters per day

cms

Input flow in cubic meters per second

WA

Watershed area. Can be entered in square miles (default), or square km (in this case, change the AREAunits to "km2")

mmd

Input flow in mm/d

AREAunits

Units of the watershed area ("mi2" or "km2")

Details

Note, only one flow input should be used. (i.e., user should define cfs OR cmd OR cms OR mmd). Watershed area must always be defined.

Value

converted flow rate in either mm/d (if converting from volumetric flow) or cfs (if converting from flow depth in mm/d)

Author(s)

Josephine Archibald

Examples

data(OwascoInlet)
OwascoInlet$Streamflow_mmd<-ConvertFlowUnits(cms=OwascoInlet$Streamflow_m3s,WA=271.,AREAunits="km2")

##  The following commented example isn't currently working in Linux systems, but should 
##  work in windows/macs
##
##  Get some streamflow (reported in cubic meters per day here):
# OI <- get_usgs_gage("04235299", "2013-03-01", "2013-05-20")
# FC <- get_usgs_gage("04234000", "2013-03-01", "2013-05-20")

##  Convert to mm/d
# OwascoInlet_mmd <- ConvertFlowUnits(cmd=OI$flowdata$flow, WA=OI$area, AREAunits="km2")
# FallCreek_mmd <- ConvertFlowUnits(cmd=FC$flowdata$flow, WA=FC$area, AREAunits="km2")

##  Compare the watershed area normalized flow depth for two watersheds near Ithaca NY :
# hydrograph(streamflow=OwascoInlet_mmd, streamflow2=FallCreek_mmd, timeSeries=FC$flowdata$mdate, 
# stream.label="flow depth (mm/d)")
# legend("topright", legend=c("Owasco Inlet", "Fall Creek"), lty=c(1,2), col=c("black", "red"))

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(EcoHydRology)
Loading required package: operators

Attaching package: 'operators'

The following objects are masked from 'package:base':

    options, strrep

Loading required package: topmodel
Loading required package: DEoptim

DEoptim package
Differential Evolution algorithm in R
Authors: D. Ardia, K. Mullen, B. Peterson and J. Ulrich

Loading required package: XML
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/EcoHydRology/ConvertFlowUnits.Rd_%03d_medium.png", width=480, height=480)
> ### Name: ConvertFlowUnits
> ### Title: Unit conversion for flow rates
> ### Aliases: ConvertFlowUnits
> 
> ### ** Examples
> 
> data(OwascoInlet)
> OwascoInlet$Streamflow_mmd<-ConvertFlowUnits(cms=OwascoInlet$Streamflow_m3s,WA=271.,AREAunits="km2")
> 
> ##  The following commented example isn't currently working in Linux systems, but should 
> ##  work in windows/macs
> ##
> ##  Get some streamflow (reported in cubic meters per day here):
> # OI <- get_usgs_gage("04235299", "2013-03-01", "2013-05-20")
> # FC <- get_usgs_gage("04234000", "2013-03-01", "2013-05-20")
> 
> ##  Convert to mm/d
> # OwascoInlet_mmd <- ConvertFlowUnits(cmd=OI$flowdata$flow, WA=OI$area, AREAunits="km2")
> # FallCreek_mmd <- ConvertFlowUnits(cmd=FC$flowdata$flow, WA=FC$area, AREAunits="km2")
> 
> ##  Compare the watershed area normalized flow depth for two watersheds near Ithaca NY :
> # hydrograph(streamflow=OwascoInlet_mmd, streamflow2=FallCreek_mmd, timeSeries=FC$flowdata$mdate, 
> # stream.label="flow depth (mm/d)")
> # legend("topright", legend=c("Owasco Inlet", "Fall Creek"), lty=c(1,2), col=c("black", "red"))
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>