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

        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)
            {
                Main.ComputeTotalCohortCN(site, SiteVars.Cohorts[site]);
            }

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