DAMMmodel

DAMMmodel.sDAMMmatType
struct sDAMMmat

Fields required to plot surface of DAMM

Fields

• porosity::Float64

• params::NTuple{7, Float64}

• x::Vector{Float64}

• y::Vector{Float64}

• DAMM_Matrix::Matrix{Float64}

DAMMmodel.sDAMMmatqType
struct sDAMMmatq

Fields required to plot surface of DAMM

Fields

• porosity::Float64

• Tmed::Vector{Float64}

• θmed::Vector{Float64}

• Rmed::Vector{Float64}

• params::NTuple{7, Float64}

• x::Vector{Float64}

• y::Vector{Float64}

• DAMM_Matrix::Matrix{Float64}

DAMMmodel.DAMMMethod
DAMM(x::VecOrMat{<: Real}, p::NTuple{7, Float64})

Calculate respiration as a function of soil temperature (Tₛ) and moisture (θ).

Examples

julia> df = DAMMfdata(100) # generates a fake dataset
100×3 DataFrame
Row │ Tₛ       θ        Rₛ
│ Float64  Float64  Float64
─────┼─────────────────────────────
1 │    15.5      0.3   1.72216
2 │    22.3      0.6   1.8213
⋮  │    ⋮        ⋮         ⋮
99 │     9.5      0.2   0.223677
100 │     6.6      0.6   0.730627
julia> fp # parameters: αₛₓ, Eaₛₓ, kMₛₓ, kMₒ₂, Sxₜₒₜ, Q10kM
(1.0e9, 64.0, 3.46e-8, 0.002, 0.7, 0.02, 1.0)
julia> DAMM(hcat(df.Tₛ, df.θ), fp) # μmolCO₂ m⁻² s⁻¹
100-element Vector{Float64}:
6.023429035220588
0.9298933641647085
⋮
0.8444248717855868
3.805243237387702
DAMMmodel.DAMMfdataMethod
DAMMfdata(n)

Generates a DataFrame of n fake data Tₛ, θ and Rₛ

Examples

julia-repl julia> DAMMfdata(5) 5×3 DataFrame Row │ Tₛ θ Rₛ │ Float64 Float64 Float64 ─────┼─────────────────────────── 1 │ 10.8 0.3 2.04327 2 │ 31.5 0.1 7.8925 3 │ 38.7 0.7 1.6 4 │ 35.7 0.3 7.38025 5 │ 21.9 0.2 3.0012

DAMMmodel.DAMMfitMethod
DAMMfit(x::VecOrMat{<: Real}, Rₛ::Vector{Float64}, poro_val::Float64)

Fit the DAMM model parameters to data.

Examples

julia> df = DAMMfdata(100) # generates a fake dataset
100×3 DataFrame
Row │ Tₛ       θ        Rₛ
│ Float64  Float64  Float64
─────┼─────────────────────────────
1 │    27.1      0.3   4.345
2 │    38.7      0.6  12.0106
⋮  │    ⋮        ⋮         ⋮
99 │    18.6      0.5   0.894257
100 │    19.4      0.4   3.79532
julia> p = DAMMfit(hcat(df.Tₛ, df.θ), df.Rₛ, 0.7)
(2.034002955272664e10, 71.65411256289629, 9.903541279858033e-8, 0.003688664956456453, 0.7, 0.02, 1.0)
julia> DAMM(hcat(df.Tₛ, df.θ), p)
100-element Vector{Float64}:
4.233540174412755
10.41149919818871
⋮
1.746141124513421
1.9599317903590014
DAMMmodel.DAMMmatMethod
DAMMmat(Tₛ::Array{Float64, 1}, θ::Array{Float64, 1}, Rₛ::Array{Float64, 1}, r::Int64)

Generates a matrix of DAMM output for gridded inputs x and y Inputs: soil temperature (Tₛ), soil moisture (θ), respiration (Rₛ), resolution (r)

Examples:

julia> Tₛ = collect(15.0:2.5:40.0)
julia> θ = collect(0.2:0.05:0.7)
julia> Rₛ = [1.0, 1.2, 1.5, 2.0, 2.7, 3.8, 4.9, 6.7, 4.1, 2.0, 0.4]
julia> r = 10
julia> out = DAMMmat(Tₛ, θ, Rₛ, r)
DAMMmat(Tₛ::Array{Float64, 1}, θ::Array{Float64, 1}, Rₛ::Array{Float64, 1}, r::Int64, n::Int64)

Bin data by n quantiles

Examples:

julia> n = 4
julia> out = DAMMmat(Tₛ, θ, Rₛ, r, n)
DAMMmodel.DAMMplotMethod
DAMMplot(Tₛ::Array{Float64, 1}, θ::Array{Float64, 1}, Rₛ::Array{Float64, 1}, r::Int64)

Plot scatter of data and fitted DAMM surface

Example

julia> df = DAMMfdata(100)
julia> r = 50
julia> fig = DAMMplot(df.Tₛ, df.θ, df.Rₛ, r)
DAMMmodel.DAMMvizMethod
DAMMviz()

Interactive plot of the DAMM model

To open

julia> DAMMviz()
DAMMmodel.qbinsMethod
qbins(x, y, z, n)

Bins x into n quantiles, each xbin into n quantiles of y, return z quantile

Examples

julia> df = DataFrame(x=1:20, y=6:25, z=11:30)
julia> xmed, ymed, zmed = qbins(df.T, df.M, df.R, 3)
xmed = [9, 9, 9, 15, 15, 15, 21, 21, 21]
ymed = [12, 14, 16, 19, 20.5, 22, 25, 27, 29]
zmed = [2, 4, 6, 8.5, 10.5, 15, 17, 19]`