WriteMap() публичный Метод

Writes an output map of biomass removed from each active site.
public WriteMap ( int timestep ) : void
timestep int /// Timestep to use in the map's name. ///
Результат void
Пример #1
0
        //---------------------------------------------------------------------

        public override void Run()
        {
            running = true;

            HarvestMgmtLib.SiteVars.Prescription.ActiveSiteValues = null;
            SiteVars.BiomassRemoved.ActiveSiteValues = 0;
            Landis.Library.BiomassHarvest.SiteVars.CohortsPartiallyDamaged.ActiveSiteValues = 0;
            HarvestMgmtLib.SiteVars.CohortsDamaged.ActiveSiteValues = 0;
            SiteVars.BiomassBySpecies.ActiveSiteValues = null;

            SiteBiomass.EnableRecordingForHarvest();

            //harvest each management area in the list
            foreach (ManagementArea mgmtArea in managementAreas)
            {
                totalSites          = new int[Prescription.Count];
                totalDamagedSites   = new int[Prescription.Count];
                totalSpeciesCohorts = new int[Prescription.Count, modelCore.Species.Count];
                totalCohortsDamaged = new int[Prescription.Count];
                totalCohortsKilled  = new int[Prescription.Count];
                // 2015-09-14 LCB Track prescriptions as they are reported in summary log so we don't duplicate
                prescriptionReported = new bool[Prescription.Count];
                totalSpeciesBiomass  = new double[Prescription.Count, modelCore.Species.Count];
                totalBiomassRemoved  = new double[Prescription.Count];

                mgmtArea.HarvestStands();
                //and record each stand that's been harvested

                foreach (Stand stand in mgmtArea)
                {
                    //ModelCore.UI.WriteLine("   List of stands {0} ...", stand.MapCode);
                    if (stand.Harvested)
                    {
                        WriteLogEntry(mgmtArea, stand);
                    }
                }

                // Prevent establishment:
                foreach (Stand stand in mgmtArea)
                {
                    if (stand.Harvested && stand.LastPrescription.PreventEstablishment)
                    {
                        List <ActiveSite> sitesToDelete = new List <ActiveSite>();

                        foreach (ActiveSite site in stand)
                        {
                            if (Landis.Library.BiomassHarvest.SiteVars.CohortsPartiallyDamaged[site] > 0 || HarvestMgmtLib.SiteVars.CohortsDamaged[site] > 0)
                            {
                                Landis.Library.Succession.Reproduction.PreventEstablishment(site);
                                sitesToDelete.Add(site);
                            }
                        }

                        foreach (ActiveSite site in sitesToDelete)
                        {
                            stand.DelistActiveSite(site);
                        }
                    }
                }

                // Write Summary Log File:
                foreach (AppliedPrescription aprescription in mgmtArea.Prescriptions)
                {
                    Prescription prescription    = aprescription.Prescription;
                    double[]     species_cohorts = new double[modelCore.Species.Count];
                    double[]     species_biomass = new double[modelCore.Species.Count];
                    foreach (ISpecies species in modelCore.Species)
                    {
                        species_cohorts[species.Index] = totalSpeciesCohorts[prescription.Number, species.Index];
                        species_biomass[species.Index] = totalSpeciesBiomass[prescription.Number, species.Index];
                    }

                    if (totalSites[prescription.Number] > 0 && prescriptionReported[prescription.Number] != true)
                    {
                        summaryLog.Clear();
                        SummaryLog sl = new SummaryLog();
                        sl.Time                        = modelCore.CurrentTime;
                        sl.ManagementArea              = mgmtArea.MapCode;
                        sl.Prescription                = prescription.Name;
                        sl.HarvestedSites              = totalDamagedSites[prescription.Number];
                        sl.TotalBiomassHarvested       = totalBiomassRemoved[prescription.Number];
                        sl.TotalCohortsPartialHarvest  = totalCohortsDamaged[prescription.Number];
                        sl.TotalCohortsCompleteHarvest = totalCohortsKilled[prescription.Number];
                        sl.CohortsHarvested_           = species_cohorts;
                        sl.BiomassHarvestedMg_         = species_biomass;
                        summaryLog.AddObject(sl);
                        summaryLog.WriteToFile();

                        prescriptionReported[prescription.Number] = true;
                    }
                }
            }

            WritePrescriptionMap(modelCore.CurrentTime);
            if (biomassMaps != null)
            {
                biomassMaps.WriteMap(modelCore.CurrentTime);
            }

            running = false;

            SiteBiomass.DisableRecordingForHarvest();
        }
        //---------------------------------------------------------------------

        public override void Run()
        {
            running = true;

            HarvestMgmtLib.SiteVars.Prescription.ActiveSiteValues = null;
            SiteVars.BiomassRemoved.ActiveSiteValues = 0;
            Landis.Library.BiomassHarvest.SiteVars.CohortsPartiallyDamaged.ActiveSiteValues = 0;
            HarvestMgmtLib.SiteVars.CohortsDamaged.ActiveSiteValues = 0;
            SiteVars.BiomassBySpecies.ActiveSiteValues = null;

            SiteBiomass.EnableRecordingForHarvest();

            //harvest each management area in the list
            foreach (ManagementArea mgmtArea in managementAreas)
            {
                totalSites          = new int[Prescription.Count];
                totalDamagedSites   = new int[Prescription.Count];
                totalSpeciesCohorts = new int[Prescription.Count, modelCore.Species.Count];
                totalCohortsDamaged = new int[Prescription.Count];
                totalCohortsKilled  = new int[Prescription.Count];
                // 2015-09-14 LCB Track prescriptions as they are reported in summary log so we don't duplicate
                prescriptionReported = new bool[Prescription.Count];
                totalSpeciesBiomass  = new double[Prescription.Count, modelCore.Species.Count];
                totalBiomassRemoved  = new double[Prescription.Count];

                mgmtArea.HarvestStands();
                //and record each stand that's been harvested in a non-repeat step

                foreach (Stand stand in mgmtArea)
                {
                    //ModelCore.UI.WriteLine("   List of stands {0} ...", stand.MapCode);
                    if (stand.Harvested && !stand.RepeatHarvested)
                    {
                        WriteLogEntry(mgmtArea, stand);
                    }

                    // Do not double up on recording repeat harvested stands. This is now done from the harvest code
                    else if (stand.RepeatHarvested)
                    {
                        stand.SetRepeatHarvested();
                    }
                }

                // Prevent establishment:
                foreach (Stand stand in mgmtArea)
                {
                    if (stand.Harvested && stand.LastPrescription.PreventEstablishment)
                    {
                        List <ActiveSite> sitesToDelete = new List <ActiveSite>();

                        foreach (ActiveSite site in stand)
                        {
                            if (Landis.Library.BiomassHarvest.SiteVars.CohortsPartiallyDamaged[site] > 0 || HarvestMgmtLib.SiteVars.CohortsDamaged[site] > 0)
                            {
                                Landis.Library.Succession.Reproduction.PreventEstablishment(site);
                                sitesToDelete.Add(site);
                            }
                        }

                        foreach (ActiveSite site in sitesToDelete)
                        {
                            stand.DelistActiveSite(site);
                        }
                    }
                }

                foreach (AppliedPrescription aprescription in mgmtArea.Prescriptions)
                {
                    if (modelCore.CurrentTime <= aprescription.EndTime)
                    {
                        WriteSummaryLogEntry(mgmtArea, aprescription);
                    }
                }
            }

            WritePrescriptionMap(modelCore.CurrentTime);
            if (biomassMaps != null)
            {
                biomassMaps.WriteMap(modelCore.CurrentTime);
            }

            running = false;

            SiteBiomass.DisableRecordingForHarvest();
        }