## load example data
data(tt.pre)
## extract field concentration measurements
gcd <- tt.pre[tt.pre$sampletype_a=="P",]
## partition the data into data tables per chamber measurement
# first tell which columns of the data you want to carry on
columns <- c("date", "veg", "spot", "time_min", "temp_dC", "cham_area",
"cham_vol", "CO2ppm", "CO2Code", "CH4ppb", "CH4Code", "N2Oppb", "N2OCode")
# then do the partitioning
gcd.parts <- conz.prep(gcd, columns, factors = c("date", "spot", "veg"),
nmes = c("date", "veg", "spot"))
## calculate flux rates for methane
# first define CH4 range limit (alternatively use flux.calib)
CH4.lim <- 30
# do the flux rate estimation
flux.CH4 <- flux(gcd.parts, columns=c("CH4ppb", "time_min", "CH4Code",
"cham_vol", "temp_dC", "cham_area"), M = "CH4", co2ntrol = NULL)
## look at the results table
flux.CH4
## plot the concentration-change-with-time-plots as kind of diagnostic
plot(flux.CH4, subs = NULL, dims = c(3,6))
## do the flux rate estimation whilst using CO2 concentrations to
## control for possible chamber leakage
# first set the desired controls (without outlier transfer)
cntrl <- CO2.control(trans.out = FALSE, range.lim = 40, min.allow = 4)
# do the flux rate estimation
flux.CH4.b <- flux(gcd.parts, columns=c("CH4ppb", "time_min", "CH4Code",
"cham_vol", "temp_dC", "cham_area"), M = "CH4", co2ntrol = cntrl)
# look at the results table
flux.CH4.b
# plot the concentration-change-with-time-plots as kind of diagnostic
plot(flux.CH4.b, subs = NULL, dims = c(3,6))
## do the flux rate estimation whilst using CO2 concentrations to
## control for outliers and possible chamber leakage
# first set the desired controls (without outlier transfer)
cntrl <- CO2.control(range.lim = 40, min.allow = 4)
# do the flux rate estimation
flux.CH4.c <- flux(gcd.parts, columns=c("CH4ppb", "time_min", "CH4Code",
"cham_vol", "temp_dC", "cham_area"), M = "CH4", co2ntrol = cntrl)
# look at the results table
flux.CH4.c
# plot the concentration-change-with-time-plots as kind of diagnostic
plot(flux.CH4.c, subs = NULL, dims = c(3,6))Run the code above in your browser using DataLab