Differences

This shows you the differences between two versions of the page.

Link to this comparison view

spdlib:users:commands:spdmetrics [2012/08/02 08:43]
Mattias Nyström [Restricting] Added two missing brackets.
spdlib:users:commands:spdmetrics [2012/08/27 14:54] (current)
Mattias Nyström Added example with metrics that Mattias uses
Line 217: Line 217:
  
    Calculate metrics : spdmetrics    Calculate metrics : spdmetrics
 +</code>
 +
 +===== Example =====
 +
 +The following xml-code is used to create a number of common LiDAR metrics used in forestry. The file was created by Mattias Nyström, 2012-08-26.
 +<code xml>
 +<?xml version="1.0" encoding="UTF-8" ?>
 +<!--
 + Description:
 + XML File for execution within SPDLib
 + This file contains a template for the
 + metrics XML interface.
 +
 + Created by Mattias Nyström on 8 May 2012. Edited 19 June 2012.
 + Copyright (c) 2011 Pete Bunting. All rights reserved.
 +-->
 +
 +<spdlib:metrics xmlns:spdlib="http://www.spdlib.org/xml/">
 +
 + <!-- General statistics -->
 + <spdlib:metric metric="numpulses" field="numPulsesAll" />
 + <spdlib:metric metric="numreturnsheight" field="numReturnsAll" return="All" class="All" />
 + <spdlib:metric metric="numreturnsheight" field="numReturnsNotGround" return="All" class="NotGrd" />
 + <spdlib:metric metric="numreturnsheight" field="numReturnsGround" return="All" class="Grd" />
 + <spdlib:metric metric="numreturnsheight" field="numReturnsNotGround_02-40" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" />
 +
 + <spdlib:metric metric="canopycover" field="groundCover" resolution="1" radius="1.4" return="All" class="Grd" heightup="40" heightlow="0" />
 + <spdlib:metric metric="canopycover" field="canopyCover" resolution="1" radius="1.4" return="All" class="NotGrd" heightup="40" heightlow="0.2" />
 + <spdlib:metric metric="canopycoverpercent" field="canopyCoverPercent" resolution="1" radius="1.4" return="All" class="NotGrd" heightup="40" heightlow="0.2" />
 +
 +
 + <!-- Height percentiles -->
 + <!-- <spdlib:metric metric="percentileheight" field="Out_Name" percentile="int" return="int | All | NotFirst | First | Last | FirstLast" class="int | All | NotGrd | Veg | Grd" minNumReturns="int" upthreshold="double" lowthreshold="double" /> -->
 + <spdlib:metric metric="percentileheight" field="h10" percentile="10" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" />
 + <spdlib:metric metric="percentileheight" field="h20" percentile="20" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" />
 + <spdlib:metric metric="percentileheight" field="h30" percentile="30" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" />
 + <spdlib:metric metric="percentileheight" field="h40" percentile="40" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" />
 + <spdlib:metric metric="percentileheight" field="h50" percentile="50" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" />
 + <spdlib:metric metric="percentileheight" field="h60" percentile="60" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" />
 + <spdlib:metric metric="percentileheight" field="h70" percentile="70" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" />
 + <spdlib:metric metric="percentileheight" field="h80" percentile="80" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" />
 + <spdlib:metric metric="percentileheight" field="h90" percentile="90" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" />
 + <spdlib:metric metric="percentileheight" field="h95" percentile="95" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" />
 + <spdlib:metric metric="percentileheight" field="h100" percentile="100" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" />
 +
 +
 + <!-- Height metrics -->
 + <spdlib:metric metric="sumheight" field="sumH" return="All" class="NotGrd" upthreshold="40" lowthreshold="0.2" />
 + <spdlib:metric metric="stddevheight" field="std" return="All" class="NotGrd" upthreshold="40" lowthreshold="0.2" />
 + <spdlib:metric metric="varianceheight" field="var" return="All" class="NotGrd" upthreshold="40" lowthreshold="0.2" />
 +
 +
 + <!-- Amplitude metrics -->
 + <spdlib:metric metric="sumamplitude" field="aSum" return="All" class="NotGrd" heightup="40" heightlow="0.2" />
 + <spdlib:metric metric="meanamplitude" field="aMean" return="All" class="NotGrd" heightup="40" heightlow="0.2" />
 + <spdlib:metric metric="medianamplitude" field="aMedian" return="All" class="NotGrd" heightup="40" heightlow="0.2" />
 +<!--
 + <spdlib:metric metric="modeamplitude" field="aMode" return="All" class="NotGrd" upthreshold="40" lowthreshold="0.2" /> This one seem to need the resolution="xx" tag...
 +-->
 + <spdlib:metric metric="minamplitude" field="aMin" return="All" class="NotGrd" heightup="40" heightlow="0.2" />
 + <spdlib:metric metric="maxamplitude" field="aMax" return="All" class="NotGrd" heightup="40" heightlow="0.2" />
 + <spdlib:metric metric="stddevamplitude" field="aStddev" return="All" class="NotGrd" heightup="40" heightlow="0.2" />
 + <spdlib:metric metric="varianceamplitude" field="aVariance" return="All" class="NotGrd" heightup="40" heightlow="0.2" />
 + <spdlib:metric metric="absdeviationamplitude" field="aAbsdeviation" return="All" class="NotGrd" heightup="40" heightlow="0.2" />
 +<!--
 + <spdlib:metric metric="coefficientofvariationamplitude" field="aCOV" return="All" class="NotGrd" upthreshold="40" lowthreshold="0.2" />
 +-->
 +
 + <!-- Amplitude percentiles -->
 + <!-- <spdlib:metric metric="percentileamplitude" field="Out_Name" percentile="int" return="int | All | NotFirst | First | Last | FirstLast" class="int | All | NotGrd | Veg | Grd" minNumReturns="int" upthreshold="double" lowthreshold="double" heightup="double" heightlow="double" /> -->
 + <!-- upthreshold="double" lowthreshold="double" is amplitude low/high threshold
 + heightup="double" heightlow="double"       is the point's height value
 + minNumReturns="int" is the minimum number of returns the pulse should have to be included -->
 + <spdlib:metric metric="percentileamplitude" field="a10" percentile="10" return="All" class="NotGrd" heightup="40" heightlow="0.2" />
 + <spdlib:metric metric="percentileamplitude" field="a20" percentile="20" return="All" class="NotGrd" heightup="40" heightlow="0.2" />
 + <spdlib:metric metric="percentileamplitude" field="a30" percentile="30" return="All" class="NotGrd" heightup="40" heightlow="0.2" />
 + <spdlib:metric metric="percentileamplitude" field="a40" percentile="40" return="All" class="NotGrd" heightup="40" heightlow="0.2" />
 + <spdlib:metric metric="percentileamplitude" field="a50" percentile="50" return="All" class="NotGrd" heightup="40" heightlow="0.2" />
 + <spdlib:metric metric="percentileamplitude" field="a60" percentile="60" return="All" class="NotGrd" heightup="40" heightlow="0.2" />
 + <spdlib:metric metric="percentileamplitude" field="a70" percentile="70" return="All" class="NotGrd" heightup="40" heightlow="0.2" />
 + <spdlib:metric metric="percentileamplitude" field="a80" percentile="80" return="All" class="NotGrd" heightup="40" heightlow="0.2" />
 + <spdlib:metric metric="percentileamplitude" field="a90" percentile="90" return="All" class="NotGrd" heightup="40" heightlow="0.2" />
 + <spdlib:metric metric="percentileamplitude" field="a95" percentile="95" return="All" class="NotGrd" heightup="40" heightlow="0.2" />
 + <spdlib:metric metric="percentileamplitude" field="a100" percentile="100" return="All" class="NotGrd" heightup="40" heightlow="0.2" />
 +
 +
 + <!-- Canopy cover -->
 +   <spdlib:metric metric="divide" field="vr01" >
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="NotGrd" lowthreshold="0.1" upthreshold="40" />
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 +   <spdlib:metric metric="divide" field="vr02" >
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" />
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 +   <spdlib:metric metric="divide" field="vr03" >
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="NotGrd" lowthreshold="0.3" upthreshold="40" />
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 + <spdlib:metric metric="divide" field="vr04" >
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="NotGrd" lowthreshold="0.4" upthreshold="40" />
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 + <spdlib:metric metric="divide" field="vr05" >
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="NotGrd" lowthreshold="0.5" upthreshold="40" />
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 + <spdlib:metric metric="divide" field="vr06" >
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="NotGrd" lowthreshold="0.6" upthreshold="40" />
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 + <spdlib:metric metric="divide" field="vr07" >
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="NotGrd" lowthreshold="0.7" upthreshold="40" />
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 + <spdlib:metric metric="divide" field="vr08" >
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="NotGrd" lowthreshold="0.8" upthreshold="40" />
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 + <spdlib:metric metric="divide" field="vr09" >
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="NotGrd" lowthreshold="0.9" upthreshold="40" />
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 + <spdlib:metric metric="divide" field="vr10" >
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="NotGrd" lowthreshold="1.0" upthreshold="40" />
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 + <spdlib:metric metric="divide" field="vr11" >
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="NotGrd" lowthreshold="1.1" upthreshold="40" />
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 + <spdlib:metric metric="divide" field="vr12" >
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="NotGrd" lowthreshold="1.2" upthreshold="40" />
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 + <spdlib:metric metric="divide" field="vr13" >
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="NotGrd" lowthreshold="1.3" upthreshold="40" />
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 + <spdlib:metric metric="divide" field="vr14" >
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="NotGrd" lowthreshold="1.4" upthreshold="40" />
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 + <spdlib:metric metric="divide" field="vr15" >
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="NotGrd" lowthreshold="1.5" upthreshold="40" />
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 + <spdlib:metric metric="divide" field="vr16" >
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="NotGrd" lowthreshold="1.6" upthreshold="40" />
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 + <spdlib:metric metric="divide" field="vr17" >
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="NotGrd" lowthreshold="1.7" upthreshold="40" />
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 + <spdlib:metric metric="divide" field="vr18" >
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="NotGrd" lowthreshold="1.8" upthreshold="40" />
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 + <spdlib:metric metric="divide" field="vr19" >
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="NotGrd" lowthreshold="1.9" upthreshold="40" />
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 + <spdlib:metric metric="divide" field="vr20" >
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="NotGrd" lowthreshold="2.0" upthreshold="40" />
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 +
 + <!-- Test: Multiply max height and max amplitude -->
 + <spdlib:metric metric="multiply" field="heightTimesAmplitude" >
 + <spdlib:metric metric="maxheight" field="Out_Name" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" />
 + <spdlib:metric metric="maxamplitude" field="Out_Name" return="All" class="NotGrd" heightup="40" heightlow="0.2" />
 + </spdlib:metric>
 +
 +
 + <!-- Height of each layer -->
 + <spdlib:metric metric="dividebyconst" field="dy" const="10">
 + <spdlib:metric metric="minusconstfrom" field="Out_Name" const="0.2"> <!-- 0.2m is the height threshold -->
 + <spdlib:metric metric="percentileheight" field="Out_Name" percentile="95" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" />
 + </spdlib:metric>
 + </spdlib:metric>
 +
 +
 +
 + <!-- Naesset's height densities -->
 + <!-- Naesset's density layer 0 -->
 +   <spdlib:metric metric="divide" field="densityLayer0" > 
 +
 + <spdlib:metric metric="returnsaboveheightmetric" field="returnsAboveLayer0" >
 + <spdlib:metric metric="addconst" field="heightD0" const="0.2"> <!-- 0.2m is the height threshold -->
 + <spdlib:metric metric="multiplyconst" field="Out_Name" const="0"> <!-- Tell you which layer it is. Choose between 0..9 -->
 + <spdlib:metric metric="dividebyconst" field="Out_Name" const="10"> <!-- Total number of layers. Now 10 layers: 0..9 -->
 + <spdlib:metric metric="minusconstfrom" field="Out_Name" const="0.2"> <!-- 0.2m is the height threshold -->
 + <spdlib:metric metric="percentileheight" field="Out_Name" percentile="95" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" /> <!-- The 95th height percentile is the upper limit -->
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 +
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 +
 + <!-- Naesset's density layer 1 -->
 + <spdlib:metric metric="divide" field="densityLayer1" > 
 +
 + <spdlib:metric metric="returnsaboveheightmetric" field="returnsAboveLayer1" >
 + <spdlib:metric metric="addconst" field="heightD1" const="0.2"> <!-- 0.2m is the height threshold -->
 + <spdlib:metric metric="multiplyconst" field="Out_Name" const="1"> <!-- Tell you which layer it is. Choose between 0..9 -->
 + <spdlib:metric metric="dividebyconst" field="Out_Name" const="10"> <!-- Total number of layers. Now 10 layers: 0..9 -->
 + <spdlib:metric metric="minusconstfrom" field="Out_Name" const="0.2"> <!-- 0.2m is the height threshold -->
 + <spdlib:metric metric="percentileheight" field="Out_Name" percentile="95" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" /> <!-- The 95th height percentile is the upper limit -->
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 +
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 +
 + <!-- Naesset's density layer 2 -->
 + <spdlib:metric metric="divide" field="densityLayer2" > 
 +
 + <spdlib:metric metric="returnsaboveheightmetric" field="returnsAboveLayer2" >
 + <spdlib:metric metric="addconst" field="heightD2" const="0.2"> <!-- 0.2m is the height threshold -->
 + <spdlib:metric metric="multiplyconst" field="Out_Name" const="2"> <!-- Tell you which layer it is. Choose between 0..9 -->
 + <spdlib:metric metric="dividebyconst" field="Out_Name" const="10"> <!-- Total number of layers. Now 10 layers: 0..9 -->
 + <spdlib:metric metric="minusconstfrom" field="Out_Name" const="0.2"> <!-- 0.2m is the height threshold -->
 + <spdlib:metric metric="percentileheight" field="Out_Name" percentile="95" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" /> <!-- The 95th height percentile is the upper limit -->
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 +
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 +
 + <!-- Naesset's density layer 3 -->
 + <spdlib:metric metric="divide" field="densityLayer3" > 
 +
 + <spdlib:metric metric="returnsaboveheightmetric" field="returnsAboveLayer3" >
 + <spdlib:metric metric="addconst" field="heightD3" const="0.2"> <!-- 0.2m is the height threshold -->
 + <spdlib:metric metric="multiplyconst" field="Out_Name" const="3"> <!-- Tell you which layer it is. Choose between 0..9 -->
 + <spdlib:metric metric="dividebyconst" field="Out_Name" const="10"> <!-- Total number of layers. Now 10 layers: 0..9 -->
 + <spdlib:metric metric="minusconstfrom" field="Out_Name" const="0.2"> <!-- 0.2m is the height threshold -->
 + <spdlib:metric metric="percentileheight" field="Out_Name" percentile="95" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" /> <!-- The 95th height percentile is the upper limit -->
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 +
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 +
 + <!-- Naesset's density layer 4 -->
 + <spdlib:metric metric="divide" field="densityLayer4" > 
 +
 + <spdlib:metric metric="returnsaboveheightmetric" field="returnsAboveLayer4" >
 + <spdlib:metric metric="addconst" field="heightD4" const="0.2"> <!-- 0.2m is the height threshold -->
 + <spdlib:metric metric="multiplyconst" field="Out_Name" const="4"> <!-- Tell you which layer it is. Choose between 0..9 -->
 + <spdlib:metric metric="dividebyconst" field="Out_Name" const="10"> <!-- Total number of layers. Now 10 layers: 0..9 -->
 + <spdlib:metric metric="minusconstfrom" field="Out_Name" const="0.2"> <!-- 0.2m is the height threshold -->
 + <spdlib:metric metric="percentileheight" field="Out_Name" percentile="95" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" /> <!-- The 95th height percentile is the upper limit -->
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 +
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 +
 + <!-- Naesset's density layer 5 -->
 + <spdlib:metric metric="divide" field="densityLayer5" > 
 +
 + <spdlib:metric metric="returnsaboveheightmetric" field="returnsAboveLayer5" >
 + <spdlib:metric metric="addconst" field="heightD5" const="0.2"> <!-- 0.2m is the height threshold -->
 + <spdlib:metric metric="multiplyconst" field="Out_Name" const="5"> <!-- Tell you which layer it is. Choose between 0..9 -->
 + <spdlib:metric metric="dividebyconst" field="Out_Name" const="10"> <!-- Total number of layers. Now 10 layers: 0..9 -->
 + <spdlib:metric metric="minusconstfrom" field="Out_Name" const="0.2"> <!-- 0.2m is the height threshold -->
 + <spdlib:metric metric="percentileheight" field="Out_Name" percentile="95" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" /> <!-- The 95th height percentile is the upper limit -->
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 +
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 +
 + <!-- Naesset's density layer 6 -->
 + <spdlib:metric metric="divide" field="densityLayer6" > 
 +
 + <spdlib:metric metric="returnsaboveheightmetric" field="returnsAboveLayer6" >
 + <spdlib:metric metric="addconst" field="heightD6" const="0.2"> <!-- 0.2m is the height threshold -->
 + <spdlib:metric metric="multiplyconst" field="Out_Name" const="6"> <!-- Tell you which layer it is. Choose between 0..9 -->
 + <spdlib:metric metric="dividebyconst" field="Out_Name" const="10"> <!-- Total number of layers. Now 10 layers: 0..9 -->
 + <spdlib:metric metric="minusconstfrom" field="Out_Name" const="0.2"> <!-- 0.2m is the height threshold -->
 + <spdlib:metric metric="percentileheight" field="Out_Name" percentile="95" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" /> <!-- The 95th height percentile is the upper limit -->
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 +
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 +
 + <!-- Naesset's density layer 7 -->
 + <spdlib:metric metric="divide" field="densityLayer7" > 
 +
 + <spdlib:metric metric="returnsaboveheightmetric" field="returnsAboveLayer7" >
 + <spdlib:metric metric="addconst" field="heightD7" const="0.2"> <!-- 0.2m is the height threshold -->
 + <spdlib:metric metric="multiplyconst" field="Out_Name" const="7"> <!-- Tell you which layer it is. Choose between 0..9 -->
 + <spdlib:metric metric="dividebyconst" field="Out_Name" const="10"> <!-- Total number of layers. Now 10 layers: 0..9 -->
 + <spdlib:metric metric="minusconstfrom" field="Out_Name" const="0.2"> <!-- 0.2m is the height threshold -->
 + <spdlib:metric metric="percentileheight" field="Out_Name" percentile="95" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" /> <!-- The 95th height percentile is the upper limit -->
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 +
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 +
 + <!-- Naesset's density layer 8 -->
 + <spdlib:metric metric="divide" field="densityLayer8" > 
 +
 + <spdlib:metric metric="returnsaboveheightmetric" field="returnsAboveLayer8" >
 + <spdlib:metric metric="addconst" field="heightD8" const="0.2"> <!-- 0.2m is the height threshold -->
 + <spdlib:metric metric="multiplyconst" field="Out_Name" const="8"> <!-- Tell you which layer it is. Choose between 0..9 -->
 + <spdlib:metric metric="dividebyconst" field="Out_Name" const="10"> <!-- Total number of layers. Now 10 layers: 0..9 -->
 + <spdlib:metric metric="minusconstfrom" field="Out_Name" const="0.2"> <!-- 0.2m is the height threshold -->
 + <spdlib:metric metric="percentileheight" field="Out_Name" percentile="95" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" /> <!-- The 95th height percentile is the upper limit -->
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 +
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 +
 + <!-- Naesset's density layer 9 -->
 + <spdlib:metric metric="divide" field="densityLayer9" > 
 +
 + <spdlib:metric metric="returnsaboveheightmetric" field="returnsAboveLayer9" >
 + <spdlib:metric metric="addconst" field="heightD9" const="0.2"> <!-- 0.2m is the height threshold -->
 + <spdlib:metric metric="multiplyconst" field="Out_Name" const="9"> <!-- Tell you which layer it is. Choose between 0..9 -->
 + <spdlib:metric metric="dividebyconst" field="Out_Name" const="10"> <!-- Total number of layers. Now 10 layers: 0..9 -->
 + <spdlib:metric metric="minusconstfrom" field="Out_Name" const="0.2"> <!-- 0.2m is the height threshold -->
 + <spdlib:metric metric="percentileheight" field="Out_Name" percentile="95" return="All" class="NotGrd" lowthreshold="0.2" upthreshold="40" /> <!-- The 95th height percentile is the upper limit -->
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 + </spdlib:metric>
 +
 + <spdlib:metric metric="numreturnsheight" field="Out_Name" return="All" class="All" upthreshold="40" />
 + </spdlib:metric>
 +
 +
 +</spdlib:metrics>
 </code> </code>

Navigation