//---------------------------------------------------------------------

        protected override IInputParameters Parse()
        {
            ReadLandisDataVar();

            int numLitterTypes     = 4;
            int numFunctionalTypes = 25;

            InputParameters parameters = new InputParameters(speciesDataset, numLitterTypes, numFunctionalTypes);

            InputVar <int> timestep = new InputVar <int>("Timestep");

            ReadVar(timestep);
            parameters.Timestep = timestep.Value;

            InputVar <SeedingAlgorithms> seedAlg = new InputVar <SeedingAlgorithms>("SeedingAlgorithm");

            ReadVar(seedAlg);
            parameters.SeedAlgorithm = seedAlg.Value;

            //---------------------------------------------------------------------------------

            InputVar <string> initCommunities = new InputVar <string>("InitialCommunities");

            ReadVar(initCommunities);
            parameters.InitialCommunities = initCommunities.Value;

            InputVar <string> communitiesMap = new InputVar <string>("InitialCommunitiesMap");

            ReadVar(communitiesMap);
            parameters.InitialCommunitiesMap = communitiesMap.Value;

            InputVar <string> climateConfigFile = new InputVar <string>("ClimateConfigFile");

            ReadVar(climateConfigFile);
            parameters.ClimateConfigFile = climateConfigFile.Value;

            InputVar <string> ageOnlyDisturbanceParms = new InputVar <string>("AgeOnlyDisturbances:BiomassParameters");

            ReadVar(ageOnlyDisturbanceParms);
            parameters.AgeOnlyDisturbanceParms = ageOnlyDisturbanceParms.Value;

            InputVar <string> soilDepthMapName = new InputVar <string>("SoilDepthMapName");

            ReadVar(soilDepthMapName);
            parameters.SoilDepthMapName = soilDepthMapName.Value;

            InputVar <string> soilDrainMapName = new InputVar <string>("SoilDrainMapName");

            ReadVar(soilDrainMapName);
            parameters.SoilDrainMapName = soilDrainMapName.Value;

            InputVar <string> soilBaseFlowMapName = new InputVar <string>("SoilBaseFlowMapName");

            ReadVar(soilBaseFlowMapName);
            parameters.SoilBaseFlowMapName = soilBaseFlowMapName.Value;

            InputVar <string> soilStormFlowMapName = new InputVar <string>("SoilStormFlowMapName");

            ReadVar(soilStormFlowMapName);
            parameters.SoilStormFlowMapName = soilStormFlowMapName.Value;

            InputVar <string> soilFCMapName = new InputVar <string>("SoilFieldCapacityMapName");

            ReadVar(soilFCMapName);
            parameters.SoilFieldCapacityMapName = soilFCMapName.Value;

            InputVar <string> soilWPMapName = new InputVar <string>("SoilWiltingPointMapName");

            ReadVar(soilWPMapName);
            parameters.SoilWiltingPointMapName = soilWPMapName.Value;

            InputVar <string> soilSandMapName = new InputVar <string>("SoilPercentSandMapName");

            ReadVar(soilSandMapName);
            parameters.SoilPercentSandMapName = soilSandMapName.Value;

            InputVar <string> soilClayMapName = new InputVar <string>("SoilPercentClayMapName");

            ReadVar(soilClayMapName);
            parameters.SoilPercentClayMapName = soilClayMapName.Value;

            InputVar <string> som1CsurfMapName = new InputVar <string>("InitialSOM1CsurfMapName");

            ReadVar(som1CsurfMapName);
            parameters.InitialSOM1CSurfaceMapName = som1CsurfMapName.Value;

            InputVar <string> som1NsurfMapName = new InputVar <string>("InitialSOM1NsurfMapName");

            ReadVar(som1NsurfMapName);
            parameters.InitialSOM1NSurfaceMapName = som1NsurfMapName.Value;

            InputVar <string> som1CsoilMapName = new InputVar <string>("InitialSOM1CsoilMapName");

            ReadVar(som1CsoilMapName);
            parameters.InitialSOM1CSoilMapName = som1CsoilMapName.Value;

            InputVar <string> som1NsoilMapName = new InputVar <string>("InitialSOM1NsoilMapName");

            ReadVar(som1NsoilMapName);
            parameters.InitialSOM1NSoilMapName = som1NsoilMapName.Value;

            InputVar <string> som2CMapName = new InputVar <string>("InitialSOM2CMapName");

            ReadVar(som2CMapName);
            parameters.InitialSOM2CMapName = som2CMapName.Value;

            InputVar <string> som2NMapName = new InputVar <string>("InitialSOM2NMapName");

            ReadVar(som2NMapName);
            parameters.InitialSOM2NMapName = som2NMapName.Value;

            InputVar <string> som3CMapName = new InputVar <string>("InitialSOM3CMapName");

            ReadVar(som3CMapName);
            parameters.InitialSOM3CMapName = som3CMapName.Value;

            InputVar <string> som3NMapName = new InputVar <string>("InitialSOM3NMapName");

            ReadVar(som3NMapName);
            parameters.InitialSOM3NMapName = som3NMapName.Value;

            InputVar <string> deadSurfMapName = new InputVar <string>("InitialDeadWoodSurfaceMapName");

            ReadVar(deadSurfMapName);
            parameters.InitialDeadSurfaceMapName = deadSurfMapName.Value;

            InputVar <string> deadSoilMapName = new InputVar <string>("InitialDeadCoarseRootsMapName");

            ReadVar(deadSoilMapName);
            parameters.InitialDeadSoilMapName = deadSoilMapName.Value;

            InputVar <bool> calimode = new InputVar <bool>("CalibrateMode");

            if (ReadOptionalVar(calimode))
            {
                parameters.CalibrateMode = calimode.Value;
            }
            else
            {
                parameters.CalibrateMode = false;
            }

            InputVar <string> wt = new InputVar <string>("WaterDecayFunction");

            ReadVar(wt);
            parameters.WType = WParse(wt.Value);

            InputVar <double> pea = new InputVar <double>("ProbabilityEstablishAdjust");

            ReadVar(pea);
            parameters.ProbEstablishAdjustment = pea.Value;

            InputVar <double> iMN = new InputVar <double>("InitialMineralN");

            ReadVar(iMN);
            parameters.SetInitMineralN(iMN.Value);

            InputVar <double> ans = new InputVar <double>("AtmosphericNSlope");

            ReadVar(ans);
            parameters.SetAtmosNslope(ans.Value);

            InputVar <double> ani = new InputVar <double>("AtmosphericNIntercept");

            ReadVar(ani);
            parameters.SetAtmosNintercept(ani.Value);

            InputVar <double> lat = new InputVar <double>("Latitude");

            ReadVar(lat);
            parameters.SetLatitude(lat.Value);

            InputVar <double> denits = new InputVar <double>("DenitrificationRate");

            ReadVar(denits);
            parameters.SetDenitrif(denits.Value);

            InputVar <double> drsoms = new InputVar <double>("DecayRateSurf");

            ReadVar(drsoms);
            parameters.SetDecayRateSurf(drsoms.Value);

            InputVar <double> drsom1 = new InputVar <double>("DecayRateSOM1");

            ReadVar(drsom1);
            parameters.SetDecayRateSOM1(drsom1.Value);

            InputVar <double> drsom2 = new InputVar <double>("DecayRateSOM2");

            ReadVar(drsom2);
            parameters.SetDecayRateSOM2(drsom2.Value);

            InputVar <double> drsom3 = new InputVar <double>("DecayRateSOM3");

            ReadVar(drsom3);
            parameters.SetDecayRateSOM3(drsom3.Value);

            InputVar <string> anppMaps = new InputVar <string>("ANPPMapNames");

            if (ReadOptionalVar(anppMaps))
            {
                PlugIn.ANPPMapNames = anppMaps.Value;

                InputVar <int> anppMapFreq = new InputVar <int>("ANPPMapFrequency");
                ReadVar(anppMapFreq);
                PlugIn.ANPPMapFrequency = anppMapFreq.Value;
            }

            InputVar <string> aneeMaps = new InputVar <string>("ANEEMapNames");

            if (ReadOptionalVar(aneeMaps))
            {
                PlugIn.ANEEMapNames = aneeMaps.Value;

                InputVar <int> aneeMapFreq = new InputVar <int>("ANEEMapFrequency");
                ReadVar(aneeMapFreq);
                PlugIn.ANEEMapFrequency = aneeMapFreq.Value;
            }

            InputVar <string> soilCarbonMaps = new InputVar <string>("SoilCarbonMapNames");

            if (ReadOptionalVar(soilCarbonMaps))
            {
                PlugIn.SoilCarbonMapNames = soilCarbonMaps.Value;

                InputVar <int> soilCarbonMapFreq = new InputVar <int>("SoilCarbonMapFrequency");
                ReadVar(soilCarbonMapFreq);
                PlugIn.SoilCarbonMapFrequency = soilCarbonMapFreq.Value;
            }

            InputVar <string> soilNitrogenMaps = new InputVar <string>("SoilNitrogenMapNames");

            if (ReadOptionalVar(soilNitrogenMaps))
            {
                PlugIn.SoilNitrogenMapNames = soilNitrogenMaps.Value;

                InputVar <int> soilNitrogenMapFreq = new InputVar <int>("SoilNitrogenMapFrequency");
                ReadVar(soilNitrogenMapFreq);
                PlugIn.SoilNitrogenMapFrequency = soilNitrogenMapFreq.Value;
            }

            InputVar <string> totalCMaps = new InputVar <string>("TotalCMapNames");

            if (ReadOptionalVar(totalCMaps))
            {
                PlugIn.TotalCMapNames = totalCMaps.Value;

                InputVar <int> totalCMapFreq = new InputVar <int>("TotalCMapFrequency");
                ReadVar(totalCMapFreq);
                PlugIn.TotalCMapFrequency = totalCMapFreq.Value;
            }


            //--------------------------
            //  MinRelativeBiomass table

            ReadName("MaximumLAI");
            InputVar <byte>   shadeClassVar = new InputVar <byte>("Shade Class");
            InputVar <double> maxLAI        = new InputVar <double>("Maximum LAI");

            for (byte shadeClass = 1; shadeClass <= 5; shadeClass++)
            {
                if (AtEndOfInput)
                {
                    throw NewParseException("Expected a line with available light class {0}", shadeClass);
                }

                StringReader currentLine = new StringReader(CurrentLine);
                ReadValue(shadeClassVar, currentLine);
                if (shadeClassVar.Value.Actual != shadeClass)
                {
                    throw new InputValueException(shadeClassVar.Value.String,
                                                  "Expected the available light class {0}", shadeClass);
                }

                ReadValue(maxLAI, currentLine);
                parameters.SetMaximumShadeLAI(shadeClass, maxLAI.Value);

                CheckNoDataAfter("the " + maxLAI + " column", currentLine);
                GetNextLine();
            }

            //----------------------------------------------------------
            //  Read table of sufficient light probabilities.
            //  Available light classes are in increasing order.
            ReadName("LightEstablishmentTable");

            InputVar <byte>   sc  = new InputVar <byte>("Available Light Class");
            InputVar <double> pl0 = new InputVar <double>("Probability of Germination - Light Level 0");
            InputVar <double> pl1 = new InputVar <double>("Probability of Germination - Light Level 1");
            InputVar <double> pl2 = new InputVar <double>("Probability of Germination - Light Level 2");
            InputVar <double> pl3 = new InputVar <double>("Probability of Germination - Light Level 3");
            InputVar <double> pl4 = new InputVar <double>("Probability of Germination - Light Level 4");
            InputVar <double> pl5 = new InputVar <double>("Probability of Germination - Light Level 5");

            int previousNumber = 0;

            while (!AtEndOfInput && CurrentName != Names.SpeciesParameters && previousNumber != 6)
            {
                StringReader currentLine = new StringReader(CurrentLine);

                ISufficientLight suffLight = new SufficientLight();

                ReadValue(sc, currentLine);
                suffLight.ShadeClass = sc.Value;

                //  Check that the current shade class is 1 more than
                //  the previous number (numbers are must be in increasing order).
                if (sc.Value.Actual != (byte)previousNumber + 1)
                {
                    throw new InputValueException(sc.Value.String,
                                                  "Expected the severity number {0}",
                                                  previousNumber + 1);
                }
                previousNumber = (int)sc.Value.Actual;

                ReadValue(pl0, currentLine);
                suffLight.ProbabilityLight0 = pl0.Value;

                ReadValue(pl1, currentLine);
                suffLight.ProbabilityLight1 = pl1.Value;

                ReadValue(pl2, currentLine);
                suffLight.ProbabilityLight2 = pl2.Value;

                ReadValue(pl3, currentLine);
                suffLight.ProbabilityLight3 = pl3.Value;

                ReadValue(pl4, currentLine);
                suffLight.ProbabilityLight4 = pl4.Value;

                ReadValue(pl5, currentLine);
                suffLight.ProbabilityLight5 = pl5.Value;

                parameters.LightClassProbabilities.Add(suffLight);

                CheckNoDataAfter("the " + pl5.Name + " column",
                                 currentLine);
                GetNextLine();
            }
            if (parameters.LightClassProbabilities.Count == 0)
            {
                throw NewParseException("No sufficient light probabilities defined.");
            }
            if (previousNumber != 5)
            {
                throw NewParseException("Expected shade class {0}", previousNumber + 1);
            }

            //-------------------------
            //  Species Parameters table

            ReadName("SpeciesParameters");

            speciesLineNums.Clear();  //  If parser re-used (i.e., for testing purposes)

            InputVar <int>    ft            = new InputVar <int>("Functional Type");
            InputVar <bool>   nt            = new InputVar <bool>("Nitrogen Fixer");
            InputVar <int>    gddmn         = new InputVar <int>("Growing Degree Day Minimum");
            InputVar <int>    gddmx         = new InputVar <int>("Growing Degree Day Maximum");
            InputVar <int>    mjt           = new InputVar <int>("Minimum January Temperature");
            InputVar <double> maxd          = new InputVar <double>("Maximum Allowable Drought");
            InputVar <double> leafLongevity = new InputVar <double>("Leaf Longevity");
            InputVar <bool>   epicorm       = new InputVar <bool>("Epicormic:  Y/N");
            InputVar <double> leafLignin    = new InputVar <double>("Leaf Percent Lignin");
            InputVar <double> wLignin       = new InputVar <double>("Wood Percent Lignin");
            InputVar <double> crLignin      = new InputVar <double>("Coarse Root Percent Lignin");
            InputVar <double> frLignin      = new InputVar <double>("Fine Root Percent Lignin");
            InputVar <double> leafCN        = new InputVar <double>("Leaf CN Ratio");
            InputVar <double> woodCN        = new InputVar <double>("Wood CN Ratio");
            InputVar <double> cRootCN       = new InputVar <double>("Coarse Root CN Ratio");
            InputVar <double> foliarCN      = new InputVar <double>("Foliage CN Ratio");
            InputVar <double> fRootCN       = new InputVar <double>("Fine Root CN Ratio");
            InputVar <int>    maxANPP       = new InputVar <int>("Maximum ANPP");
            InputVar <int>    maxBiomass    = new InputVar <int>("Maximum Aboveground Biomass");
            string            lastColumn    = "the " + maxBiomass.Name + " column";

            while (!AtEndOfInput && CurrentName != Names.FunctionalGroupParameters)
            {
                StringReader currentLine = new StringReader(CurrentLine);
                ISpecies     species     = ReadSpecies(currentLine);

                ReadValue(ft, currentLine);
                parameters.SetFunctionalType(species, ft.Value);

                ReadValue(nt, currentLine);
                parameters.NFixer[species] = nt.Value;

                ReadValue(gddmn, currentLine);
                parameters.SetGDDmin(species, gddmn.Value);

                ReadValue(gddmx, currentLine);
                parameters.SetGDDmax(species, gddmx.Value);

                ReadValue(mjt, currentLine);
                parameters.SetMinJanTemp(species, mjt.Value);

                ReadValue(maxd, currentLine);
                parameters.SetMaxDrought(species, maxd.Value);

                ReadValue(leafLongevity, currentLine);
                parameters.SetLeafLongevity(species, leafLongevity.Value);

                ReadValue(epicorm, currentLine);
                parameters.Epicormic[species] = epicorm.Value;

                ReadValue(leafLignin, currentLine);
                parameters.SetLeafLignin(species, leafLignin.Value);

                ReadValue(frLignin, currentLine);
                parameters.SetFineRootLignin(species, frLignin.Value);

                ReadValue(wLignin, currentLine);
                parameters.SetWoodLignin(species, wLignin.Value);

                ReadValue(crLignin, currentLine);
                parameters.SetCoarseRootLignin(species, crLignin.Value);

                ReadValue(leafCN, currentLine);
                parameters.SetLeafCN(species, leafCN.Value);

                ReadValue(fRootCN, currentLine);
                parameters.SetFineRootCN(species, fRootCN.Value);

                ReadValue(woodCN, currentLine);
                parameters.SetWoodCN(species, woodCN.Value);

                ReadValue(cRootCN, currentLine);
                parameters.SetCoarseRootCN(species, cRootCN.Value);

                ReadValue(foliarCN, currentLine);
                parameters.SetFoliageLitterCN(species, foliarCN.Value);

                ReadValue(maxANPP, currentLine);
                parameters.SetMaxANPP(species, maxANPP.Value);

                ReadValue(maxBiomass, currentLine);
                parameters.SetMaxBiomass(species, maxBiomass.Value);

                CheckNoDataAfter(lastColumn, currentLine);
                GetNextLine();
            }

            //--------- Read In Functional Group Table -------------------------------
            PlugIn.ModelCore.UI.WriteLine("   Begin parsing FUNCTIONAL GROUP table.");

            ReadName("FunctionalGroupParameters");

            InputVar <string> ftname             = new InputVar <string>("Name");
            InputVar <int>    ftindex            = new InputVar <int>("Index (< 25)");
            InputVar <double> tempcurve1         = new InputVar <double>("TempCurve(1)");
            InputVar <double> tempcurve2         = new InputVar <double>("TempCurve(2)");
            InputVar <double> tempcurve3         = new InputVar <double>("TempCurve(3)");
            InputVar <double> tempcurve4         = new InputVar <double>("TempCurve(4)");
            InputVar <double> fcfleaf            = new InputVar <double>("FCFRAC: Leaf");
            InputVar <double> btolai             = new InputVar <double>("BTOLAI");
            InputVar <double> klai               = new InputVar <double>("KLAI");
            InputVar <double> maxlai             = new InputVar <double>("MAXLAI");
            InputVar <double> mwm                = new InputVar <double>("Monthly Wood Mortality");
            InputVar <double> wdr                = new InputVar <double>("Wood Decay Rate");
            InputVar <double> mortCurveShapeParm = new InputVar <double>("Mortality Curve Shape Parameter");
            InputVar <int>    leafNeedleDrop     = new InputVar <int>("Leaf or Needle Drop Month");

            InputVar <double> ppr2 = new InputVar <double>("MoistureCurve2");
            InputVar <double> ppr3 = new InputVar <double>("MoistureCurve3");
            InputVar <double> coarseRootFraction = new InputVar <double>("CRootFrac");
            InputVar <double> fineRootFraction   = new InputVar <double>("FRootFrac");

            while (!AtEndOfInput && CurrentName != Names.FireReductionParameters)
            {
                StringReader currentLine = new StringReader(CurrentLine);

                ReadValue(ftname, currentLine);

                ReadValue(ftindex, currentLine);
                int ln = ftindex.Value.Actual;

                if (ln >= numFunctionalTypes)
                {
                    throw new InputValueException(ftindex.Value.String,
                                                  "The index:  {0} exceeds the allowable number of functional groups, {1}",
                                                  ftindex.Value.String, numFunctionalTypes - 1);
                }

                FunctionalType funcTParms = new FunctionalType();
                parameters.FunctionalTypes[ln] = funcTParms;

                ReadValue(tempcurve1, currentLine);
                funcTParms.TempCurve1 = tempcurve1.Value;

                ReadValue(tempcurve2, currentLine);
                funcTParms.TempCurve2 = tempcurve2.Value;

                ReadValue(tempcurve3, currentLine);
                funcTParms.TempCurve3 = tempcurve3.Value;

                ReadValue(tempcurve4, currentLine);
                funcTParms.TempCurve4 = tempcurve4.Value;

                ReadValue(fcfleaf, currentLine);
                funcTParms.FCFRACleaf = fcfleaf.Value;

                ReadValue(btolai, currentLine);
                funcTParms.BTOLAI = btolai.Value;

                ReadValue(klai, currentLine);
                funcTParms.KLAI = klai.Value;

                ReadValue(maxlai, currentLine);
                funcTParms.MAXLAI = maxlai.Value;

                ReadValue(ppr2, currentLine);
                funcTParms.MoistureCurve2 = ppr2.Value;

                ReadValue(ppr3, currentLine);
                funcTParms.MoistureCurve3 = ppr3.Value;

                ReadValue(wdr, currentLine);
                funcTParms.WoodDecayRate = wdr.Value;

                ReadValue(mwm, currentLine);
                funcTParms.MonthlyWoodMortality = mwm.Value;

                ReadValue(mortCurveShapeParm, currentLine);
                funcTParms.MortCurveShape = mortCurveShapeParm.Value;

                ReadValue(leafNeedleDrop, currentLine);
                funcTParms.LeafNeedleDrop = leafNeedleDrop.Value;

                ReadValue(coarseRootFraction, currentLine);
                funcTParms.CoarseRootFraction = coarseRootFraction.Value;

                ReadValue(fineRootFraction, currentLine);
                funcTParms.FineRootFraction = fineRootFraction.Value;

                CheckNoDataAfter("the " + fineRootFraction.Name + " column", currentLine);
                GetNextLine();
            }


            //--------- Read In Fire Reductions Table ---------------------------
            PlugIn.ModelCore.UI.WriteLine("   Begin reading FIRE REDUCTION parameters.");
            ReadName(Names.FireReductionParameters);

            InputVar <int>    frindex = new InputVar <int>("Fire Severity Index MUST = 1-5");
            InputVar <double> wred    = new InputVar <double>("Wood Reduction");
            InputVar <double> lred    = new InputVar <double>("Litter Reduction");

            while (!AtEndOfInput && CurrentName != Names.HarvestReductionParameters && CurrentName != Names.AgeOnlyDisturbanceParms)
            {
                StringReader currentLine = new StringReader(CurrentLine);

                ReadValue(frindex, currentLine);
                int ln = frindex.Value.Actual;

                if (ln < 1 || ln > 5)
                {
                    throw new InputValueException(ftindex.Value.String,
                                                  "The fire severity index:  {0} must be 1-5,",
                                                  frindex.Value.String);
                }


                FireReductions inputFireReduction = new FireReductions();  // ignoring severity = zero
                parameters.FireReductionsTable[ln] = inputFireReduction;

                ReadValue(wred, currentLine);
                inputFireReduction.WoodReduction = wred.Value;

                ReadValue(lred, currentLine);
                inputFireReduction.LitterReduction = lred.Value;

                CheckNoDataAfter("the " + lred.Name + " column", currentLine);

                GetNextLine();
            }

            //--------- Read In Harvest Reductions Table ---------------------------
            ReadOptionalName(Names.HarvestReductionParameters);
            {
                PlugIn.ModelCore.UI.WriteLine("   Begin reading HARVEST REDUCTION parameters.");
                InputVar <string> prescriptionName = new InputVar <string>("Prescription");
                InputVar <double> wred_pr          = new InputVar <double>("Wood Reduction");
                InputVar <double> lred_pr          = new InputVar <double>("Litter Reduction");

                while (!AtEndOfInput && CurrentName != Names.AgeOnlyDisturbanceParms)
                {
                    HarvestReductions harvReduction = new HarvestReductions();
                    parameters.HarvestReductionsTable.Add(harvReduction);

                    StringReader currentLine = new StringReader(CurrentLine);

                    ReadValue(prescriptionName, currentLine);
                    harvReduction.PrescriptionName = prescriptionName.Value;

                    ReadValue(wred_pr, currentLine);
                    harvReduction.WoodReduction = wred.Value;

                    ReadValue(lred_pr, currentLine);
                    harvReduction.LitterReduction = lred.Value;

                    GetNextLine();
                }
            }


            return(parameters);
        }
Example #2
0
        //---------------------------------------------------------------------

        public override void Initialize()
        {
            PlugIn.ModelCore.UI.WriteLine("Initializing {0} ...", ExtensionName);
            Timestep            = parameters.Timestep;
            SuccessionTimeStep  = Timestep;
            sufficientLight     = parameters.LightClassProbabilities;
            ProbEstablishAdjust = parameters.ProbEstablishAdjustment;
            MetadataHandler.InitializeMetadata(Timestep, modelCore, SoilCarbonMapNames, SoilNitrogenMapNames, ANPPMapNames, ANEEMapNames, TotalCMapNames); //,LAIMapNames, ShadeClassMapNames);
            //CohortBiomass.SpinupMortalityFraction = parameters.SpinupMortalityFraction;

            //Initialize climate.
            Climate.Initialize(parameters.ClimateConfigFile, false, modelCore);
            FutureClimateBaseYear = Climate.Future_MonthlyData.Keys.Min();

            ClimateRegionData.Initialize(parameters);
            SpeciesData.Initialize(parameters);
            Util.ReadSoilDepthMap(parameters.SoilDepthMapName);
            Util.ReadSoilDrainMap(parameters.SoilDrainMapName);
            Util.ReadSoilBaseFlowMap(parameters.SoilBaseFlowMapName);
            Util.ReadSoilStormFlowMap(parameters.SoilStormFlowMapName);
            Util.ReadFieldCapacityMap(parameters.SoilFieldCapacityMapName);
            Util.ReadWiltingPointMap(parameters.SoilWiltingPointMapName);
            Util.ReadPercentSandMap(parameters.SoilPercentSandMapName);
            Util.ReadPercentClayMap(parameters.SoilPercentClayMapName);
            Util.ReadSoilCNMaps(parameters.InitialSOM1CSurfaceMapName,
                                parameters.InitialSOM1NSurfaceMapName,
                                parameters.InitialSOM1CSoilMapName,
                                parameters.InitialSOM1NSoilMapName,
                                parameters.InitialSOM2CMapName,
                                parameters.InitialSOM2NMapName,
                                parameters.InitialSOM3CMapName,
                                parameters.InitialSOM3NMapName);
            Util.ReadDeadWoodMaps(parameters.InitialDeadSurfaceMapName, parameters.InitialDeadSoilMapName);

            AtmosNslope         = parameters.AtmosNslope;
            AtmosNintercept     = parameters.AtmosNintercept;
            Latitude            = parameters.Latitude;
            DenitrificationRate = parameters.Denitrif;
            DecayRateSurf       = parameters.DecayRateSurf;
            DecayRateSOM1       = parameters.DecayRateSOM1;
            DecayRateSOM2       = parameters.DecayRateSOM2;
            DecayRateSOM3       = parameters.DecayRateSOM3;

            ShadeLAI = parameters.MaximumShadeLAI; //.MinRelativeBiomass;
            OtherData.Initialize(parameters);
            FunctionalType.Initialize(parameters);
            FireEffects.Initialize(parameters);

            //  Cohorts must be created before the base class is initialized
            //  because the base class' reproduction module uses the core's
            //  SuccessionCohorts property in its Initialization method.
            Library.LeafBiomassCohorts.Cohorts.Initialize(Timestep, new CohortBiomass());

            // Initialize Reproduction routines:
            Reproduction.SufficientResources = SufficientLight;
            Reproduction.Establish           = Establish;
            Reproduction.AddNewCohort        = AddNewCohort;
            Reproduction.MaturePresent       = MaturePresent;
            base.Initialize(modelCore, parameters.SeedAlgorithm);
            Landis.Library.LeafBiomassCohorts.Cohort.PartialDeathEvent += CohortPartialMortality;
            Landis.Library.BiomassCohorts.Cohort.DeathEvent            += CohortDied;
            AgeOnlyDisturbances.Module.Initialize(parameters.AgeOnlyDisturbanceParms);

            //InitialBiomass.Initialize(Timestep);
            InitializeSites(parameters.InitialCommunities, parameters.InitialCommunitiesMap, modelCore);

            if (parameters.CalibrateMode)
            {
                Outputs.CreateCalibrateLogFile();
            }
            Establishment.InitializeLogFile();

            B_MAX = 0;
            foreach (ISpecies species in ModelCore.Species)
            {
                if (SpeciesData.Max_Biomass[species] > B_MAX)
                {
                    B_MAX = SpeciesData.Max_Biomass[species];
                }
            }

            foreach (ActiveSite site in PlugIn.ModelCore.Landscape)
            {
                Century.ComputeTotalCohortCN(site, SiteVars.Cohorts[site]);
            }

            Outputs.WritePrimaryLogFile(0);
            Outputs.WriteShortPrimaryLogFile(0);
        }