public void AddIngrowth(int year, OrganonStand stand, OrganonStandDensity standDensity) { List <int> remainingIngrowthYears = this.IngrowthByYear.Keys.Where(key => key > this.yearOfMostRecentIngrowthAdded).ToList(); if ((remainingIngrowthYears.Count < 1) || (remainingIngrowthYears[0] > year)) { // no ingrowth in this simulation step return; } int ingrowthYear = remainingIngrowthYears[0]; Debug.Assert((remainingIngrowthYears.Count == 1) || (remainingIngrowthYears[1] > year)); // for now, assume only one ingrowth measurement per simulation timestep float fixedPlotExpansionFactor = this.GetTreesPerAcreExpansionFactor(); foreach (PspTreeMeasurementSeries tree in this.IngrowthByYear[ingrowthYear]) { Trees treesOfSpecies = stand.TreesBySpecies[tree.Species]; Debug.Assert(treesOfSpecies.Capacity > treesOfSpecies.Count); float dbhInInches = Constant.InchesPerCentimeter * tree.DbhInCentimetersByYear.Values[0]; float heightInFeet = TestConstant.FeetPerMeter * TreeRecord.EstimateHeightInMeters(tree.Species, dbhInInches); treesOfSpecies.Add(tree.Tag, dbhInInches, heightInFeet, tree.EstimateInitialCrownRatio(standDensity), fixedPlotExpansionFactor); } this.yearOfMostRecentIngrowthAdded = ingrowthYear; }
public static float EstimateHeightInFeet(FiaCode species, float dbhInInches) { return(TestConstant.FeetPerMeter * TreeRecord.EstimateHeightInMeters(species, dbhInInches)); }