本文整理汇总了C#中SiteCohorts类的典型用法代码示例。如果您正苦于以下问题:C# SiteCohorts类的具体用法?C# SiteCohorts怎么用?C# SiteCohorts使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SiteCohorts类属于命名空间,在下文中一共展示了SiteCohorts类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GrowCohorts
//---------------------------------------------------------------------
/// <summary>
/// Grows all cohorts at a site for a specified number of years. The
/// dead pools at the site also decompose for the given time period.
/// </summary>
public static void GrowCohorts(SiteCohorts cohorts,
ActiveSite site,
int years,
bool isSuccessionTimestep)
{
if (cohorts == null)
return;
//CurrentYearSiteMortality = 0.0;
for (int y = 1; y <= years; ++y)
{
SpeciesData.ChangeDynamicParameters(PlugIn.ModelCore.CurrentTime + y - 1);
SiteVars.ResetAnnualValues(site);
CohortBiomass.SubYear = y - 1;
CohortBiomass.CanopyLightExtinction = 0.0;
SiteVars.PercentShade[site] = 0.0;
SiteVars.LightTrans[site] = 1.0;
SiteVars.Cohorts[site].Grow(site, (y == years && isSuccessionTimestep));
SiteVars.WoodyDebris[site].Decompose();
SiteVars.Litter[site].Decompose();
}
//SiteVars.PreviousYearMortality[site] = CurrentYearSiteMortality;
}
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Succession,代码行数:34,代码来源:PlugIn.cs
示例2: NoCohorts_Grow
public void NoCohorts_Grow()
{
SiteCohorts cohorts = new SiteCohorts();
mockCalculator.CountCalled = 0;
Util.Grow(cohorts, 5, activeSite, false);
Assert.AreEqual(0, mockCalculator.CountCalled);
}
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:7,代码来源:SiteCohorts_Test.cs
示例3: Grow
//---------------------------------------------------------------------
/// <summary>
/// Grows all cohorts at a site for a number of years.
/// </summary>
public static void Grow(SiteCohorts cohorts,
int years,
ActiveSite site,
bool isSuccessionTimestep)
{
for (int y = 1; y <= years; ++y)
cohorts.Grow(site, (y == years && isSuccessionTimestep));
}
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:13,代码来源:Util.cs
示例4: InitialBiomass
//---------------------------------------------------------------------
private InitialBiomass(SiteCohorts cohorts,
Dead.Pool deadWoodyPool,
Dead.Pool deadNonWoodyPool)
{
this.cohorts = cohorts;
this.deadWoodyPool = deadWoodyPool;
this.deadNonWoodyPool = deadNonWoodyPool;
}
开发者ID:YongLuo007,项目名称:Extensions-Succession,代码行数:9,代码来源:InitialBiomass.cs
示例5: InitialBiomass
//---------------------------------------------------------------------
private InitialBiomass(SiteCohorts cohorts,
Landis.Library.Biomass.Pool deadWoodyPool,
Landis.Library.Biomass.Pool deadNonWoodyPool)
{
this.cohorts = cohorts;
this.deadWoodyPool = deadWoodyPool;
this.deadNonWoodyPool = deadNonWoodyPool;
}
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Succession,代码行数:9,代码来源:InitialBiomass.cs
示例6: TestInit
public void TestInit()
{
List<ISpeciesCohorts> speciesCohortList = new List<ISpeciesCohorts>();
speciesCohortList.Add(MakeCohorts(abiebals, 30, 40, 50, 150, 170));
speciesCohortList.Add(MakeCohorts(betualle, 100, 120, 280, 300));
siteCohorts = new SiteCohorts(speciesCohortList);
deadCohorts.Clear();
}
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:9,代码来源:SpeciesCohortsDisturbance_Test.cs
示例7: SingleCohort
public void SingleCohort()
{
SiteCohorts cohorts = new SiteCohorts();
const ushort initialBiomass = 300;
cohorts.AddNewCohort(abiebals, initialBiomass);
expectedCohorts.Clear();
expectedCohorts[abiebals] = new ushort[] { 1, initialBiomass };
Util.CheckCohorts(expectedCohorts, cohorts);
}
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:10,代码来源:SiteCohorts_Test.cs
示例8: GrowCohorts
/// <summary>
/// Grows all cohorts at a site for a specified number of years. The
/// dead pools at the site also decompose for the given time period.
/// </summary>
public static void GrowCohorts(SiteCohorts cohorts,
ActiveSite site,
int years,
bool isSuccessionTimestep)
{
for (int y = 1; y <= years; ++y) {
cohorts.Grow(site, (y == years && isSuccessionTimestep));
Dead.Pools.Woody[site].Decompose();
Dead.Pools.NonWoody[site].Decompose();
}
}
开发者ID:YongLuo007,项目名称:Extensions-Succession,代码行数:15,代码来源:Util.cs
示例9: SingleCohort
public void SingleCohort()
{
SiteCohorts cohorts = new SiteCohorts();
Assert.AreEqual(0, cohorts.TotalBiomass);
const int initialBiomass = 300;
cohorts.AddNewCohort(abiebals, initialBiomass);
Assert.AreEqual(initialBiomass, cohorts.TotalBiomass);
expectedCohorts.Clear();
expectedCohorts[abiebals] = new int [] { 1, initialBiomass };
Util.CheckCohorts(expectedCohorts, cohorts);
}
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:13,代码来源:SiteCohorts_Test.cs
示例10: ActualSiteBiomass
//---------------------------------------------------------------------
/// <summary>
/// Computes the actual biomass at a site. The biomass is the total
/// of all the site's cohorts except young ones. The total is limited
/// to being no more than the site's maximum biomass less the previous
/// year's mortality at the site.
/// </summary>
public static double ActualSiteBiomass(SiteCohorts siteCohorts,
ActiveSite site,
out IEcoregion ecoregion)
{
int youngBiomass;
int totalBiomass = Cohorts.ComputeBiomass(siteCohorts, out youngBiomass);
double B_ACT = totalBiomass - youngBiomass;
int lastMortality = siteCohorts.PrevYearMortality;
ecoregion = Model.Core.Ecoregion[site];
B_ACT = Math.Min( B_MAX[ecoregion] - lastMortality, B_ACT);
return B_ACT;
}
开发者ID:YongLuo007,项目名称:Extensions-Succession,代码行数:21,代码来源:LivingBiomass.cs
示例11: InitialBiomass
//---------------------------------------------------------------------
private InitialBiomass(SiteCohorts cohorts,
List<PoolD> litterPool,
PoolD woodyDebrisPool,
List<PoolD> deadFRootsPool,
Pool fineRootsPool,
Pool coarseRootsPool,
Charcoal charcoalPool)
{
this.cohorts = cohorts;
this.litterPool = litterPool;
this.woodyDebrisPool = woodyDebrisPool;
this.deadFRootsPool = deadFRootsPool;
this.fineRootsPool = fineRootsPool;
this.coarseRootsPool = coarseRootsPool;
this.charcoalPool = charcoalPool;
}
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Succession,代码行数:17,代码来源:InitialBiomass.cs
示例12: SingleCohort_LongevityReached
public void SingleCohort_LongevityReached()
{
SiteCohorts cohorts = new SiteCohorts();
const ushort initialBiomass = 300;
cohorts.AddNewCohort(poputrem, initialBiomass);
mockCalculator.CountCalled = 0;
mockCalculator.Change = 1;
expectedSite = activeSite;
deadCohorts.Clear();
// Repeatedly grow for succession timesteps until longevity
// reached.
int time = 0;
do {
time += successionTimestep;
cohorts.Grow(successionTimestep, activeSite, true);
} while (time <= poputrem.Longevity);
expectedCohorts.Clear();
Util.CheckCohorts(expectedCohorts, cohorts);
// Calculator called L times where L is longevity. Inituitively,
// one would think since initial cohort's age is 1, it'd only take
// L-1 times to get to the max age (= L). So the calculator
// should be called L-1 times. But the combining of young cohorts
// at the first succession timestep (t_succ = 20) results in the
// calculator being called twice with cohort age = t_succ-1 (19).
// At the end of year 19, the cohort's age is 20 and the
// calculator has been called 19 times. But at the start of year
// 20, the combine-young-cohorts operation is done because it's a
// succession timestep. The combine operation takes all the young
// cohorts (age <= t_succ = 20) and replaces them with one cohort
// with age = t_succ-1 (= 19). This ensures that after the growth
// phase, the cohort's age will be t_succ (20). So the growth
// phase of year 20 calls the calculator for the 20th time with
// cohort age 19.
Assert.AreEqual(poputrem.Longevity, mockCalculator.CountCalled);
Assert.AreEqual(1, deadCohorts.Count);
ICohort deadCohort = deadCohorts[0];
Assert.AreEqual(poputrem, deadCohort.Species);
Assert.AreEqual(poputrem.Longevity, deadCohort.Age);
Assert.AreEqual(initialBiomass + (poputrem.Longevity * mockCalculator.Change),
deadCohort.Biomass);
}
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:47,代码来源:CohortDeath_Test.cs
示例13: ActualSiteBiomass
//---------------------------------------------------------------------
/// <summary>
/// Computes the actual biomass at a site. The biomass is the total
/// of all the site's cohorts except young ones. The total is limited
/// to being no more than the site's maximum biomass less the previous
/// year's mortality at the site.
/// </summary>
public static double ActualSiteBiomass(SiteCohorts siteCohorts,
ActiveSite site)
{
IEcoregion ecoregion = Model.Core.Ecoregion[site];
if (siteCohorts == null)
return 0.0;
int youngBiomass;
int totalBiomass = Landis.Biomass.Cohorts.ComputeBiomass(siteCohorts, out youngBiomass);
double B_ACT = totalBiomass - youngBiomass;
int lastMortality = (int) SiteVars.PrevYearMortality[site]; //siteCohorts.PrevYearMortality;
B_ACT = System.Math.Min(SpeciesData.B_MAX[ecoregion] - lastMortality, B_ACT);
return B_ACT;
}
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Succession,代码行数:24,代码来源:CohortBiomass.cs
示例14: SiteConditions
public SiteConditions(ActiveSite site, ICommunity initialCommunity)
{
cohorts = new SiteCohorts();
canopy = new Canopy();
if (PlugIn.HasSiteOutput[site] == true)
{
siteoutput = new SiteOutput(site);
estoutput = new EstablishmentOutput(site);
}
this.site = site;
foreach (ISpecies spc in PlugIn.modelCore.Species)
{
deadcohortages[spc] = new List<int>();
}
uint key = ComputeKey(initialCommunity.MapCode, PlugIn.ModelCore.Ecoregion[site].MapCode);
SiteConditions s = GetFromKey(key);
if (s != null) return;
// If we don't have a sorted list of age cohorts for the initial
// community, make the list
List<Landis.Library.AgeOnlyCohorts.ICohort> sortedAgeCohorts;
if (!sortedCohorts.TryGetValue(initialCommunity.MapCode, out sortedAgeCohorts))
{
sortedAgeCohorts = PlugIn.RankCohortAgesOldToYoung(initialCommunity.Cohorts);
sortedCohorts[initialCommunity.MapCode] = sortedAgeCohorts;
}
hydrology = new Hydrology(PlugIn.modelCore.Ecoregion[site]);
forestfloor = new ForestFloor();
cohorts = new SiteCohorts();
establishment = new EstablishmentProbability(site);
if (sortedAgeCohorts.Count == 0) return;
//PlugIn.ModelCore.UI.WriteLine("Making Biomass Cohorts "+ site);
BiomassSpinUp(sortedAgeCohorts, site);
initialSites[key] = this;
return;
}
开发者ID:LANDIS-II-Foundation,项目名称:Extension-PnET-Succession,代码行数:46,代码来源:SiteConditions.cs
示例15: InitialBiomass
//---------------------------------------------------------------------
/// <summary>
/// Computes the initial biomass for a cohort at a site.
/// </summary>
public static float[] InitialBiomass(SiteCohorts siteCohorts,
ActiveSite site, ISpecies species)
{
IEcoregion ecoregion = PlugIn.ModelCore.Ecoregion[site];
double leafFrac = FunctionalType.Table[SpeciesData.FuncType[species]].FCFRACleaf;
double Nreduction = 0.0;
double B_ACT = SiteVars.ActualSiteBiomass(site);
double B_MAX = SpeciesData.B_MAX_Spp[species][ecoregion];//B_MAX[ecoregion]
// Initial biomass exponentially declines in response to
// competition.
double initialBiomass = 0.002 * B_MAX *
Math.Exp(-1.6 * B_ACT / B_MAX);
//Initial biomass is limited by nitrogen availability.
//initialBiomass *= SpeciesData.NLimits[species];
initialBiomass = Math.Max(initialBiomass, 1.0);
double initialLeafB = initialBiomass * leafFrac;
double initialWoodB = initialBiomass * (1.0 - leafFrac);
double[] initialB = new double[2]{initialWoodB, initialLeafB};
//PlugIn.ModelCore.Log.WriteLine("Yr={0},Mo={1}, InitialB={2:0.0}, InitBleaf={3:0.00}, InitBwood={4:0.00}. LeafFrac={5:0.0}", PlugIn.ModelCore.CurrentTime, month, initialBiomass, initialB[1], initialB[0], leafFrac);
//PlugIn.ModelCore.Log.WriteLine("Yr={0},Mo={1}, B_MAX={2:0.0}, B_ACT={3:0.00}", PlugIn.ModelCore.CurrentTime, month, B_MAX, B_ACT);
// Note: The following if statement is critical for ensuring that young cohorts
// get established properly.
if (SiteVars.MineralN[site] <= 0 || initialBiomass < 5.0)
{
initialBiomass = Math.Min(initialBiomass, 5.0);
initialB[0] = initialBiomass * (1.0 - leafFrac);
initialB[1] = initialBiomass * leafFrac;
}
Nreduction = AvailableN.CohortUptakeAvailableN(species, site, initialB);
SiteVars.MineralN[site] -= Nreduction;
float[] initialWoodLeafBiomass = new float[2]{(float) initialB[0], (float) initialB[1]};
//float[] initialWoodLeafBiomass = new float[2]{(float) initialBiomass, 0.0F};
return initialWoodLeafBiomass;
}
开发者ID:YongLuo007,项目名称:Extensions-Succession,代码行数:49,代码来源:CohortBiomass.cs
示例16: Grow
public void Grow()
{
SiteCohorts cohorts = new SiteCohorts();
const ushort initialBiomass = 35;
cohorts.AddNewCohort(abiebals, initialBiomass);
mockCalculator.CountCalled = 0;
mockCalculator.Change = 8;
cohorts.Grow(activeSite, true);
expectedCohorts.Clear();
expectedCohorts[abiebals] = new ushort[] {
// age biomass
2, (ushort) (initialBiomass + mockCalculator.Change)
};
Util.CheckCohorts(expectedCohorts, cohorts);
}
开发者ID:LANDIS-II-Foundation,项目名称:Library-Biomass-Cohort,代码行数:18,代码来源:OneYearTimestep_Test.cs
示例17: InitialBiomass
//---------------------------------------------------------------------
private InitialBiomass(
SiteCohorts cohorts,
Layer surfaceDeadWood,
Layer surfaceStructural,
Layer surfaceMetabolic,
Layer soilDeadWood,
Layer soilStructural,
Layer soilMetabolic,
Layer som1surface,
Layer som1soil,
Layer som2,
Layer som3,
double mineralN,
double cohortLeafC,
double cohortLeafN,
double cohortWoodC,
double cohortWoodN
)
{
this.cohorts = cohorts;
this.surfaceDeadWood = surfaceDeadWood;
this.surfaceStructural = surfaceStructural;
this.surfaceMetabolic = surfaceMetabolic;
this.soilDeadWood = soilDeadWood;
this.soilStructural = soilStructural;
this.soilMetabolic = soilMetabolic;
this.som1surface = som1surface;
this.som1soil = som1soil;
this.som2 = som2;
this.som3 = som3;
this.mineralN = mineralN;
this.cohortLeafC = cohortLeafC;
this.cohortLeafN = cohortLeafN;
this.cohortWoodC = cohortWoodC;
this.cohortWoodN = cohortWoodN;
}
开发者ID:YongLuo007,项目名称:Extensions-Succession,代码行数:45,代码来源:InitialBiomass.cs
示例18: CombineYoungCohorts
public void CombineYoungCohorts()
{
SiteCohorts cohorts = new SiteCohorts();
ushort[] initialBiomass = new ushort[] { 300, 700 };
cohorts.AddNewCohort(abiebals, initialBiomass[0]);
// Grow 1st cohort for 4 years, adding 10 to its biomass per year
mockCalculator.CountCalled = 0;
mockCalculator.Change = 10;
cohorts.Grow(4, activeSite, false);
Assert.AreEqual(4, mockCalculator.CountCalled);
expectedCohorts.Clear();
expectedCohorts[abiebals] = new ushort[] {
5, (ushort) (300 + 4 * mockCalculator.Change)
};
Util.CheckCohorts(expectedCohorts, cohorts);
// Add 2nd cohort and then grow both cohorts 6 more years up to
// a succession timestep
cohorts.AddNewCohort(abiebals, initialBiomass[1]);
mockCalculator.CountCalled = 0;
cohorts.Grow(6, activeSite, true);
// ComputeChange for both cohorts for 5 years, then combine them,
// and then one time for the combined cohort
Assert.AreEqual(5 * 2 + 1, mockCalculator.CountCalled);
expectedCohorts.Clear();
expectedCohorts[abiebals] = new ushort[] {
successionTimestep,
(ushort)
(300 + (4 + 5) * mockCalculator.Change // first cohort before combining
+ 700 + 5 * mockCalculator.Change // 2nd cohort before combining
+ mockCalculator.Change) // growth after combining
};
Util.CheckCohorts(expectedCohorts, cohorts);
}
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:39,代码来源:SiteCohorts_Test.cs
示例19: InitialBiomass
//---------------------------------------------------------------------
/// <summary>
/// Computes the initial biomass for a cohort at a site.
/// </summary>
public static int InitialBiomass(ISpecies species,
SiteCohorts siteCohorts,
ActiveSite site)
{
IEcoregion ecoregion = PlugIn.ModelCore.Ecoregion[site];
//double B_ACT = ActualSiteBiomass(siteCohorts, site, out ecoregion);
double B_ACT = (double)Cohorts.ComputeNonYoungBiomass(siteCohorts);
double maxBiomass = SpeciesData.B_MAX_Spp[species][ecoregion];
double maxANPP = SpeciesData.ANPP_MAX_Spp[species][ecoregion];
// Initial biomass exponentially declines in response to
// competition.
//double initialBiomass = 0.025 * maxBiomass * Math.Exp(-1.6 * B_ACT / EcoregionData.B_MAX[ecoregion]);
double initialBiomass = maxANPP * Math.Exp(-1.6 * B_ACT / EcoregionData.B_MAX[ecoregion]);
// Initial biomass cannot be greater than maxANPP
initialBiomass = Math.Min(maxANPP, initialBiomass);
// Initial biomass cannot be less than 1.
initialBiomass = Math.Max(1.0, initialBiomass);
return (int)initialBiomass;
}
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Succession,代码行数:30,代码来源:CohortBiomass.cs
示例20: CohortsRemoved
//---------------------------------------------------------------------
private void CohortsRemoved(object disturbance)
{
SiteCohorts cohorts = new SiteCohorts();
const ushort initialBiomass = 40;
mockCalculator.CountCalled = 0;
mockCalculator.Change = 1;
int timeOfLastSucc = 0;
for (int time = 1; time <= 50; time++) {
// Simulate the site being disturbed every 8 years which
// results in a new cohort being added.
bool siteDisturbed = (time % 8 == 0);
bool isSuccTimestep = (time % successionTimestep == 0);
if (siteDisturbed || isSuccTimestep) {
Util.Grow(cohorts, (ushort) (time - timeOfLastSucc),
activeSite, isSuccTimestep);
timeOfLastSucc = time;
}
if (siteDisturbed)
cohorts.AddNewCohort(poputrem, initialBiomass);
}
// Expected sequence of cohort changes:
//
// Time Grow_________
// Last Cohorts New
// Time Succ years afterwards Cohort
// ---- ---- ----- --------------- ------
// 8 0 8 1(40)
// 16 8 8 9(48) 1(40)
// 20 16 4 20(95*) * = 48+3 + 40+3 + 1
// 24 20 4 24(99) 1(40)
// 32 24 8 32(107),9(48) 1(40)
// 40 32 8 40(115),20(103*) 1(40) * = 48+7 + 40+7 + 1
// 48 40 8 48(123),28(111),9(48) 1(40)
expectedCohorts.Clear();
expectedCohorts[poputrem] = new ushort[] {
// age biomass
48, 123,
28, 111,
9, 48,
1, 40
};
Util.CheckCohorts(expectedCohorts, cohorts);
// Remove cohorts whose ages are between 10 and 30
expectedSender = cohorts[poputrem];
deadCohorts.Clear();
if (disturbance is IDisturbance)
cohorts.DamageBy((IDisturbance) disturbance);
else if (disturbance is AgeCohort.IDisturbance)
((AgeCohort.ISiteCohorts) cohorts).DamageBy((AgeCohort.IDisturbance) disturbance);
expectedCohorts.Clear();
expectedCohorts[poputrem] = new ushort[] {
// age biomass
48, 123,
1, 40
};
Util.CheckCohorts(expectedCohorts, cohorts);
CheckDeadCohorts(deadCohorts);
}
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:70,代码来源:CohortDeath_Test.cs
注:本文中的SiteCohorts类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论