Quadratic Mean Diameter
Quadratic Mean Diameter ($D_q$) is the diameter of the tree of average per tree basal area. This becomes a convenient in that we often have basal are per acre and trees per acre but not the diameters of all the trees.
In imperial units:
$$D_q = \sqrt{ \frac{\frac{ba}{tpa}}{0.005454154}}$$
where: $D_q$ is the Quadratic Mean Diameter in inches, $ba$ is the basal area in square feet per acre, $tpa$ is the trees per acre, and 0.005454154 is a constant.
In metric units:
$$D_q = \sqrt{ \frac{\frac{ba}{tpha}}{0.00007854}}$$
where: $D_q$ is the Quadratic Mean Diameter in centimeters, $ba$ is the basal area square meters per hectare, $tpha$ is the trees per hectare, and 0.00007854 is a constant.
Example
- Imperial units
- ba = 80 ft2/ac
- tpa = 200
- unittype = "imperial"
- Answer = 8.56 in
- Metric units
- ba = 18.3 m2/ha
- tpha = 494.1
- unittype = "metric"
- Answer = 21.7 cm
Code
Visual Basic
Function qmd(ba As Single, tpa As Single, Optional unittype As String = "imperial") As Double
' Function to calculate quadratic mean diameter from basal area per acre and trees per acre
' by David R. Larsen, Copyright October 9, 2012
' Creative Commons http://creativecommons.org/licenses/by-nc/3.0/us/
If (unittype = "imperial") Then
qmd = Math.Sqr((ba / tpa) / 0.005454154)
ElseIf (unittype = "metric") Then
qmd = Math.Sqr((ba / tpa) / 0.00007854)
Else
qmd = 0#
MsgBox ("Unknown unit type, options are: imperial or metic")
End If
End Function
Excel® Visual Basic Code
R Statistical Package Code
qmd = function( ba, tpa, unittype="imperial" )
{
# Function to calculate the quadratic mean diameter from basal area and tree per acre
# by David R. Larsen, Copyright October 9, 2012
# Creative Commons http://creativecommons.org/licenses/by-nc/3.0/us/
if (unittype == "imperial"){
qmd = sqrt((ba / tpa) / 0.005454154)
}else if (unitype == "metric"){
qmd = sqrt((ba / tpa) / 0.00007854)
}else{
qmd = 0
}
qmd
}
R Statistical Package Code
Python Code
#!/usr/local/bin/python
# Function to calculate the quadratic mean diameter
# from basal area and tree per acre
# by David R. Larsen, October 11, 2012
# Creative Commons, http://creativecommons.org/licenses/by-nc/3.0/us/
import math
def qmd( ba, tpa, unittype="imperial"):
if( unittype == "imperial" ):
value = math.sqrt( (ba/tpa)/0.005454154 )
return value
elif( unittype == "metric"):
value = math.sqrt( (ba/tpa)/0.00007854 )
return value
else:
print "Unknown unittype, options are imperial or metric"
return
print "qmd =", qmd(80.0, 200.0)
print "qmd =", qmd(80.0, 200.0, "imperial")
print "qmd =", qmd(18.3, 494.1, "metric")
print "qmd =", qmd(1.0, 1.0, "cunits")
Python Code
Note the python file has a extra "txt" at the end to allow the files to be viewed in a web browser.
Go Code
// Function to calculate the quadratic mean diameter
// from basal area and tree per acre
// by David R. Larsen, August 15, 2013
// Creative Commons, http://creativecommons.org/licenses/by-nc/3.0/us/
package main
import (
"fmt"
"math"
)
// Function to calculate a quadratic mean
func Qmd( ba float64, tpa float64, unittype string) float64 {
if unittype == "imperial" {
return math.Sqrt( (ba/tpa)/0.005454154 )
}else if unittype == "metric" {
return math.Sqrt( (ba/tpa)/0.00007854 )
}
return 0.0
}
func main() {
fmt.Println("qmd =", Qmd(80.0, 200.0, "imperial") )
fmt.Println("qmd =", Qmd(18.3, 494.1, "metric") )
fmt.Println("qmd =", Qmd(80.0, 200.0, "cunits") )
}
Go Code
Note the go file has a extra "txt" at the end to allow the files to be viewed in a web browser.
|