Learn R Programming

rLakeAnalyzer (version 1.11.4.1)

ts.layer.temperature: Calculate volume-weighted average water temperature across a range of depths for a timeseries.

Description

Function for simplifying the calculation of Wedderburn Number. Can usually be called directly on data loaded directly using load.ts and load.bathy.

Usage

ts.layer.temperature(wtr, top, bottom, bathy, na.rm = FALSE)

Arguments

wtr

A data frame of water temperatures (in Celsius). Loaded using load.ts

top

Either a single numeric depth value to be used across the entire timeseries, or a vector of same length as the timeseries (e.g., nrow(wtr)). This is useful when calculating a time-varying layer average, like average epilimnion temperature.

bottom

Either a single numeric depth value to be used across the entire timeseries, or a vector of same length as the timeseries (e.g., nrow(wtr)). This is useful when calculating a time-varying layer average, like average epilimnion temperature.

bathy

A data frame containing hypsometric data. Loaded using load.bathy

na.rm

Boolean indicated if step-by-step removal of NA's should be tried. If false, a timestep with any NA values will return an NA value. If true, best effort will be made to calculate indices despite NA values.

Value

Returns a data frame with the timeseries of the average layer temperature. Includes ‘datetime’ and ‘layer.temp’ columns.

See Also

layer.temperature

Examples

Run this code
# NOT RUN {

	#Get the path for the package example file included
	wtr.path <- system.file('extdata', 'Sparkling.daily.wtr', package="rLakeAnalyzer")
	bathy.path <- system.file('extdata', 'Sparkling.bth', package="rLakeAnalyzer")
	
	#Load data for example lake, Sparkilng lake, in Wisconsin.
	sp.wtr = load.ts(wtr.path)
	sp.bathy = load.bathy(bathy.path)
	
	
    l.t = ts.layer.temperature(sp.wtr, 0, 18, sp.bathy)
	plot(l.t$datetime, l.t$layer.temp, type='l', 
        ylab='Volumetrically averaged lake temperature', xlab='Date')
	
# }

Run the code above in your browser using DataLab