Пример #1
0
        public OutputTableEcoregions(string MapNameTemplate)
        {
            FileName = FileNames.ReplaceTemplateVars(MapNameTemplate).Replace(".img", "eco.txt").Replace(".gis", "eco.txt");
            FileNames.MakeFolders(FileName);

            string hdr = "Time\t";

            foreach (IEcoregion e in PlugIn.ModelCore.Ecoregions)
            {
                hdr += e.Name + "\t";
            }

            FileContent.Add(hdr);
        }
        public OutputTableEcoregions(string MapNameTemplate)
        {
            FileName = FileNames.ReplaceTemplateVars(MapNameTemplate).Replace(".img", "-eco.csv").Replace(".gis", "-eco.csv").Replace("{timestep}", "AllYears");
            FileNames.MakeFolders(FileName);

            string hdr = "Time";

            foreach (IEcoregion e in PlugIn.ModelCore.Ecoregions)
            {
                hdr += ", " + e.Name;
            }

            FileContent.Add(hdr);
        }
Пример #3
0
        public static void Write <T>(string MapNameTemplate, string units, int TStep, ISiteVar <Landis.Library.Parameters.Species.AuxParm <T> > Values)
        {
            string FileName = FileNames.ReplaceTemplateVars(MapNameTemplate).Replace(".img", ".txt");

            if (PlugIn.ModelCore.CurrentTime == 0)
            {
                FileNames.MakeFolders(FileName);
                System.IO.File.WriteAllLines(FileName, new string[] { Header(units) });
            }

            AuxParm <ulong> Values_spc = new AuxParm <ulong>(PlugIn.ModelCore.Species);
            AuxParm <ulong> Values_cnt = new AuxParm <ulong>(PlugIn.ModelCore.Species);

            foreach (ActiveSite site in PlugIn.ModelCore.Landscape)
            {
                foreach (ISpecies spc in PlugIn.ModelCore.Species)
                {
                    if (typeof(T) == typeof(bool))
                    {
                        if (Values[site][spc].ToString() == bool.TrueString)
                        {
                            Values_spc[spc]++;
                        }
                    }
                    else
                    {
                        ulong numeric = ulong.Parse(Values[site][spc].ToString());
                        Values_spc[spc] += numeric;
                    }

                    Values_cnt[spc]++;
                }
            }

            string line = TStep + "\t";

            foreach (ISpecies spc in PlugIn.ModelCore.Species)
            {
                line += Values_spc[spc] / (float)Values_cnt[spc] + "\t";
            }

            System.IO.StreamWriter sw = new System.IO.StreamWriter(FileName, true);
            sw.WriteLine(line);
            sw.Close();
        }
        public static void WriteUpdate(string MapNameTemplate, int year, AuxParm <int> values)
        {
            string FileName = FileNames.ReplaceTemplateVars(MapNameTemplate).Replace(".img", ".csv").Replace(".gis", ".csv");

            if (year == 0)
            {
                FileNames.MakeFolders(FileName);
                System.IO.File.WriteAllLines(FileName, new string[] { Header });
            }

            string line = year.ToString();

            foreach (ISpecies species in PlugIn.SelectedSpecies)
            {
                line += ", " + values[species];
            }
            System.IO.StreamWriter sw = new System.IO.StreamWriter(FileName, true);
            sw.WriteLine(line);
            sw.Close();
        }
Пример #5
0
        public static void Write <T>(string MapNameTemplate, string units, int TStep, Landis.Library.Parameters.Species.AuxParm <T> Values)
        {
            string FileName = FileNames.ReplaceTemplateVars(MapNameTemplate).Replace(".img", ".txt");

            if (PlugIn.ModelCore.CurrentTime == 0)
            {
                FileNames.MakeFolders(FileName);
                System.IO.File.WriteAllLines(FileName, new string[] { Header(units) });
            }

            string line = TStep + "\t";

            foreach (ISpecies spc in PlugIn.ModelCore.Species)
            {
                line += Values[spc] + "\t";
            }

            System.IO.StreamWriter sw = new System.IO.StreamWriter(FileName, true);
            sw.WriteLine(line);
            sw.Close();
        }