calcAlpha: Calculate values of alpha, the coefficient of temporal...

View source: R/ukghg.R

calcAlphaR Documentation

Calculate values of alpha, the coefficient of temporal variation

Description

This function calculates values of alpha, the time coefficient.

Usage

calcAlpha(
  ghgName = c("ch4", "co2", "n2o", "c2h6", "voc"),
  datect,
  sectorList = 1:10,
  timeScales = c(TRUE, TRUE, TRUE, TRUE),
  beta_df = data.frame(sector = 1:10, beta_year = rep(1, 10), beta_yday = rep(1, 10),
    beta_wday = rep(1, 10), beta_hour = rep(1, 10))
)

Arguments

ghgName

Greenhouse gas: one of "ch4", "co2", "n2o", "c2h6" or "voc". Defaults to "ch4".

datect

A vector of timestamps in POSIXct format.

sectorList

A vector of sector numbers for which alpha values should be returned, e.g. c(1,3,7). Defaults to all.

timeScales

A vector of logicals for including variation at inter-annual, seasonal, intra-weekly, and diurnal time scales (i.e. the POSIXlt variables year, yday, wday, and hour. Defaults to TRUE for all four.

beta_df

A data frame of beta coefficients, which act as multipliers on each sector. Defaults to 1 for all, but This allows for parameter estimation by optimisation or MCMC.

See Also

calcFlux for the higher-level function which calls this.

Examples

startDate <- as.POSIXct(strptime("01/06/2006", "%d/%m/%Y"), tz = "UTC")
endDate   <- as.POSIXct(strptime("02/06/2006", "%d/%m/%Y"), tz = "UTC")
# create a sequence of dates
nTimes <- 2
datect <- seq(startDate, endDate, length = nTimes)
alpha_df <- calcAlpha("ch4", datect)

NERC-CEH/ukghg documentation built on March 31, 2022, 3:16 a.m.