SeasonalCycle: Distribution of temperatures in seasonal cycle

Description Usage Arguments Details Author(s) Examples

Description

Probability density function and random generation for seasonal temperatures

Usage

1
2
3
dSeas(x = NULL, mean.t, amp.t, sd.t, return = c("density", "FUN"), res = 0.01)

rSeas(n, mean.t, amp.t, sd.t)

Arguments

x

vector of temperatures

mean.t

mean annual temperature

amp.t

amplitude of the seasonal cycle

sd.t

inter-annual standard deviation of temperature at a given point in the seasonal cycle

return

return densities for temperatures x, or a function to do so, Default: c("density", "FUN")

res

resolution of the temperature vectors to be convolved, Default: 0.01

n

number of samples

Details

The seasonal temperature cycle is approximated as a sine wave with gaussian noise. The probability density function is obtained by numerically convoluting a scaled sine wave and normal PDF with mean = 0. Random deviates are generated by adding gaussian noise to points sampled uniformly from the scaled sine wave on the interval 0 to 2*pi

Author(s)

Andrew Dolman

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
if(interactive()){
amp.t <- 10
mean.t <- 25
sd.t <- 0.75

x <- seq(mean.t-amp.t, mean.t+amp.t, length.out = 1000)
Z <- rSeas(n = 100000, mean.t, amp.t, sd.t)

hist(Z, freq=F,breaks=100)
lines(x, dSeas(x, mean.t, amp.t, sd.t, res = 0.1), col = "Blue")
lines(x, dSeas(x, mean.t, amp.t, sd.t, res = 0.01), col = "Green")
lines(x, dSeas(x, mean.t, amp.t, sd.t, res = 0.001), col = "Red")
 }

## End(Not run)

EarthSystemDiagnostics/ecustools documentation built on Jan. 15, 2022, 5:22 p.m.