public FishTraits() { StreamReader r = new StreamReader("input\\data\\Fisheries\\taxonlist.csv"); Allometries = new LWAllometries(); string[] RequiredFields = { "slmax", "tl", "setl", "reef", "pelagic", "demersal", "deepsea", "sea grass", "mangrove" }; string l; char[] comma = ",".ToCharArray(); string[] f; //Get the column names if (!r.EndOfStream) { l = r.ReadLine(); // Split fields by commas header = l.ToLower().Split(comma); header = header.Skip(1).ToArray(); } else { header = new string[RequiredFields.Length]; } TraitData = new SortedDictionary<string, string[]>(); //Read the taxon trait data file while (!r.EndOfStream) { l = r.ReadLine(); // Split fields by commas f = l.Split(comma); //Add this taxon's trait data to the sorted dictionary TraitData.Add(f[0], f.Skip(1).ToArray()); } //Convert max body lengths to max body masses ConvertLengthToMass(); //Convert max TL to a discrete TL ConvertTLToDiscrete(); //Create a boolean dictionary for deep sea or not AssignDeepSea(); }
public FishTraits() { StreamReader r = new StreamReader("input\\data\\Fisheries\\taxonlist.csv"); Allometries = new LWAllometries(); string[] RequiredFields = { "slmax", "tl", "setl", "reef", "pelagic", "demersal", "deepsea", "sea grass", "mangrove" }; string l; char[] comma = ",".ToCharArray(); string[] f; //Get the column names if (!r.EndOfStream) { l = r.ReadLine(); // Split fields by commas header = l.ToLower().Split(comma); header = header.Skip(1).ToArray(); } else { header = new string[RequiredFields.Length]; } TraitData = new SortedDictionary <string, string[]>(); //Read the taxon trait data file while (!r.EndOfStream) { l = r.ReadLine(); // Split fields by commas f = l.Split(comma); //Add this taxon's trait data to the sorted dictionary TraitData.Add(f[0], f.Skip(1).ToArray()); } //Convert max body lengths to max body masses ConvertLengthToMass(); //Convert max TL to a discrete TL ConvertTLToDiscrete(); //Create a boolean dictionary for deep sea or not AssignDeepSea(); }