CntrlComparison parsing

This commit is contained in:
2015-12-04 10:15:51 -05:00
parent 4d46f206ac
commit 685e8c8658
39 changed files with 820 additions and 491 deletions
+7 -41
View File
@@ -1,49 +1,15 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.ComponentModel.DataAnnotations;
namespace LeafWeb.Core.Models
{
[Serializable]
/// <summary>
/// The file 'cntrlcomparison.csv', which is in comma-separated-value format, contains outputs from PISCAL that
/// facilitates examination of how well the fitting is.
/// </summary>
public class CntrlComparison
{
// Each element will be a PiscalCurve element that contains
// all of the output data for one curve.
private readonly List<CurveData> _curveData;
public CntrlComparison()
{
_curveData = new List<CurveData>();
}
public bool ReadFromStream(StreamReader sr, ref String errorMsg)
{
// Skip the first two lines.
sr.ReadLine();
sr.ReadLine();
var lineNbr = 2;
// Now, there should be one or more rows, delimited by a row that has
// CO2i in the first field. Read in all of these rows. The first field
// in each row is the curve ID (input filename).
var more = true;
while (more)
{
var curve = new CurveData(sr, ref errorMsg, ref lineNbr);
if (errorMsg.Length > 0)
return false;
_curveData.Add(curve);
if (sr.EndOfStream)
more = false;
}
return true;
}
public List<CurveData> GetCurveData()
{
return _curveData;
}
public virtual IEnumerable<CntrlComparisonFittingInfo> FittingInfo { get; set; }
public virtual IEnumerable<CntrlComparisonPhotosyntheticInfo> PhotosyntheticInfo { get; set; }
}
}