private SampleDataPoint ParseDataPoint(string str)
        {
            var pieces = str.Split(',');

            SampleDataPoint res = new SampleDataPoint();

            res.Lat = double.Parse(pieces[0], CultureInfo.InvariantCulture);
            res.Lon = double.Parse(pieces[1], CultureInfo.InvariantCulture);

            res.Temp      = double.Parse(pieces[2], CultureInfo.InvariantCulture);
            res.RainFall  = double.Parse(pieces[3], CultureInfo.InvariantCulture);
            res.SoilDepth = double.Parse(pieces[4], CultureInfo.InvariantCulture);

            return(res);
        }
        private void LoadData()
        {
            string[] strings = File.ReadAllLines("example_for_visualization.csv");

            // skipping 1st line, parsing all other lines
            for (int i = 1; i < strings.Length; i++)
            {
                SampleDataPoint point = ParseDataPoint(strings[i]);
                loadedData.Add(point);
            }

            tempRange.Min = loadedData.Min(p => p.Temp);
            tempRange.Max = loadedData.Max(p => p.Temp);

            rainfallRange.Min = loadedData.Min(p => p.RainFall);
            rainfallRange.Max = loadedData.Max(p => p.RainFall);

            soildepthRange.Min = loadedData.Min(p => p.SoilDepth);
            soildepthRange.Max = loadedData.Max(p => p.SoilDepth);
        }
Exemplo n.º 3
0
		private SampleDataPoint ParseDataPoint(string str)
		{
			var pieces = str.Split(',');

			SampleDataPoint res = new SampleDataPoint();

			res.Lat = Double.Parse(pieces[0], CultureInfo.InvariantCulture);
			res.Lon = Double.Parse(pieces[1], CultureInfo.InvariantCulture);

			res.Temp = Double.Parse(pieces[2], CultureInfo.InvariantCulture);
			res.RainFall = Double.Parse(pieces[3], CultureInfo.InvariantCulture);
			res.SoilDepth = Double.Parse(pieces[4], CultureInfo.InvariantCulture);

			return res;
		}