本文整理汇总了C#中IEcoregion类的典型用法代码示例。如果您正苦于以下问题:C# IEcoregion类的具体用法?C# IEcoregion怎么用?C# IEcoregion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IEcoregion类属于命名空间,在下文中一共展示了IEcoregion类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Weathering
//---------------------------------------------------------------------
/// <summary>
/// Weathering of rock phosphorus (rate is user-defined), increasing
/// mineral phosphorus and reducing rock phosphorus.
/// </summary>
public static void Weathering(IEcoregion ecoregion,
Rock rock,
MineralSoil mineralSoil)
{
rock.WeatheredMineralP = rock.ContentP * EcoregionData.WeatheringP[ecoregion];
rock.ContentP = Math.Max(rock.ContentP - rock.WeatheredMineralP, 0);
mineralSoil.ContentP += rock.WeatheredMineralP;
}
示例2:
public ushort this[IEcoregion ecoregion, int water]
{
get
{
if (water >= table[ecoregion].Length) return 0;
return table[ecoregion][water];
}
}
示例3: Hydrology
//---------------------------------------------------------------------
public Hydrology(IEcoregion ecoregion)
{
this.ecoregion = ecoregion;
snowpack = 0;
water = WHC[ecoregion];
infiltration = 0;
runoff = 0;
preciploss = 0;
transpiration = 0;
AnnualTranspiration = 0;
}
示例4: 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;
}
示例5: Decompose
//---------------------------------------------------------------------
/// <summary>
/// Decomposition of soil organic matter and mineralization of N/P.
/// C:N ratio should be rough average of C:Ns at limit value transfers.
/// </summary>
public static void Decompose(IEcoregion ecoregion,
ActiveSite site)
{
double k = DecayRateSOM[ecoregion];
SiteVars.SoilOrganicMatter[site].Mass = SiteVars.SoilOrganicMatter[site].Mass * Math.Exp(-1 * k);
SiteVars.SoilOrganicMatter[site].ContentC = SiteVars.SoilOrganicMatter[site].ContentC * Math.Exp(-1 * k);
SiteVars.SoilOrganicMatter[site].MineralizedN = SiteVars.SoilOrganicMatter[site].ContentN -
(SiteVars.SoilOrganicMatter[site].ContentN * Math.Exp(-1 * k));
SiteVars.SoilOrganicMatter[site].ContentN = Math.Max(SiteVars.SoilOrganicMatter[site].ContentN -
SiteVars.SoilOrganicMatter[site].MineralizedN, 0);
SiteVars.MineralSoil[site].ContentN += SiteVars.SoilOrganicMatter[site].MineralizedN;
SiteVars.SoilOrganicMatter[site].MineralizedP = SiteVars.SoilOrganicMatter[site].ContentP -
(SiteVars.SoilOrganicMatter[site].ContentP * Math.Exp(-1 * k));
SiteVars.SoilOrganicMatter[site].ContentP = Math.Max(SiteVars.SoilOrganicMatter[site].ContentP -
SiteVars.SoilOrganicMatter[site].MineralizedP, 0);
SiteVars.MineralSoil[site].ContentP += SiteVars.SoilOrganicMatter[site].MineralizedP;
}
示例6: calculateWater_Limit
//---------------------------------------------------------------------------
//... Originally from pprdwc(wc,x,pprpts) of CENTURY
//...This funtion returns a value for potential plant production
// due to water content. Basically you have an equation of a
// line with a moveable y-intercept depending on the soil type.
// The value passed in for x is ((avh2o(1) + prcurr(month) + irract)/pet)
// pprpts(1): The minimum ratio of available water to pet which
// would completely limit production assuming wc=0.
// pprpts(2): The effect of wc on the intercept, allows the
// user to increase the value of the intercept and
// thereby increase the slope of the line.
// pprpts(3): The lowest ratio of available water to pet at which
// there is no restriction on production.
private static double calculateWater_Limit(ActiveSite site, IEcoregion ecoregion, ISpecies species)
{
double pptprd = 0.0;
double waterContent = EcoregionData.FieldCapacity[ecoregion] - EcoregionData.WiltingPoint[ecoregion];
double tmoist = EcoregionData.AnnualWeather[ecoregion].MonthlyPrecip[Century.Month]; //rain + irract;
double pet = EcoregionData.AnnualWeather[ecoregion].MonthlyPET[Century.Month];
if (pet >= 0.01)
{ // Trees are allowed to access the whole soil profile -rm 2/97
// pptprd = (avh2o(1) + tmoist) / pet
pptprd = (SiteVars.AvailableWater[site] + tmoist) / pet;
//pptprd = SiteVars.AvailableWater[site] / pet;
//PlugIn.ModelCore.Log.WriteLine("Yr={0},Mo={1}. AvailH20={2:0.0}, MonthPPT={3:0.0}, PET={4:0.0}.", PlugIn.ModelCore.CurrentTime, month, SiteVars.AvailableWater[site],tmoist,pet);
}
else pptprd = 0.01;
//...The equation for the y-intercept (intcpt) is A+B*WC. A and B
// determine the effect of soil texture on plant production based
// on moisture.
//...Old way:
// intcpt = 0.0 + 1.0 * wc
// The second point in the equation is (.8,1.0)
// slope = (1.0-0.0)/(.8-intcpt)
// pprdwc = 1.0+slope*(x-.8)
//...New way:
double pprpts1 = OtherData.PPRPTS1;
double pprpts2 = FunctionalType.Table[SpeciesData.FuncType[species]].PPRPTS2;
double pprpts3 = FunctionalType.Table[SpeciesData.FuncType[species]].PPRPTS3;
double intcpt = pprpts1 + (pprpts2 * waterContent);
double slope = 1.0 / (pprpts3 - intcpt);
double pprdwc = 1.0 + slope * (pptprd - pprpts3);
if (pprdwc > 1.0) pprdwc = 1.0;
if (pprdwc < 0.01) pprdwc = 0.01;
//PlugIn.ModelCore.Log.WriteLine("Yr={0},Mo={1}. AvailH20={2:0.0}, MonthlyPPT={3:0.0}, PET={4:0.0}, PPTPRD={5:0.0}, Limit={6:0.0}.", PlugIn.ModelCore.CurrentTime, month, SiteVars.AvailableWater[site],tmoist, pet,pptprd,pprdwc);
return pprdwc;
}
示例7: SetMinRelativeBiomass
//---------------------------------------------------------------------
public void SetMinRelativeBiomass(byte shadeClass,
IEcoregion ecoregion,
InputValue<Percentage> newValue)
{
Debug.Assert(1 <= shadeClass && shadeClass <= 5);
Debug.Assert(ecoregion != null);
if (newValue != null)
{
if (newValue.Actual < 0.0 || newValue.Actual > 1.0)
throw new InputValueException(newValue.String,
"{0} is not between 0% and 100%", newValue.String);
}
minRelativeBiomass[shadeClass][ecoregion] = newValue;
}
示例8: GenerateFoliarMoistureContent
//---------------------------------------------------------------------
public static int GenerateFoliarMoistureContent(ISeasonParameters season, IEcoregion ecoregion)
{
double bui = 0.0;
bui = GenerateRandomNum(season.BUIDist, season.BUIP1, season.BUIP2);
if(bui < 0) bui = 0;
if(bui > 200) bui = 200;
return (int) bui;
}
示例9: SetSingleAnnualClimate
//---------------------------------------------------------------------
// Generates new climate parameters for a SINGLE ECOREGION at an annual time step.
public static void SetSingleAnnualClimate(IEcoregion ecoregion, int year, Climate.Phase spinupOrfuture)
{
int actualYear = PlugIn.ModelCore.CurrentTime + year;
if (spinupOrfuture == Climate.Phase.Future_Climate)
{
actualYear += Climate.Future_MonthlyData.First().Key;
//PlugIn.ModelCore.UI.WriteLine("Retrieving {0} for year {1}.", spinupOrfuture.ToString(), actualYear);
if (Climate.Future_MonthlyData.ContainsKey(actualYear))
{
AnnualWeather[ecoregion] = Climate.Future_MonthlyData[actualYear][ecoregion.Index];
//AnnualWeather[ecoregion].WriteToLandisLogFile();
}
//else
// PlugIn.ModelCore.UI.WriteLine("Key is missing: Retrieving {0} for year {1}.", spinupOrfuture.ToString(), actualYear);
}
else
{
if (LastYearUpdated[ecoregion] == year+1)
return;
actualYear += Climate.Spinup_MonthlyData.First().Key;
//PlugIn.ModelCore.UI.WriteLine("Retrieving {0} for year {1}.", spinupOrfuture.ToString(), actualYear);
if (Climate.Spinup_MonthlyData.ContainsKey(actualYear))
{
AnnualWeather[ecoregion] = Climate.Spinup_MonthlyData[actualYear][ecoregion.Index];
LastYearUpdated[ecoregion] = year+1;
}
}
}
示例10: SetSingleAnnualClimate
//---------------------------------------------------------------------
// Generates new climate parameters for a SINGLE ECOREGION at an annual time step.
public static void SetSingleAnnualClimate(IEcoregion ecoregion, int year, Climate.Phase spinupOrfuture)
{
int actualYear = Climate.Future_MonthlyData.Keys.Min() + year;
if (spinupOrfuture == Climate.Phase.Future_Climate)
{
//PlugIn.ModelCore.UI.WriteLine("Retrieving {0} for year {1}.", spinupOrfuture.ToString(), actualYear);
if (Climate.Future_MonthlyData.ContainsKey(actualYear))
{
AnnualWeather[ecoregion] = Climate.Future_MonthlyData[actualYear][ecoregion.Index];
}
//else
// PlugIn.ModelCore.UI.WriteLine("Key is missing: Retrieving {0} for year {1}.", spinupOrfuture.ToString(), actualYear);
}
else
{
//PlugIn.ModelCore.UI.WriteLine("Retrieving {0} for year {1}.", spinupOrfuture.ToString(), actualYear);
if (Climate.Spinup_MonthlyData.ContainsKey(actualYear))
{
AnnualWeather[ecoregion] = Climate.Spinup_MonthlyData[actualYear][ecoregion.Index];
}
}
}
示例11: CalculateMonthlyData_NoVariance
private void CalculateMonthlyData_NoVariance(IEcoregion ecoregion, ClimateRecord[][] timestepData, int actualYear, double latitude)
{
ClimateRecord[] ecoClimate = new ClimateRecord[12];
this.Year = actualYear;
this.TotalAnnualPrecip = 0.0;
for (int mo = 0; mo < 12; mo++)
{
//Climate.ModelCore.UI.WriteLine(" Calculating Monthly Climate (No Variance): Yr={0}, month={1}, Eco={2}, Phase={3}.", actualYear, mo, ecoregion.Name, this.climatePhase);
ecoClimate[mo] = timestepData[ecoregion.Index][mo];
double MonthlyAvgTemp = (ecoClimate[mo].AvgMinTemp + ecoClimate[mo].AvgMaxTemp) / 2.0;
this.MonthlyTemp[mo] = MonthlyAvgTemp;
this.MonthlyMinTemp[mo] = ecoClimate[mo].AvgMinTemp;
this.MonthlyMaxTemp[mo] = ecoClimate[mo].AvgMaxTemp;
this.MonthlyPrecip[mo] = Math.Max(0.0, ecoClimate[mo].AvgPpt);
this.MonthlyPAR[mo] = ecoClimate[mo].AvgPAR;
this.MonthlyWindDirection[mo] = ecoClimate[mo].AvgWindDirection;
this.MonthlyWindSpeed[mo] = ecoClimate[mo].AvgWindSpeed;
this.MonthlyNDeposition[mo] = ecoClimate[mo].AvgNDeposition;
this.TotalAnnualPrecip += this.MonthlyPrecip[mo];
if (this.MonthlyPrecip[mo] < 0)
this.MonthlyPrecip[mo] = 0;
double hr = CalculateDayLength(mo, latitude);
this.MonthlyDayLength[mo] = (60.0 * 60.0 * hr); // seconds of daylight/day
this.MonthlyNightLength[mo] = (60.0 * 60.0 * (24 - hr)); // seconds of nighttime/day
}
this.MeanAnnualTemperature = CalculateMeanAnnualTemp(actualYear);
}
示例12: AnnualClimate_AvgDaily
private IClimateRecord[,] AnnualClimate_AvgDaily(IEcoregion ecoregion, int year, double latitude)
{
IClimateRecord[,] timestepData = new IClimateRecord[Climate.ModelCore.Ecoregions.Count, 366];
IClimateRecord[,] avgEcoClimate = new IClimateRecord[Climate.ModelCore.Ecoregions.Count, MaxDayInYear];
IClimateRecord[,] ecoClimateT = new IClimateRecord[Climate.ModelCore.Ecoregions.Count, MaxDayInYear];
for (int i = 0; i < MaxDayInYear; i++)
{
this.DailyMinTemp[i] = 0.0;
this.DailyMaxTemp[i] = 0.0;
this.DailyVarTemp[i] = 0.0;
this.DailyPptVarTemp[i] = 0.0;
this.DailyPrecip[i] = 0.0;
this.DailyPAR[i] = 0.0;
}
int allDataCount = 0;
if (this.climatePhase == Climate.Phase.Future_Climate)
allDataCount = Climate.Future_AllData.Count;
else if (this.climatePhase == Climate.Phase.SpinUp_Climate)
allDataCount = Climate.Spinup_AllData.Count;
for (int day = 0; day < MaxDayInYear; day++)
{
for (int stp = 0; stp < allDataCount; stp++)
{
if (this.climatePhase == Climate.Phase.Future_Climate)
timestepData = Climate.Future_AllData.ElementAt(stp).Value;
else if (this.climatePhase == Climate.Phase.SpinUp_Climate)
timestepData = Climate.Spinup_AllData.ElementAt(stp).Value;
ecoClimateT[ecoregion.Index, day] = timestepData[ecoregion.Index, day]; //Climate.TimestepData[ecoregion.Index, day];
if (ecoClimateT[ecoregion.Index, day] != null)
{
this.DailyMinTemp[day] += ecoClimateT[ecoregion.Index, day].AvgMinTemp;
this.DailyMaxTemp[day] += ecoClimateT[ecoregion.Index, day].AvgMaxTemp;
this.DailyVarTemp[day] += ecoClimateT[ecoregion.Index, day].AvgVarTemp;
this.DailyPptVarTemp[day] += ecoClimateT[ecoregion.Index, day].AvgPptVarTemp;
this.DailyPrecip[day] += ecoClimateT[ecoregion.Index, day].AvgPpt;
this.DailyPAR[day] += ecoClimateT[ecoregion.Index, day].PAR;
}
}
this.DailyMinTemp[day] = this.DailyMinTemp[day] / allDataCount;
this.DailyMaxTemp[day] = this.DailyMaxTemp[day] / allDataCount;
this.DailyVarTemp[day] = this.DailyVarTemp[day] / allDataCount;
this.DailyPptVarTemp[day] = this.DailyPptVarTemp[day] / allDataCount;
this.DailyPrecip[day] = this.DailyPrecip[day] / allDataCount; //This DailyPrecip avg is the historic average so the average should be taken as opposed to summing that up.
this.DailyPAR[day] = this.DailyPAR[day] / allDataCount;
avgEcoClimate[ecoregion.Index, day] = new ClimateRecord();
avgEcoClimate[ecoregion.Index, day].AvgMinTemp = this.DailyMinTemp[day];
avgEcoClimate[ecoregion.Index, day].AvgMaxTemp = this.DailyMaxTemp[day];
avgEcoClimate[ecoregion.Index, day].AvgVarTemp = this.DailyVarTemp[day];
avgEcoClimate[ecoregion.Index, day].StdDevTemp = Math.Sqrt(DailyVarTemp[day]);
avgEcoClimate[ecoregion.Index, day].AvgPptVarTemp = this.DailyPptVarTemp[day];
avgEcoClimate[ecoregion.Index, day].AvgPpt = this.DailyPrecip[day];
avgEcoClimate[ecoregion.Index, day].StdDevPpt = Math.Sqrt(this.DailyPrecip[day]);
avgEcoClimate[ecoregion.Index, day].PAR = this.DailyPAR[day];
}
return avgEcoClimate;
}
示例13: AnnualClimate_Daily
//For Sequenced and Random timeStep arg should be passed
public AnnualClimate_Daily(IEcoregion ecoregion, int actualYear, double latitude, Climate.Phase spinupOrfuture = Climate.Phase.Future_Climate, int timeStep = Int32.MinValue)
{
this.climatePhase = spinupOrfuture;
IClimateRecord[,] timestepData = new IClimateRecord[Climate.ModelCore.Ecoregions.Count, 366];
string climateOption = Climate.ConfigParameters.ClimateTimeSeries;
if (this.climatePhase == Climate.Phase.SpinUp_Climate)
climateOption = Climate.ConfigParameters.SpinUpClimateTimeSeries;
//Climate.ModelCore.UI.WriteLine(" Calculating daily data ... Ecoregion = {0}, Year = {1}, timestep = {2}.", ecoregion.Name, actualYear, timeStep);
switch (climateOption)
{
case "Daily_RandomYear":
{
TimeStep = timeStep;
if (this.climatePhase == Climate.Phase.Future_Climate)
timestepData = Climate.Future_AllData[Climate.RandSelectedTimeSteps_future[TimeStep]];
else if (this.climatePhase == Climate.Phase.SpinUp_Climate)
timestepData = Climate.Spinup_AllData[Climate.RandSelectedTimeSteps_future[TimeStep]];
break;
}
case "Daily_AverageAllYears":
{
if (this.climatePhase == Climate.Phase.Future_Climate)
timestepData = AnnualClimate_AvgDaily(ecoregion, actualYear, latitude);
else if (this.climatePhase == Climate.Phase.SpinUp_Climate)
timestepData = AnnualClimate_AvgDaily(ecoregion, actualYear, latitude);
break;
}
case "Daily_SequencedYears":
{
TimeStep = timeStep;
try
{
timestepData = Climate.Future_AllData[TimeStep];
}
catch (System.Collections.Generic.KeyNotFoundException ex)
{
throw new ClimateDataOutOfRangeException("Exception: The requested Time-step or ecoregion is out of range of the provided " + this.climatePhase.ToString() + " input file. This may be because the number of input climate data is not devisable to the number of specified time-steps or there is not enough historic climate data to run the model for the specified duration.", ex);
}
break;
}
default:
throw new ApplicationException(String.Format("Unknown Climate Time Series: {}", climateOption));
}
IClimateRecord[] ecoClimate = new IClimateRecord[MaxDayInYear];
this.Year = actualYear;
this.AnnualPrecip = 0.0;
for (int day = 0; day < MaxDayInYear; day++)
{
ecoClimate[day] = timestepData[ecoregion.Index, day];
if (ecoClimate[day] != null)
{
double DailyAvgTemp = (ecoClimate[day].AvgMinTemp + ecoClimate[day].AvgMaxTemp) / 2.0;
//Climate.ModelCore.UI.WriteLine("Timestep Data. PPt={0}, T={1}.", ecoClimate[day].AvgPpt, DailyAvgTemp);
this.DailyTemp[day] = DailyAvgTemp;
this.DailyMinTemp[day] = ecoClimate[day].AvgMinTemp;
this.DailyMaxTemp[day] = ecoClimate[day].AvgMaxTemp;
this.DailyPrecip[day] = Math.Max(0.0, ecoClimate[day].AvgPpt);
this.DailyPAR[day] = ecoClimate[day].PAR;
this.AnnualPrecip += this.DailyPrecip[day];
if (this.DailyPrecip[day] < 0)
this.DailyPrecip[day] = 0;
double hr = CalculateDayNightLength(day, latitude);
this.DailyDayLength[day] = (60.0 * 60.0 * hr); // seconds of daylight/day
this.DailyNightLength[day] = (60.0 * 60.0 * (24 - hr)); // seconds of nighttime/day
//this.DOY[day] = DayOfYear(day);
}
else
{
Climate.ModelCore.UI.WriteLine("Daily data = null.");
}
}
this.beginGrowing = CalculateBeginGrowingDay_Daily(); //ecoClimate);
this.endGrowing = CalculateEndGrowingDay_Daily(ecoClimate);
this.growingDegreeDays = GrowSeasonDegreeDays(actualYear);
//if (Climate.TimestepData.GetLength(1) > 365)
if (timestepData.GetLength(1) > 365)
this.isLeapYear = true;
}
示例14: SetProbability
//---------------------------------------------------------------------
public void SetProbability(IEcoregion ecoregion,
ISpecies species,
double probability)
{
probabilities[ecoregion.Index, species.Index] = probability;
}
示例15: Deposition
//---------------------------------------------------------------------
/// <summary>
/// Add nitrogen and phosphorus deposition to the mineral pools.
/// </summary>
public static void Deposition(IEcoregion ecoregion,
MineralSoil mineralSoil)
{
mineralSoil.ContentN += EcoregionData.DepositionN[ecoregion];
mineralSoil.ContentP += EcoregionData.DepositionP[ecoregion];
}