rwslot_aggs: Simple aggregation functions for monthly matrix data

Description Usage Arguments Value Functions See Also Examples

Description

A family of functions that take a matrix containing monthly data (months by traces) that has a "timespan" attribute, annualizes the data by summing, or finding the minimum or maximum monthly values. Returns a years by traces matrix. Matrices returned by rdf_get_slot() have the timespan attribute added to them.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
rwslot_annual_sum(rwslot, multFactor = 1)

sumMonth2Annual(rwslot, multFactor = 1)

rwslot_annual_min(rwslot)

getMinAnnValue(rwslot)

rwslot_annual_max(rwslot)

getMaxAnnValue(rwslot)

rwslot_fwaac(mass, flow)

Arguments

rwslot

A matrix (months by traces) such as that returned by rdf_get_slot(). Function will error if the rwslot does not contain "regular" monthly data, i.e., the data must start in January and end in December, or start in October and end in September (water year), and the rwslot must have the timespan attribute.

multFactor

A factor the annual sum will be multiplied by. Can be used to convert from flow to volume, or to scale all results in another manor.

mass

A matrix (months by traces), such as that returned by rdf_get_slot(), of mass in tons.

flow

A matrix (months by traces), such as that returned by rdf_get_slot(), of flow in acre-ft/month.

Value

Other functions: Annual matrix (years x traces)

rwslot_fwaac(): Annual matrix (years x traces). Units are mg/L.

Functions

See Also

rdf_get_slot()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
zz <- rdf_get_slot(keyRdf, 'Powell.Outflow')

# returns in original units, e.g., acre-ft
annualTotVal <- rwslot_annual_sum(zz)

# returns in scaled units, e.g., kaf
annualTotVal <- rwslot_annual_sum(zz, 0.001) 

pe <- rdf_get_slot(keyRdf,'Mead.Pool Elevation')
peMax <- rwslot_annual_min(pe)

pe <- rdf_get_slot(keyRdf,'Mead.Pool Elevation')
peMax <- rwslot_annual_max(pe)

flow <- rdf_get_slot(keyRdf,'Powell.Outflow')
# make up mass, since it's not stored in the example data
rr <- matrix(
  rnorm((nrow(flow) * ncol(flow)), mean = 1000, sd = 200), 
  nrow = nrow(flow), 
  ncol = ncol(flow)
)
mass <- flow / 1000000 * rr^2 - rr + 1500 
fwaac <- rwslot_fwaac(mass, flow) 

RWDataPlyr documentation built on April 17, 2020, 9:06 a.m.