Skip to content

Commit

Permalink
Debugging utilization
Browse files Browse the repository at this point in the history
  • Loading branch information
smithkm committed Sep 17, 2024
1 parent 86519da commit 62b9d9c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ public void estimateSmallComponents(P fPoly, VdypLayer layer) throws ProcessingE
float conditionalExpectedBaseArea = conditionalExpectedBaseArea(spec, baseAreaSpec, region); // BACONDsp
conditionalExpectedBaseArea /= fractionAvailable;

float baseAreaSpecSmall = smallComponentProbability * conditionalExpectedBaseArea;
float baseAreaSpecSmall = smallComponentProbability * conditionalExpectedBaseArea; // BASMsp

// EMP082
float quadMeanDiameterSpecSmall = smallComponentQuadMeanDiameter(spec); // DQSMsp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ public void baseArea(float small, float u1, float u2, float u3, float u4) {
this.baseArea = Utils.utilizationVector(small, u1, u2, u3, u4);
}

public void baseArea(float height) {
this.baseArea = Utils.utilizationVector(height);
public void baseArea(float baseArea) {
this.baseArea = Utils.utilizationVector(baseArea);
}

protected UtilizationVector treesPerHectare = VdypUtilizationHolder.emptyUtilization();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ void processPrimaryLayer(VriPolygon polygon, VdypLayer.Builder lBuilder) throws

// TPH_L1

// TPHsp
// TPHsp before the individual species loop, then the fortran variable gets re-used, see speciesDensity below
var primarySpeciesDensity = primarySpeciesPercent * primaryLayerDensity;

// HDL1 or HT_L1
Expand Down Expand Up @@ -495,10 +495,14 @@ void processPrimaryLayer(VriPolygon polygon, VdypLayer.Builder lBuilder) throws
} else {
var loreyHeight = vriSite
.flatMap(site -> site.getHeight().filter(x -> getDebugMode(2) != 1).map(height -> {
// DQsp
float speciesQuadMeanDiameter = Math.max(
UtilizationClass.U75TO125.lowBound, height / leadHeight * layerQuadMeanDiameter
);

// TPHsp inside the individual species loop, see primarySpeciesDensity above
float speciesDensity = treesPerHectare(specBaseArea, speciesQuadMeanDiameter);

// EMP050
return (float) estimationMethods.primaryHeightFromLeadHeight(
site.getHeight().get(), site.getSiteGenus(), bec.getRegion(), speciesDensity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2557,7 +2557,9 @@ void testProcessPrimary2() throws Exception {
assertThat(
resultSpecB, hasProperty(
"baseAreaByUtilization",
utilization(0.00001f, 1.98000f, 0.03491f, 0.04531f, 0.13333f, 1.76645f)
utilization(
1.3540176e-05f, 2.32941175f, 0.0410699844f, 0.0533111095f, 0.156856298f, 2.07817435f
)
)
);
assertThat(
Expand Down

0 comments on commit 62b9d9c

Please sign in to comment.