예제 #1
0
        //---------------------------------------------------------------------

        private void WriteMaps(int currentTime)
        {
            string[] paths = { "scrapple-fire", "special-dead-wood-{timestep}.img" };
            //string path = MapNames.ReplaceTemplateVars("scrapple-fire/special-dead-wood-{timestep}.img", currentTime);
            string path = MapNames.ReplaceTemplateVars(Path.Combine(paths), currentTime);

            using (IOutputRaster <IntPixel> outputRaster = modelCore.CreateRaster <IntPixel>(path, modelCore.Landscape.Dimensions))
            {
                IntPixel pixel = outputRaster.BufferPixel;
                foreach (Site site in PlugIn.ModelCore.Landscape.AllSites)
                {
                    if (site.IsActive)
                    {
                        if (SiteVars.Disturbed[site] && SiteVars.Intensity[site] > 0)
                        {
                            pixel.MapCode.Value = (int)(SiteVars.SpecialDeadWood[site]);
                        }
                        else
                        {
                            pixel.MapCode.Value = 0;
                        }
                    }
                    else
                    {
                        //  Inactive site
                        pixel.MapCode.Value = 0;
                    }
                    outputRaster.WriteBufferPixel();
                }
            }
            string[] paths2 = { "scrapple-fire", "ignition-type-{timestep}.img" };
            //path = MapNames.ReplaceTemplateVars("scrapple-fire/ignition-type-{timestep}.img", currentTime);
            path = MapNames.ReplaceTemplateVars(Path.Combine(paths2), currentTime);


            using (IOutputRaster <ShortPixel> outputRaster = modelCore.CreateRaster <ShortPixel>(path, modelCore.Landscape.Dimensions))
            {
                ShortPixel pixel = outputRaster.BufferPixel;
                foreach (Site site in PlugIn.ModelCore.Landscape.AllSites)
                {
                    if (site.IsActive)
                    {
                        if (SiteVars.Disturbed[site] && SiteVars.Intensity[site] > 0)
                        {
                            pixel.MapCode.Value = (short)(SiteVars.TypeOfIginition[site] + 1);
                        }
                        else
                        {
                            pixel.MapCode.Value = 0;
                        }
                    }
                    else
                    {
                        //  Inactive site
                        pixel.MapCode.Value = 0;
                    }
                    outputRaster.WriteBufferPixel();
                }
            }

            string[] paths3 = { "scrapple-fire", "fire-intensity-{timestep}.img" };
            path = MapNames.ReplaceTemplateVars(Path.Combine(paths3), currentTime);
            //path = MapNames.ReplaceTemplateVars("scrapple-fire/fire-intensity-{timestep}.img", currentTime);
            using (IOutputRaster <ShortPixel> outputRaster = modelCore.CreateRaster <ShortPixel>(path, modelCore.Landscape.Dimensions))
            {
                ShortPixel pixel = outputRaster.BufferPixel;
                foreach (Site site in PlugIn.ModelCore.Landscape.AllSites)
                {
                    if (site.IsActive)
                    {
                        if (SiteVars.Disturbed[site] && SiteVars.Intensity[site] > 0)
                        {
                            pixel.MapCode.Value = (short)(SiteVars.Intensity[site]);
                        }
                        else
                        {
                            pixel.MapCode.Value = 0;
                        }
                    }
                    else
                    {
                        //  Inactive site
                        pixel.MapCode.Value = 0;
                    }
                    outputRaster.WriteBufferPixel();
                }
            }

            string[] paths4 = { "scrapple-fire", "fire-spread-probability-{timestep}.img" };
            path = MapNames.ReplaceTemplateVars(Path.Combine(paths4), currentTime);
            //path = MapNames.ReplaceTemplateVars("scrapple-fire/fire-spread-probability-{timestep}.img", currentTime);
            using (IOutputRaster <ShortPixel> outputRaster = modelCore.CreateRaster <ShortPixel>(path, modelCore.Landscape.Dimensions))
            {
                ShortPixel pixel = outputRaster.BufferPixel;
                foreach (Site site in PlugIn.ModelCore.Landscape.AllSites)
                {
                    if (site.IsActive)
                    {
                        if (SiteVars.Disturbed[site] && SiteVars.Intensity[site] > 0)
                        {
                            pixel.MapCode.Value = (short)(SiteVars.SpreadProbability[site] * 100);
                        }
                        else
                        {
                            pixel.MapCode.Value = 0;
                        }
                    }
                    else
                    {
                        //  Inactive site
                        pixel.MapCode.Value = 0;
                    }
                    outputRaster.WriteBufferPixel();
                }
            }

            string[] paths5 = { "scrapple-fire", "day-of-fire-{timestep}.img" };
            path = MapNames.ReplaceTemplateVars(Path.Combine(paths5), currentTime);
            //path = MapNames.ReplaceTemplateVars("scrapple-fire/day-of-fire-{timestep}.img", currentTime);
            using (IOutputRaster <ShortPixel> outputRaster = modelCore.CreateRaster <ShortPixel>(path, modelCore.Landscape.Dimensions))
            {
                ShortPixel pixel = outputRaster.BufferPixel;
                foreach (Site site in PlugIn.ModelCore.Landscape.AllSites)
                {
                    if (site.IsActive)
                    {
                        if (SiteVars.Disturbed[site] && SiteVars.Intensity[site] > 0)
                        {
                            pixel.MapCode.Value = (short)(SiteVars.DayOfFire[site]);
                        }
                        else
                        {
                            pixel.MapCode.Value = 0;
                        }
                    }
                    else
                    {
                        //  Inactive site
                        pixel.MapCode.Value = 0;
                    }
                    outputRaster.WriteBufferPixel();
                }
            }

            string[] paths6 = { "scrapple-fire", "smolder-consumption-{timestep}.img" };
            path = MapNames.ReplaceTemplateVars(Path.Combine(paths6), currentTime);
            //path = MapNames.ReplaceTemplateVars("scrapple-fire/smolder-consumption-{timestep}.img", currentTime);
            using (IOutputRaster <IntPixel> outputRaster = modelCore.CreateRaster <IntPixel>(path, modelCore.Landscape.Dimensions))
            {
                IntPixel pixel = outputRaster.BufferPixel;
                foreach (Site site in PlugIn.ModelCore.Landscape.AllSites)
                {
                    if (site.IsActive)
                    {
                        if (SiteVars.Disturbed[site] && SiteVars.Intensity[site] > 0)
                        {
                            pixel.MapCode.Value = SiteVars.SmolderConsumption[site];
                        }
                        else
                        {
                            pixel.MapCode.Value = 0;
                        }
                    }
                    else
                    {
                        //  Inactive site
                        pixel.MapCode.Value = 0;
                    }
                    outputRaster.WriteBufferPixel();
                }
            }

            string[] paths7 = { "scrapple-fire", "flaming-consumptions-{timestep}.img" };
            path = MapNames.ReplaceTemplateVars(Path.Combine(paths7), currentTime);
            //path = MapNames.ReplaceTemplateVars("scrapple-fire/flaming-consumption-{timestep}.img", currentTime);
            using (IOutputRaster <IntPixel> outputRaster = modelCore.CreateRaster <IntPixel>(path, modelCore.Landscape.Dimensions))
            {
                IntPixel pixel = outputRaster.BufferPixel;
                foreach (Site site in PlugIn.ModelCore.Landscape.AllSites)
                {
                    if (site.IsActive)
                    {
                        if (SiteVars.Disturbed[site] && SiteVars.Intensity[site] > 0)
                        {
                            pixel.MapCode.Value = SiteVars.FlamingConsumption[site];
                        }
                        else
                        {
                            pixel.MapCode.Value = 0;
                        }
                    }
                    else
                    {
                        //  Inactive site
                        pixel.MapCode.Value = 0;
                    }
                    outputRaster.WriteBufferPixel();
                }
            }

            string[] paths8 = { "scrapple-fire", "event-ID-{timestep}.img" };
            path = MapNames.ReplaceTemplateVars(Path.Combine(paths8), currentTime);
            //path = MapNames.ReplaceTemplateVars("scrapple-fire/event-ID-{timestep}.img", currentTime);
            using (IOutputRaster <IntPixel> outputRaster = modelCore.CreateRaster <IntPixel>(path, modelCore.Landscape.Dimensions))
            {
                IntPixel pixel = outputRaster.BufferPixel;
                foreach (Site site in PlugIn.ModelCore.Landscape.AllSites)
                {
                    if (site.IsActive)
                    {
                        if (SiteVars.Disturbed[site] && SiteVars.Intensity[site] > 0)
                        {
                            pixel.MapCode.Value = SiteVars.EventID[site];
                        }
                        else
                        {
                            pixel.MapCode.Value = 0;
                        }
                    }
                    else
                    {
                        //  Inactive site
                        pixel.MapCode.Value = 0;
                    }
                    outputRaster.WriteBufferPixel();
                }
            }
        }
예제 #2
0
        //---------------------------------------------------------------------

        private void WriteMaps(int currentTime)
        {
            string path = MapNames.ReplaceTemplateVars("scrapple-fire/special-dead-wood-{timestep}.img", currentTime);

            using (IOutputRaster <IntPixel> outputRaster = modelCore.CreateRaster <IntPixel>(path, modelCore.Landscape.Dimensions))
            {
                IntPixel pixel = outputRaster.BufferPixel;
                foreach (Site site in PlugIn.ModelCore.Landscape.AllSites)
                {
                    if (site.IsActive)
                    {
                        if (SiteVars.Disturbed[site])
                        {
                            pixel.MapCode.Value = (int)(SiteVars.SpecialDeadWood[site]);
                        }
                        else
                        {
                            pixel.MapCode.Value = 0;
                        }
                    }
                    else
                    {
                        //  Inactive site
                        pixel.MapCode.Value = 0;
                    }
                    outputRaster.WriteBufferPixel();
                }
            }
            path = MapNames.ReplaceTemplateVars("scrapple-fire/ignition-type-{timestep}.img", currentTime);

            using (IOutputRaster <ShortPixel> outputRaster = modelCore.CreateRaster <ShortPixel>(path, modelCore.Landscape.Dimensions))
            {
                ShortPixel pixel = outputRaster.BufferPixel;
                foreach (Site site in PlugIn.ModelCore.Landscape.AllSites)
                {
                    if (site.IsActive)
                    {
                        if (SiteVars.Disturbed[site])
                        {
                            pixel.MapCode.Value = (short)(SiteVars.TypeOfIginition[site] + 1);
                        }
                        else
                        {
                            pixel.MapCode.Value = 0;
                        }
                    }
                    else
                    {
                        //  Inactive site
                        pixel.MapCode.Value = 0;
                    }
                    outputRaster.WriteBufferPixel();
                }
            }

            path = MapNames.ReplaceTemplateVars("scrapple-fire/fire-intensity-{timestep}.img", currentTime);
            using (IOutputRaster <ShortPixel> outputRaster = modelCore.CreateRaster <ShortPixel>(path, modelCore.Landscape.Dimensions))
            {
                ShortPixel pixel = outputRaster.BufferPixel;
                foreach (Site site in PlugIn.ModelCore.Landscape.AllSites)
                {
                    if (site.IsActive)
                    {
                        if (SiteVars.Disturbed[site])
                        {
                            pixel.MapCode.Value = (short)(SiteVars.Intensity[site]);
                        }
                        else
                        {
                            pixel.MapCode.Value = 0;
                        }
                    }
                    else
                    {
                        //  Inactive site
                        pixel.MapCode.Value = 0;
                    }
                    outputRaster.WriteBufferPixel();
                }
            }

            path = MapNames.ReplaceTemplateVars("scrapple-fire/fire-spread-probability-{timestep}.img", currentTime);
            using (IOutputRaster <ShortPixel> outputRaster = modelCore.CreateRaster <ShortPixel>(path, modelCore.Landscape.Dimensions))
            {
                ShortPixel pixel = outputRaster.BufferPixel;
                foreach (Site site in PlugIn.ModelCore.Landscape.AllSites)
                {
                    if (site.IsActive)
                    {
                        if (SiteVars.Disturbed[site])
                        {
                            pixel.MapCode.Value = (short)(SiteVars.SpreadProbability[site] * 100);
                        }
                        else
                        {
                            pixel.MapCode.Value = 0;
                        }
                    }
                    else
                    {
                        //  Inactive site
                        pixel.MapCode.Value = 0;
                    }
                    outputRaster.WriteBufferPixel();
                }
            }

            path = MapNames.ReplaceTemplateVars("scrapple-fire/day-of-fire-{timestep}.img", currentTime);
            using (IOutputRaster <ShortPixel> outputRaster = modelCore.CreateRaster <ShortPixel>(path, modelCore.Landscape.Dimensions))
            {
                ShortPixel pixel = outputRaster.BufferPixel;
                foreach (Site site in PlugIn.ModelCore.Landscape.AllSites)
                {
                    if (site.IsActive)
                    {
                        if (SiteVars.Disturbed[site])
                        {
                            pixel.MapCode.Value = (short)(SiteVars.DayOfFire[site]);
                        }
                        else
                        {
                            pixel.MapCode.Value = 0;
                        }
                    }
                    else
                    {
                        //  Inactive site
                        pixel.MapCode.Value = 0;
                    }
                    outputRaster.WriteBufferPixel();
                }
            }

            path = MapNames.ReplaceTemplateVars("scrapple-fire/smolder-consumption-{timestep}.img", currentTime);
            using (IOutputRaster <IntPixel> outputRaster = modelCore.CreateRaster <IntPixel>(path, modelCore.Landscape.Dimensions))
            {
                IntPixel pixel = outputRaster.BufferPixel;
                foreach (Site site in PlugIn.ModelCore.Landscape.AllSites)
                {
                    if (site.IsActive)
                    {
                        if (SiteVars.Disturbed[site])
                        {
                            pixel.MapCode.Value = SiteVars.SmolderConsumption[site];
                        }
                        else
                        {
                            pixel.MapCode.Value = 0;
                        }
                    }
                    else
                    {
                        //  Inactive site
                        pixel.MapCode.Value = 0;
                    }
                    outputRaster.WriteBufferPixel();
                }
            }

            path = MapNames.ReplaceTemplateVars("scrapple-fire/flaming-consumption-{timestep}.img", currentTime);
            using (IOutputRaster <IntPixel> outputRaster = modelCore.CreateRaster <IntPixel>(path, modelCore.Landscape.Dimensions))
            {
                IntPixel pixel = outputRaster.BufferPixel;
                foreach (Site site in PlugIn.ModelCore.Landscape.AllSites)
                {
                    if (site.IsActive)
                    {
                        if (SiteVars.Disturbed[site])
                        {
                            pixel.MapCode.Value = SiteVars.FlamingConsumption[site];
                        }
                        else
                        {
                            pixel.MapCode.Value = 0;
                        }
                    }
                    else
                    {
                        //  Inactive site
                        pixel.MapCode.Value = 0;
                    }
                    outputRaster.WriteBufferPixel();
                }
            }
        }