Exemple #1
0
        static int GetFirstActiveMonth(ISpecies spc, IInputParameters Parameters, DateTime date, IEcoregion ecoregion, int timespan)
        {
            int      HalfTimeSpan     = (int)Math.Round(0.5 * timespan, 0);
            DateTime DateCounter      = date.AddYears(-5);
            int      FirstActiveMonth = -1;

            bool FoundFirstActiveMonth = false;
            int  SumFirstActiveMonth   = 0;
            int  c = 0;

            while (DateCounter.CompareTo(date.AddYears(5)) < 1)
            {
                if (DateCounter.Month == 1)
                {
                    FoundFirstActiveMonth = false;
                }
                if (DateCounter.Year >= DateRange[0].Year && DateCounter.Year < DateRange[1].Year)
                {
                    if (GDD[ecoregion, spc, DateCounter] > Parameters.GDDFolSt[spc] && FoundFirstActiveMonth == false)
                    {
                        FoundFirstActiveMonth = true;
                        SumFirstActiveMonth  += DateCounter.Month;
                        c++;
                    }
                }

                DateCounter = DateCounter.AddMonths(1);
            }
            // Take the average over the designated time span
            FirstActiveMonth = (int)SumFirstActiveMonth / c;

            return(FirstActiveMonth);
        }
        //---------------------------------------------------------------------

        public override void LoadParameters(string dataFile, ICore mCore)
        {
            modelCore = mCore;
            SiteVars.Initialize();
            InputParameterParser parser = new InputParameterParser();
            parameters = Landis.Data.Load<IInputParameters>(dataFile, parser);
        }
        public static void Initialize(IInputParameters parameters)
        {
            AET       = parameters.AET;
            FolLignin = parameters.FolLignin;

            KNwdLitter = GetKNwdLitter();
        }
        //---------------------------------------------------------------------
        public static void Initialize(IInputParameters parameters)
        {
            LitterParameters = new LitterType[2];

            LitterType litterParmsSurface = new LitterType();
            LitterType litterParmsSoil    = new LitterType();

            CalibrateMode      = parameters.CalibrateMode;
            SoilWaterVersion64 = parameters.SoilWater64;
            WaterDecayFunction = parameters.WType;

            // Structural decomposition rate, the fraction of the pool that turns over each year.
            litterParmsSurface.DecayRateStrucC = 3.9 / 100.0; //DEC1(1)
            litterParmsSoil.DecayRateStrucC    = 4.9 / 100.0; //DEC1(2)

            // Metabolic decomposition rate, the fraction of the pool that turns over each year.
            litterParmsSurface.DecayRateMetabolicC = 14.8 / 100.0; //DEC2(1)  //modified assuming they meant, 'percentage'
            litterParmsSoil.DecayRateMetabolicC    = 18.5 / 100;   //DEC2(2)  //modified assuming they meant, 'percentage'

            // Decomposition rate of organic matter with active turnover, the fraction of the pool
            // that turns over each year (SOM1)
            litterParmsSurface.DecayRateMicrobes = 6.0 / 100.0; //DEC3(1)  set to 1.0 until meaning of 'fraction' is determined.
            litterParmsSoil.DecayRateMicrobes    = 7.3 / 100.0; //DEC3(2)

            LitterParameters[0] = litterParmsSurface;
            LitterParameters[1] = litterParmsSoil;
        }
Exemple #5
0
        //private static StreamWriter log;

        //---------------------------------------------------------------------
        public static void Initialize(IInputParameters parameters)
        {
            FuncType         = parameters.SppFunctionalType;
            NFixer           = parameters.NFixer;
            GDDmin           = parameters.GDDmin;
            GDDmax           = parameters.GDDmax;
            MinJanTemp       = parameters.MinJanTemp;
            MaxDrought       = parameters.MaxDrought;
            LeafLongevity    = parameters.LeafLongevity;
            Epicormic        = parameters.Epicormic;
            LeafLignin       = parameters.LeafLignin;
            WoodLignin       = parameters.WoodLignin;
            CoarseRootLignin = parameters.CoarseRootLignin;
            FineRootLignin   = parameters.FineRootLignin;
            LeafCN           = parameters.LeafCN;
            WoodCN           = parameters.WoodCN;
            CoarseRootCN     = parameters.CoarseRootCN;
            LeafLitterCN     = parameters.FoliageLitterCN;
            FineRootCN       = parameters.FineRootCN;
            //NLimits = new Species.AuxParm<double>(PlugIn.ModelCore.Species);

            Establishment.Initialize();

            // The initial set of establishment probabilities:
            EstablishProbability = Establishment.GenerateNewEstablishProbabilities(parameters.Timestep);

            ChangeParameters(parameters);
        }
        //private static StreamWriter log;
        //---------------------------------------------------------------------
        public static void Initialize(IInputParameters parameters)
        {
            FuncType            = parameters.SppFunctionalType;
            NFixer              = parameters.NFixer;
            GDDmin              = parameters.GDDmin;
            GDDmax              = parameters.GDDmax;
            MinJanTemp          = parameters.MinJanTemp;
            MaxDrought          = parameters.MaxDrought;
            LeafLongevity       = parameters.LeafLongevity;
            Epicormic           = parameters.Epicormic;
            LeafLignin          = parameters.LeafLignin;
            WoodLignin          = parameters.WoodLignin ;
            //CoarseRootLignin    = parameters.CoarseRootLignin ;
            //FineRootLignin      = parameters.FineRootLignin ;
            LeafCN              = parameters.LeafCN;
            WoodCN              = parameters.WoodCN;
            //CoarseRootCN        = parameters.CoarseRootCN;
            LeafLitterCN        = parameters.FoliageLitterCN;
            //FineRootCN          = parameters.FineRootCN;
            //NLimits = new Species.AuxParm<double>(PlugIn.ModelCore.Species);

            Establishment.Initialize();

            // The initial set of establishment probabilities:
            EstablishProbability = Establishment.GenerateNewEstablishProbabilities(parameters.Timestep);

            ChangeParameters(parameters);
        }
        //---------------------------------------------------------------------

        public override void LoadParameters(string dataFile,
                                            ICore mCore)
        {
            ExtensionMain baseHarvest = new BaseHarvest.PlugIn();
            try
            {
                baseHarvest.LoadParameters(null, mCore);
            }
            catch (System.ArgumentNullException)
            {
                // ignore
            }

            modelCore = mCore;

            // Add local event handler for cohorts death due to age-only
            // disturbances.
            Landis.Library.LeafBiomassCohorts.Cohort.AgeOnlyDeathEvent += CohortKilledByAgeOnlyDisturbance;

            InputParametersParser parser = new InputParametersParser(modelCore.Species);

            BaseHarvest.IInputParameters baseParameters = Landis.Data.Load<BaseHarvest.IInputParameters>(dataFile, parser);
            parameters = baseParameters as IInputParameters;
            if (parser.RoundedRepeatIntervals.Count > 0)
            {
                modelCore.UI.WriteLine("NOTE: The following repeat intervals were rounded up to");
                modelCore.UI.WriteLine("      ensure they were multiples of the harvest timestep:");
                modelCore.UI.WriteLine("      File: {0}", dataFile);
                foreach (RoundedInterval interval in parser.RoundedRepeatIntervals)
                    modelCore.UI.WriteLine("      At line {0}, the interval {1} rounded up to {2}",
                                 interval.LineNumber,
                                 interval.Original,
                                 interval.Adjusted);
            }
        }
Exemple #8
0
        //---------------------------------------------------------------------
        public static void Initialize(IInputParameters parameters)
        {
            transpiration       = PlugIn.ModelCore.Landscape.NewSiteVar <float>();
            AnnualTranspiration = PlugIn.ModelCore.Landscape.NewSiteVar <float>();
            infiltration        = PlugIn.ModelCore.Landscape.NewSiteVar <float>();
            runoff              = PlugIn.ModelCore.Landscape.NewSiteVar <float>();
            waterleakage        = PlugIn.ModelCore.Landscape.NewSiteVar <float>();
            evaporation         = PlugIn.ModelCore.Landscape.NewSiteVar <float>();
            WHC                 = parameters.WHC;
            EvaporationFraction = parameters.EvaporationFraction;
            LeakageFraction     = parameters.LeakageFraction;
            SnowPack            = PlugIn.ModelCore.Landscape.NewSiteVar <float>();
            Water               = PlugIn.ModelCore.Landscape.NewSiteVar <float>();

            foreach (ActiveSite site in PlugIn.ModelCore.Landscape)
            {
                SnowPack[site]            = 0;
                Water[site]               = 0;
                infiltration[site]        = 0;
                runoff[site]              = 0;
                evaporation[site]         = 0;
                transpiration[site]       = 0;
                AnnualTranspiration[site] = 0;
            }
            PlugIn.ModelCore.RegisterSiteVar(AnnualTranspiration, "Succession.AnnualTranspiration");

            PlugIn.ModelCore.RegisterSiteVar(Water, "Succession.SoilWater");
        }
        //---------------------------------------------------------------------

        public override void LoadParameters(string dataFile, ICore mCore)
        {
            modelCore = mCore;
            Landis.Library.HarvestManagement.Main.InitializeLib(modelCore);
            InputParametersParser parser = new InputParametersParser(mCore.Species);

            parameters = Landis.Data.Load <IInputParameters>(dataFile, parser);
            if (parser.RoundedRepeatIntervals.Count > 0)
            {
                PlugIn.ModelCore.UI.WriteLine("NOTE: The following repeat intervals were rounded up to");
                PlugIn.ModelCore.UI.WriteLine("      ensure they were multiples of the harvest timestep:");
                PlugIn.ModelCore.UI.WriteLine("      File: {0}", dataFile);
                foreach (RoundedInterval interval in parser.RoundedRepeatIntervals)
                {
                    PlugIn.ModelCore.UI.WriteLine("      At line {0}, the interval {1} rounded up to {2}",
                                                  interval.LineNumber,
                                                  interval.Original,
                                                  interval.Adjusted);
                }
            }
            if (parser.ParserNotes.Count > 0)
            {
                foreach (List <string> nList in parser.ParserNotes)
                {
                    foreach (string nLine in nList)
                    {
                        PlugIn.ModelCore.UI.WriteLine(nLine);
                    }
                }
            }
        }
        //---------------------------------------------------------------------
        public static void Initialize(IInputParameters parameters)
        {
            transpiration = PlugIn.ModelCore.Landscape.NewSiteVar<float>();
            AnnualTranspiration = PlugIn.ModelCore.Landscape.NewSiteVar<float>();
            infiltration = PlugIn.ModelCore.Landscape.NewSiteVar<float>();
            runoff = PlugIn.ModelCore.Landscape.NewSiteVar<float>();
            waterleakage = PlugIn.ModelCore.Landscape.NewSiteVar<float>();
            evaporation = PlugIn.ModelCore.Landscape.NewSiteVar<float>();
            WHC = parameters.WHC;
            EvaporationFraction = parameters.EvaporationFraction;
            LeakageFraction = parameters.LeakageFraction;
            SnowPack = PlugIn.ModelCore.Landscape.NewSiteVar<float>();
            Water = PlugIn.ModelCore.Landscape.NewSiteVar<float>();

            foreach (ActiveSite site in PlugIn.ModelCore.Landscape)
            {
                SnowPack[site] = 0;
                Water[site] = 0;
                infiltration[site] = 0;
                runoff[site] = 0;
                evaporation[site] = 0;
                transpiration[site] = 0;
                AnnualTranspiration[site] = 0;
            }
            PlugIn.ModelCore.RegisterSiteVar(AnnualTranspiration, "Succession.AnnualTranspiration");

            PlugIn.ModelCore.RegisterSiteVar(Water, "Succession.SoilWater");
        }
 //---------------------------------------------------------------------
 public static void Initialize(IInputParameters parameters)
 {
     RootTurnover         = parameters.RootTurnover;
     WoodTurnover         = parameters.WoodTurnover;
     FoliageTurnover      = parameters.FoliageTurnover;
     FolReten             = parameters.FolReten;
     LeafLignin           = parameters.LeafLignin;
     MortCurveShapeParm   = parameters.MortCurveShapeParm;
     GrowthCurveShapeParm = parameters.GrowthCurveShapeParm;
     HalfSat                = parameters.HalfSat;
     EstRadSensitivity      = parameters.EstRadSensitivity;
     EstMoistureSensitivity = parameters.EstMoistureSensitivity;
     PsnTOpt                = parameters.PsnTOpt;
     AmaxA                     = parameters.AmaxA;
     AmaxB                     = parameters.AmaxB;
     PsnTMin                   = parameters.PsnTMin;
     DVPD1                     = parameters.DVPD1;
     DVPD2                     = parameters.DVPD2;
     FolNCon                   = parameters.FolNCon;
     BaseFolRespFrac           = parameters.BaseFolRespFrac;
     GrowthMoistureSensitivity = parameters.GrowthMoistureSensitivity;
     SLWmax                    = parameters.SLWmax;
     k           = parameters.K;
     SenescStart = parameters.SenescStart;
     WUEConst    = parameters.WUEConst;
     RespQ10     = parameters.RespQ10;
     PsnAgeRed   = parameters.PsnAgeRed;
     InitialFol  = parameters.InitialFol;
     GDDFolStart = parameters.GDDFolStart;
     DFol        = parameters.DFol;
     GRespFrac   = parameters.GRespFrac;
     DRoot       = parameters.DRoot;
     DStem       = parameters.DStem;
 }
        public static void InitializeClimData(IInputParameters _parameters)
        {
            parameters = _parameters;

            ReadContent();

            SetFileProps();

            Data = new DateVar<CClimDay>("ClimateData", FirstYearOnFile, LastYearOnFile);

            for (int Year = FirstYearOnFile; Year < LastYearOnFile; Year++)
            {
                for(int Month = 1; Month <=12; Month++)
                {
                    string line = GetLine(Year, Month);
                    string[] terms = line.Split(delim);
                    if (terms.Count() != ColumnCount)
                    {
                        throw new System.Exception("Unexpected number of columns in " + parameters.climateFileName + " (year,month) "+ Year +" "+ Month);
                    }
                    DateTime CurrentDate = new DateTime(Year, Month, 15);

                    float TMax = float.Parse(terms[TMaxCol]);
                    float TMin = float.Parse(terms[TMinCol]);
                    float CO2 = float.Parse(terms[CO2Col]);
                    float PAR0 = float.Parse(terms[PAR0col]);
                    float Prec = float.Parse(terms[Preccol]);

                    if (TMax < TMin) throw new System.Exception("Recheck climate data in " + parameters.climateFileName + " Tmax < Tmin on " + CurrentDate);
                    else if (Prec < 0) throw new System.Exception("Recheck climate data in " + parameters.climateFileName + " Prec = " + Prec + "\t" + CurrentDate);

                    Data[CurrentDate] = new CClimDay(parameters.Latitude, CurrentDate, PAR0, TMin, TMax, Prec, CO2);
                }
            }
        }
        //---------------------------------------------------------------------
        public static void Initialize(IInputParameters parameters)
        {
            LitterParameters = new LitterType[2];

            LitterType litterParmsSurface = new LitterType();
            LitterType litterParmsSoil    = new LitterType();

            // Structural decomposition rate, the fraction of the pool that turns over each year.
            litterParmsSurface.DecayRateStrucC = 3.9; //DEC1(1)
            litterParmsSoil.DecayRateStrucC    = 4.9; //DEC1(2)

            // Metabolic decomposition rate, the fraction of the pool that turns over each year.
            litterParmsSurface.DecayRateMetabolicC = 1.48; //DEC2(1)  //modified assuming they meant, 'percentage'
            litterParmsSoil.DecayRateMetabolicC    = 1.85; //DEC2(2)  //modified assuming they meant, 'percentage'

            // Decomposition rate of organic matter with active turnover, the fraction of the pool
            // that turns over each year (SOM1)
            litterParmsSurface.DecayRateMicrobes = 1.0; // 6.0; //DEC3(1)  set to 1.0 until meaning of 'fraction' is determined.
            litterParmsSoil.DecayRateMicrobes    = 1.0; // 7.3; //DEC3(2)

            LitterParameters[0] = litterParmsSurface;
            LitterParameters[1] = litterParmsSoil;

            CalibrateMode = parameters.CalibrateMode;
            WType         = parameters.WType;
            //ProbEstablishAdjust = parameters.ProbEstablishAdjustment;
            //FractionSOM2toCO2   = parameters.FractionSOM2toCO2;
            //FractionSOM3toCO2   = parameters.FractionSOM3toCO2;
            //DecayRateSOM2       = parameters.DecayRateSOM2;
            //DecayRateSOM3       = parameters.DecayRateSOM3;
        }
        public static void Initialize(IInputParameters parameters)
        {
            Canopy.Initialize(parameters);

            TOroot    = parameters.TOroot;
            TOwood    = parameters.TOwood;
            TOfol     = parameters.TOfol;
            FolRet    = parameters.FolRet;
            HalfSat   = parameters.HalfSat;
            PsnTMin   = parameters.PsnTMin;
            GrMstSens = parameters.GrMstSens;

            SLWmax    = parameters.SLWmax;
            SLWDel    = parameters.SLWDel;
            k         = parameters.K;
            CDDFolEnd = parameters.CDDFolEnd;
            PsnAgeRed = parameters.PsnAgeRed;
            GDDFolSt  = parameters.GDDFolSt;

            RtStRatio     = parameters.RtStRatio;
            MaintRespFrac = parameters.MaintResp;
            DNSC          = parameters.DNSC;
            BFolResp      = parameters.BFolResp;
            Porosity      = parameters.Porosity;
        }
        //---------------------------------------------------------------------
        public static void Initialize(IInputParameters parameters)
        {
            string logFileName   = "Century-succession-log.csv";
            PlugIn.ModelCore.Log.WriteLine("   Opening Century-succession log file \"{0}\" ...", logFileName);
            try {
                log = new StreamWriter(logFileName);
            }
            catch (Exception err) {
                string mesg = string.Format("{0}", err.Message);
                throw new System.ApplicationException(mesg);
            }

            log.AutoFlush = true;
            log.Write("Time, Ecoregion, NumSites,");
            log.Write("NEEC, SOMTC, AGB, ");
            log.Write("AG_NPPC, BG_NPPC, LitterfallC, AgeMortality, ");
            log.Write("MineralN, TotalN, GrossMineralization, ");
            log.Write("C:LeafFRoot, C:WoodCRoot, C:DeadWood, C:DeadCRoot, ");
            log.Write("C:SurfStruc, C:SurfMeta, C:SoilStruc, C:SoilMeta, ");
            log.Write("C:SOM1surf, C:SOM1soil, C:SOM2, C:SOM3, ");
            log.Write("N:CohortLeaf, N:CohortWood, N:DeadWood, N:DeadRoot, ");
            log.Write("N:SurfStruc, N:SurfMeta, N:SoilStruc, N:SoilMeta, ");
            log.Write("N:SOM1surf, N:SOM1soil, N:SOM2, N:SOM3, ");
            log.Write("SurfStrucNetMin, SurfMetaNetMin, SoilStrucNetMin, SoilMetaNetMin, ");
            log.Write("SOM1surfNetMin, SOM1soilNetMin, SOM2NetMin, SOM3NetMin, ");
            log.Write("StreamC, StreamN, FireCEfflux, FireNEfflux, ");
            log.Write("Nuptake, Nresorbed, TotalSoilN, Nvol, avgfrassC,");
            log.WriteLine("");
        }
        //---------------------------------------------------------------------

        public static Event Initiate(ActiveSite site, double siteProbability, IInputParameters parameters)
        {
            if (PlugIn.ModelCore.GenerateUniform() <= siteProbability)
            {
                bool          eventTornado  = (PlugIn.ModelCore.GenerateUniform() <= parameters.TornadoProp);
                double        weibullLambda = parameters.TornadoLengthLambda;
                double        weibullAlpha  = parameters.TornadoLengthAlpha;
                double        eventWidth    = parameters.TornadoWidth;
                List <double> windIntPct    = parameters.TornadoWindIntPct;
                if (!eventTornado)
                {
                    weibullLambda = parameters.DerechoLengthLambda;
                    weibullAlpha  = parameters.DerechoLengthAlpha;
                    eventWidth    = parameters.DerechoWidth;
                    windIntPct    = parameters.DerechoWindIntPct;
                }
                PlugIn.ModelCore.WeibullDistribution.Lambda = weibullLambda;
                PlugIn.ModelCore.WeibullDistribution.Alpha  = weibullAlpha;
                double eventLength = PlugIn.ModelCore.WeibullDistribution.NextDouble();
                eventLength = PlugIn.ModelCore.WeibullDistribution.NextDouble();

                int    eventDirection = GetWindDirection(parameters.WindDirPct);
                double eventIntensity = GetWindIntensity(windIntPct);

                Event windEvent = new Event(site, eventLength, eventWidth, eventDirection, parameters.PropIntensityVar, eventIntensity, eventTornado);
                windEvent.Spread(PlugIn.ModelCore.CurrentTime, parameters.EcoParameters);
                return(windEvent);
            }
            else
            {
                return(null);
            }
        }
        //---------------------------------------------------------------------

        public override void LoadParameters(string dataFile, ICore mCore)
        {
            modelCore = mCore;
            Landis.Library.HarvestManagement.Main.InitializeLib(modelCore);
            InputParametersParser parser = new InputParametersParser(mCore.Species);
            parameters = Landis.Data.Load<IInputParameters>(dataFile, parser);
            if (parser.RoundedRepeatIntervals.Count > 0)
            {
                PlugIn.ModelCore.UI.WriteLine("NOTE: The following repeat intervals were rounded up to");
                PlugIn.ModelCore.UI.WriteLine("      ensure they were multiples of the harvest timestep:");
                PlugIn.ModelCore.UI.WriteLine("      File: {0}", dataFile);
                foreach (RoundedInterval interval in parser.RoundedRepeatIntervals)
                    PlugIn.ModelCore.UI.WriteLine("      At line {0}, the interval {1} rounded up to {2}",
                                 interval.LineNumber,
                                 interval.Original,
                                 interval.Adjusted);
            }
            if (parser.ParserNotes.Count > 0)
            {
                foreach (List<string> nList in parser.ParserNotes)
                {
                    foreach (string nLine in nList)
                    {
                        PlugIn.ModelCore.UI.WriteLine(nLine);
                    }
                }
            }
        }
 //---------------------------------------------------------------------
 public override void LoadParameters(string dataFile,
                                     ICore mCore)
 {
     modelCore = mCore;
     InputParametersParser parser = new InputParametersParser();
     parameters = modelCore.Load<IInputParameters>(dataFile, parser);
 }
 //---------------------------------------------------------------------
 public ParametersUpdate(int    year,
                         string file)
 {
     this.year = year;
     this.file = file;
     this.parameters = null;
 }
        public MetadataItem Extract(IInputParameters key)
        {
            var compilation = _controller.GetCompilation(key);
            var assembly    = _controller.GetAssembly(key);

            return(GenerateYamlMetadata(compilation, assembly, key.Options));
        }
        public static void Initialize(IInputParameters parameters)
        {
            KWdLit = parameters.KWdLit;

            if (parameters.CanopyLayerAges.Count() == 0)
            {
                CanopyNumbers = new int[1] {
                    0
                };
                return;
            }
            else
            {
                CanopyNumbers = new int[parameters.CanopyLayerAges[parameters.CanopyLayerAges.Count() - 1] + 1];

                for (int age = 0; age < parameters.CanopyLayerAges[parameters.CanopyLayerAges.Count - 1] + 1; age++)
                {
                    CanopyNumbers[age] = 1;
                    for (int l = 0; l < parameters.CanopyLayerAges.Count; l++)
                    {
                        if (age >= parameters.CanopyLayerAges[l])
                        {
                            CanopyNumbers[age] = parameters.CanopyLayerNumbers[l];
                        }
                    }
                }
            }
        }
        //---------------------------------------------------------------------
        public static void Initialize(IInputParameters parameters)
        {
            ActiveSiteCount    = new Ecoregions.AuxParm <int>(PlugIn.ModelCore.Ecoregions);
            AnnualWeather      = new Ecoregions.AuxParm <AnnualClimate_Monthly>(PlugIn.ModelCore.Ecoregions);
            MonthlyNDeposition = new Ecoregions.AuxParm <double[]>(PlugIn.ModelCore.Ecoregions);

            AnnualNDeposition = new Ecoregions.AuxParm <double>(PlugIn.ModelCore.Ecoregions);

            foreach (ActiveSite site in PlugIn.ModelCore.Landscape)
            {
                IEcoregion ecoregion = PlugIn.ModelCore.Ecoregion[site];
                ActiveSiteCount[ecoregion]++;
            }

            foreach (IEcoregion ecoregion in PlugIn.ModelCore.Ecoregions)
            {
                MonthlyNDeposition[ecoregion] = new double[12];

                if (ecoregion.Active)
                {
                    Climate.GenerateEcoregionClimateData(ecoregion, 0, PlugIn.Parameters.Latitude);
                    SetSingleAnnualClimate(ecoregion, 0, Climate.Phase.SpinUp_Climate);  // Some placeholder data to get things started.
                }
            }
        }
Exemple #23
0
        //---------------------------------------------------------------------

        public override void LoadParameters(string dataFile, ICore mCore)
        {
            modelCore = mCore;
            InputParametersParser parser = new InputParametersParser();

            parameters = Landis.Data.Load <IInputParameters>(dataFile, parser);
        }
 //---------------------------------------------------------------------
 public override void LoadParameters(string dataFile, ICore mCore)
 {
     modelCore = mCore;
     InputParametersParser.SpeciesDataset = modelCore.Species;
     InputParametersParser parser = new InputParametersParser();
     parameters = Landis.Data.Load<IInputParameters>(dataFile, parser);
 }
 //---------------------------------------------------------------------
 public static void Initialize(IInputParameters parameters)
 {
     RootTurnover = parameters.RootTurnover;
     WoodTurnover = parameters.WoodTurnover;
     FoliageTurnover = parameters.FoliageTurnover;
     FolReten = parameters.FolReten;
     LeafLignin = parameters.LeafLignin;
     MortCurveShapeParm      = parameters.MortCurveShapeParm;
     GrowthCurveShapeParm = parameters.GrowthCurveShapeParm;
     HalfSat = parameters.HalfSat;
     EstRadSensitivity = parameters.EstRadSensitivity;
     EstMoistureSensitivity = parameters.EstMoistureSensitivity;
     PsnTOpt = parameters.PsnTOpt;
     AmaxA = parameters.AmaxA;
     AmaxB = parameters.AmaxB;
     PsnTMin = parameters.PsnTMin;
     DVPD1 = parameters.DVPD1;
     DVPD2 = parameters.DVPD2;
     FolNCon = parameters.FolNCon;
     BaseFolRespFrac = parameters.BaseFolRespFrac;
     GrowthMoistureSensitivity = parameters.GrowthMoistureSensitivity;
     SLWmax = parameters.SLWmax;
     k=parameters.K;
     SenescStart = parameters.SenescStart;
     WUEConst = parameters.WUEConst;
     RespQ10 = parameters.RespQ10;
     PsnAgeRed = parameters.PsnAgeRed;
     InitialFol = parameters.InitialFol;
     GDDFolStart = parameters.GDDFolStart;
     DFol = parameters.DFol;
     GRespFrac = parameters.GRespFrac;
     DRoot = parameters.DRoot;
     DStem = parameters.DStem;
 }
        public static void Initialize(IInputParameters parameters)
        {
            InitializeSpeciesParameters(parameters);
            InitializeSiteVariables();

            PlugIn.ModelCore.RegisterSiteVar(establishments, "Succession.Establishments");
        }
Exemple #27
0
 public static void Initialize(IInputParameters parameters)
 {
     WHC            = parameters.WHC;
     PrecipLossFrac = parameters.PrecipLossFrac;
     Porosity       = parameters.Porosity;
     LeakageFrac    = parameters.LeakageFrac;
 }
Exemple #28
0
        //---------------------------------------------------------------------

        public static void Initialize(IInputParameters parameters)
        {
            manyInsect = parameters.ManyInsect;

            // Assign the method below to the CohortGrowthReduction delegate in
            // biomass-cohorts/Biomass.CohortGrowthReduction.cs
            CohortGrowthReduction.Compute = ReduceCohortGrowth;
        }
 //---------------------------------------------------------------------
 public static void Initialize(IInputParameters parameters)
 {
     LeafLignin           = parameters.LeafLignin;
     LeafLongevity        = parameters.LeafLongevity;
     MortCurveShapeParm   = parameters.MortCurveShapeParm;
     GrowthCurveShapeParm = parameters.GrowthCurveShapeParm;
     WoodyDebrisDecay     = parameters.WoodyDecayRate;
 }
Exemple #30
0
        public static void Initialize(IInputParameters parameters)
        {
            InitializeSpeciesParameters(parameters);
            InitializeSiteVariables();


            PlugIn.ModelCore.RegisterSiteVar(establishments, "Succession.Establishments");
        }
        //---------------------------------------------------------------------

        public static void Initialize(IInputParameters parameters)
        {
            manyInsect = parameters.ManyInsect;

            // Assign the method below to the CohortDefoliation delegate in
            // biomass-cohorts/Biomass.CohortDefoliation.cs
            Landis.Library.Biomass.CohortDefoliation.Compute = Defoliate.DefoliateCohort;
        }
Exemple #32
0
 //---------------------------------------------------------------------
 public static void Initialize(IInputParameters parameters)
 {
     //ChangeParameters(parameters);
     Drought_Y    = parameters.Drought_Y;
     Drought_YSE  = parameters.Drought_YSE;
     Drought_B    = parameters.Drought_B;
     Drought_BSE  = parameters.Drought_BSE;
     Drought_Sens = parameters.Drought_Sens;
 }
        //---------------------------------------------------------------------

        public override void LoadParameters(string dataFile,
                                            ICore mCore)
        {
            modelCore = mCore;
            SiteVars.Initialize(mCore);
            ParameterParser parser = new ParameterParser();
            parameters = mCore.Load<IInputParameters>(dataFile, parser);
            modelCore.Log.WriteLine("Exiting LoadParameters method !!!");
        }
Exemple #34
0
        //---------------------------------------------------------------------

        public static void Initialize(IInputParameters parameters)
        {
            manyInsect = parameters.ManyInsect;

            // Assign the method below to the CohortDefoliation delegate in
            // biomass-cohorts/Biomass.CohortDefoliation.cs
            Landis.Library.Biomass.CohortDefoliation.Compute = Landis.Extension.Insects.Defoliate.DefoliateCohort;
            //Landis.Library.LeafBiomassCohorts.CohortDefoliation.Compute = Landis.Extension.Insects.Defoliate.DefoliateCohort;
        }
Exemple #35
0
        //---------------------------------------------------------------------

        public override void LoadParameters(string dataFile,
                                            ICore mCore)
        {
            modelCore = mCore;
            SiteVars.Initialize();
            InputParameterParser parser = new InputParameterParser();

            Parameters = Landis.Data.Load <IInputParameters>(dataFile, parser);
        }
Exemple #36
0
        //---------------------------------------------------------------------
        public override void LoadParameters(string dataFile,
                                            ICore mCore)
        {
            modelCore = mCore;
            InputParametersParser.SpeciesDataset = modelCore.Species;
            InputParametersParser parser = new InputParametersParser();

            parameters = modelCore.Load <IInputParameters>(dataFile, parser);
        }
 //---------------------------------------------------------------------
 public static void Initialize(IInputParameters parameters)
 {
     //ChangeParameters(parameters);
     Drought_Y = parameters.Drought_Y;
     Drought_YSE = parameters.Drought_YSE;
     Drought_B = parameters.Drought_B;
     Drought_BSE = parameters.Drought_BSE;
     Drought_Sens = parameters.Drought_Sens;
 }
        //---------------------------------------------------------------------

        public static void Initialize(IInputParameters parameters)
        {
            manyInsect = parameters.ManyInsect;

            // Assign the method below to the CohortGrowthReduction delegate in
            // biomass-cohorts/Biomass.CohortGrowthReduction.cs
            CohortGrowthReduction.Compute = ReduceCohortGrowth;

        }
        //---------------------------------------------------------------------
        public static void Initialize(IInputParameters parameters)
        {
            foreach (ActiveSite site in Model.Core.Landscape)
            {
                IEcoregion ecoregion = Model.Core.Ecoregion[site];

                SiteVars.Rock[site].ContentP = (parameters.InitialMineralP[ecoregion] * 0.99);
            }
        }
 //---------------------------------------------------------------------
 public static void Initialize(IInputParameters parameters)
 {
     UpdateParameters(parameters);
     ActiveSiteCount = new Ecoregions.AuxParm<int>(Model.Core.Ecoregions);
     foreach (ActiveSite site in Model.Core.Landscape)
     {
         IEcoregion ecoregion = Model.Core.Ecoregion[site];
         ActiveSiteCount[ecoregion]++;
     }
 }
 public static void Initialize(IInputParameters parameters)
 {
     EstRad = parameters.EstRad;
     EstMoist = parameters.EstMoist;
     GDDFolSt = parameters.GDDFolSt;
     PsnTMin = parameters.PsnTMin;
     CDDFolEnd = parameters.CDDFolEnd;
     HalfSat = parameters.HalfSat;
     Porosity = parameters.Porosity;
 }
        //---------------------------------------------------------------------

        public override void LoadParameters(string dataFile,
                                            ICore mCore)
        {
            modelCore = mCore;
            SiteVars.Initialize();
            InputParameterParser parser = new InputParameterParser();

            parameters       = Landis.Data.Load <IInputParameters>(dataFile, parser);
            WeatherDataTable = Weather.ReadWeatherFile(parameters.InitialWeatherPath, FireRegions.Dataset, parameters.SeasonParameters);
        }
Exemple #43
0
 private static void InitializeSpeciesParameters(IInputParameters parameters)
 {
     EstRadSensitivity      = parameters.EstRadSensitivity;
     EstMoistureSensitivity = parameters.EstMoistureSensitivity;
     GDDFolStart            = parameters.GDDFolStart;
     GDDFolEnd   = parameters.GDDFolEnd;
     PsnTMin     = parameters.PsnTMin;
     SenescStart = parameters.SenescStart;
     HalfSat     = parameters.HalfSat;
 }
 public static void Initialize(IInputParameters parameters)
 {
     EstRad    = parameters.EstRad;
     EstMoist  = parameters.EstMoist;
     GDDFolSt  = parameters.GDDFolSt;
     PsnTMin   = parameters.PsnTMin;
     CDDFolEnd = parameters.CDDFolEnd;
     HalfSat   = parameters.HalfSat;
     Porosity  = parameters.Porosity;
 }
        public override void LoadParameters(string dataFile, ICore mCore)
        {
            modelCore = mCore;
            InputParameterParser parser = new InputParameterParser();
            parameters = Landis.Data.Load<IInputParameters>(dataFile, parser);

            // Add local event handler for cohorts death due to age-only
            // disturbances.
            Cohort.AgeOnlyDeathEvent += CohortKilledByAgeOnlyDisturbance;

        }
Exemple #46
0
 private static VarEcoregionSpecies <float> GetWiltingPoint(IInputParameters Parameters)
 {
     wiltingpoint_mm = new VarEcoregionSpecies <float>("wiltingpoint_mm");
     foreach (IEcoregion ecoregion in PlugIn.ModelCore.Ecoregions)
     {
         foreach (ISpecies spc in PlugIn.modelCore.Species)
         {
             wiltingpoint_mm[ecoregion, spc] = Parameters.WltPnt[spc] * Parameters.WHC[ecoregion];
         }
     }
     return(wiltingpoint_mm);
 }
Exemple #47
0
        //---------------------------------------------------------------------

        public override void LoadParameters(string dataFile, ICore mCore)
        {
            modelCore = mCore;
            //SiteVars.Initialize();
            InputParameterParser parser = new InputParameterParser();

            parameters = Landis.Data.Load <IInputParameters>(dataFile, parser);

            // Add local event handler for cohorts death due to age-only
            // disturbances.
            //Cohort.AgeOnlyDeathEvent += CohortKilledByAgeOnlyDisturbance;
        }
Exemple #48
0
 internal FileProcessing(IInputParameters inputParameters)
 {
     _inputParameters = inputParameters;
     _threads         = new Thread[_threadsNumber];
     _threadReady     = new List <bool>();
     for (int i = 0; i < _threadsNumber; i++)
     {
         _threadReady.Add(true);
     }
     _calculationInProgress = false;
     _blocks      = new Dictionary <int, byte[]>();
     _stopProcess = false;
 }
        //---------------------------------------------------------------------
        public static void Initialize(IInputParameters parameters)
        {
            AET = parameters.AET;  //FINISH LATER

            B_MAX               = new Ecoregions.AuxParm<int>(PlugIn.ModelCore.Ecoregions);
            ActiveSiteCount     = new Ecoregions.AuxParm<int>(PlugIn.ModelCore.Ecoregions);

            foreach (ActiveSite site in PlugIn.ModelCore.Landscape)
            {
                IEcoregion ecoregion = PlugIn.ModelCore.Ecoregion[site];
                ActiveSiteCount[ecoregion]++;
            }
        }
        private static void Process(IInputParameters input)
        {
            IDicomServices        dicomServices        = new DicomServices();
            ICatheterBlocks       catheterBlocks       = new CatheterBlocks(input.NumberOfChannelsInVerificationPlan);
            ICatheterBlockService catheterBlockService = new CatheterBlockService(catheterBlocks);

            var catheterOverloader =
                CatheterOverloaderFactory.Create(new CatheterOverloadingParametersAdapter(input, dicomServices),
                                                 dicomServices,
                                                 catheterBlockService);

            catheterOverloader.RunOverloading();
            catheterOverloader.SaveToFile("outputFile.dcm");
        }
        //---------------------------------------------------------------------
        public static void Initialize(IInputParameters parameters)
        {
            AET = parameters.AET;
            WHC = parameters.WHC;
            EvaporationFraction = parameters.EvaporationFraction;
            LeakageFraction     = parameters.LeakageFraction;
            ActiveSiteCount     = new Landis.Extension.Succession.Biomass.Ecoregions.AuxParm <int>(PlugIn.ModelCore.Ecoregions);

            foreach (ActiveSite site in PlugIn.ModelCore.Landscape)
            {
                IEcoregion ecoregion = PlugIn.ModelCore.Ecoregion[site];
                ActiveSiteCount[ecoregion]++;
            }
        }
        //---------------------------------------------------------------------
        public static void Initialize(IInputParameters parameters)
        {
            AET = parameters.AET;
            WHC = parameters.WHC;
            EvaporationFraction = parameters.EvaporationFraction;
            LeakageFraction = parameters.LeakageFraction;
            ActiveSiteCount     = new Landis.Extension.Succession.Biomass.Ecoregions.AuxParm<int>(PlugIn.ModelCore.Ecoregions);

            foreach (ActiveSite site in PlugIn.ModelCore.Landscape)
            {
                IEcoregion ecoregion = PlugIn.ModelCore.Ecoregion[site];
                ActiveSiteCount[ecoregion]++;
            }
        }
        //---------------------------------------------------------------------
        public static void Initialize(IInputParameters parameters)
        {
            string logFileName   = "Biomass-succession-v2-log.csv";
            PlugIn.ModelCore.Log.WriteLine("   Opening Biomass-succession log file \"{0}\" ...", logFileName);
            try {
                log = PlugIn.ModelCore.CreateTextFile(logFileName);
            }
            catch (Exception err) {
                string mesg = string.Format("{0}", err.Message);
                throw new System.ApplicationException(mesg);
            }

            log.AutoFlush = true;
            log.Write("Time, Ecoregion, NumSites,");
            log.Write("LiveB, AG_NPP, LitterB");
            log.WriteLine("");
        }
        //---------------------------------------------------------------------

        public override void LoadParameters(string dataFile, ICore mCore)
        {
            modelCore = mCore;
            SiteVars.Initialize();
            InputParametersParser parser = new InputParametersParser(mCore.Species);
            parameters = mCore.Load<IInputParameters>(dataFile, parser);
            if (parser.RoundedRepeatIntervals.Count > 0)
            {
                PlugIn.ModelCore.Log.WriteLine("NOTE: The following repeat intervals were rounded up to");
                PlugIn.ModelCore.Log.WriteLine("      ensure they were multiples of the harvest timestep:");
                PlugIn.ModelCore.Log.WriteLine("      File: {0}", dataFile);
                foreach (RoundedInterval interval in parser.RoundedRepeatIntervals)
                    PlugIn.ModelCore.Log.WriteLine("      At line {0}, the interval {1} rounded up to {2}",
                                 interval.LineNumber,
                                 interval.Original,
                                 interval.Adjusted);
            }
        }
        //---------------------------------------------------------------------
        public static void InitializeMonthly(IInputParameters parameters)
        {
            string logFileName   = "Century-succession-monthly-log.csv";
            PlugIn.ModelCore.Log.WriteLine("   Opening Century-succession log file \"{0}\" ...", logFileName);
            try {
                logMonthly = new StreamWriter(logFileName);
            }
            catch (Exception err) {
                string mesg = string.Format("{0}", err.Message);
                throw new System.ApplicationException(mesg);
            }

            logMonthly.AutoFlush = true;
            logMonthly.Write("Time, Month, Ecoregion, NumSites,");
            logMonthly.Write("PPT, T, ");
            logMonthly.Write("NPPC, Resp, NEE, ");
            logMonthly.Write("Ndeposition, Nvolatilization");
            logMonthly.WriteLine("");
        }
        //---------------------------------------------------------------------
        public static void Initialize(IInputParameters parameters)
        {
            string logFileName   = "Nutrient-succession-log.csv";
            UI.WriteLine("   Opening Nutrient-succession log file \"{0}\" ...", logFileName);
            try {
                log = Data.CreateTextFile(logFileName);
            }
            catch (Exception err) {
                string mesg = string.Format("{0}", err.Message);
                throw new System.ApplicationException(mesg);
            }

            log.AutoFlush = true;
            log.Write("Time, Ecoregion, NumSites,");
            log.Write("AGB, TotalC, TotalLiveC,");
            log.Write("TotalSOC, CharcoalC, TotalDetritalC,");
            log.Write("CNratio");
            log.WriteLine("");
        }
        //---------------------------------------------------------------------
        public static void Initialize(IInputParameters parameters)
        {
            AET = parameters.AET;
             MinRelativeBiomass = parameters.MinRelativeBiomass;

             B_MAX = new Landis.Library.Parameters.Ecoregions.AuxParm<int>(PlugIn.ModelCore.Ecoregions);
             ActiveSiteCount = new Landis.Library.Parameters.Ecoregions.AuxParm<int>(PlugIn.ModelCore.Ecoregions);

            foreach (ActiveSite site in PlugIn.ModelCore.Landscape)
            {
                IEcoregion ecoregion = PlugIn.ModelCore.Ecoregion[site];
                ActiveSiteCount[ecoregion]++;
            }
            foreach (IEcoregion ecoregion in PlugIn.ModelCore.Ecoregions)
            {
                if (EcoregionData.AET[ecoregion] <= 0.0 && ecoregion.Active)
                {
                    PlugIn.ModelCore.UI.WriteLine("   CAUTION: Ecoregion {0} has AET set to zero.", ecoregion.Name);
                }

            }
        }
        //---------------------------------------------------------------------

        public override void LoadParameters(string dataFile, ICore mCore)
        {
            modelCore = mCore;
            SiteVars.Initialize();

            // Prescription names are parsed for LU names when prescriptions are parsed and created.
            // So need to read land-uses first.
            Landis.Library.LandUses.LandUse.Initialize(modelCore);

            InputParametersParser parser = new InputParametersParser(mCore.Species);
            parameters = Landis.Data.Load<IInputParameters>(dataFile, parser);
            if (parser.RoundedRepeatIntervals.Count > 0)
            {
                PlugIn.ModelCore.UI.WriteLine("NOTE: The following repeat intervals were rounded up to");
                PlugIn.ModelCore.UI.WriteLine("      ensure they were multiples of the harvest timestep:");
                PlugIn.ModelCore.UI.WriteLine("      File: {0}", dataFile);
                foreach (RoundedInterval interval in parser.RoundedRepeatIntervals)
                    PlugIn.ModelCore.UI.WriteLine("      At line {0}, the interval {1} rounded up to {2}",
                                 interval.LineNumber,
                                 interval.Original,
                                 interval.Adjusted);
            }
        }
        //---------------------------------------------------------------------
        public static void Initialize(IInputParameters parameters)
        {
            UpdateParameters(parameters);

            foreach (ActiveSite site in Model.Core.Landscape)
            {
                IEcoregion ecoregion = Model.Core.Ecoregion[site];

                SiteVars.SoilOrganicMatter[site].ContentC = parameters.InitialSOMC[ecoregion];
                SiteVars.SoilOrganicMatter[site].Mass = parameters.InitialSOMMass[ecoregion];
                SiteVars.SoilOrganicMatter[site].ContentN = parameters.InitialSOMN[ecoregion];
                SiteVars.SoilOrganicMatter[site].ContentP = parameters.InitialSOMP[ecoregion];
            }
        }
        //---------------------------------------------------------------------
        public static void Initialize(IInputParameters parameters)
        {
            PercentClay         = parameters.PercentClay;
            PercentSand         = parameters.PercentSand;
            SoilDepth           = parameters.SoilDepth;
            FieldCapacity       = parameters.FieldCapacity;
            WiltingPoint        = parameters.WiltingPoint;
            StormFlowFraction   = parameters.StormFlowFraction;
            BaseFlowFraction    = parameters.BaseFlowFraction;
            Drain               = parameters.Drain;
            //MonthlyNDeposition = parameters.MonthlyNDeposition;
            AtmosNslope         = parameters.AtmosNslope;
            AtmosNintercept     = parameters.AtmosNintercept;
            Latitude            = parameters.Latitude;
            ShadeBiomass        = parameters.MinRelativeBiomass;

            ActiveSiteCount = new Ecoregions.AuxParm<double>(PlugIn.ModelCore.Ecoregions);
            ClimateUpdates  = new Ecoregions.AuxParm<bool[]>(PlugIn.ModelCore.Ecoregions);

            foreach (ActiveSite site in PlugIn.ModelCore.Landscape)
            {
                IEcoregion ecoregion = PlugIn.ModelCore.Ecoregion[site];

                SiteVars.SOM1surface[site].Carbon     = parameters.InitialSOM1surfC[ecoregion];
                SiteVars.SOM1surface[site].Nitrogen   = parameters.InitialSOM1surfN[ecoregion];

                SiteVars.SOM1soil[site].Carbon          = parameters.InitialSOM1soilC[ecoregion];
                SiteVars.SOM1soil[site].Nitrogen        = parameters.InitialSOM1soilN[ecoregion];

                SiteVars.SOM2[site].Carbon              = parameters.InitialSOM2C[ecoregion];
                SiteVars.SOM2[site].Nitrogen            = parameters.InitialSOM2N[ecoregion];

                SiteVars.SOM3[site].Carbon              = parameters.InitialSOM3C[ecoregion];
                SiteVars.SOM3[site].Nitrogen            = parameters.InitialSOM3N[ecoregion];

                SiteVars.MineralN[site]               = parameters.InitialMineralN[ecoregion];

                ActiveSiteCount[ecoregion]++;
            }

            GenerateNewClimate(0, parameters.Timestep);

            AnnualWeather = new Ecoregions.AuxParm<AnnualClimate>(PlugIn.ModelCore.Ecoregions);
            foreach(IEcoregion ecoregion in PlugIn.ModelCore.Ecoregions)
                if(ActiveSiteCount[ecoregion] > 0)
                {
                    SetAnnualClimate(ecoregion, 0);
                    ClimateUpdates[ecoregion] = new bool[PlugIn.ModelCore.EndTime + parameters.Timestep + 1];
                    ClimateUpdates[ecoregion][0] = true;
                }
        }