public void MissingTimeBug() { string filename = TestData.DataPath + "\\Basin.xls"; SpreadsheetGearSeries s = new SpreadsheetGearSeries(filename, "Basin", "Date/Time", "Temperature (*C)"); s.Read(); Assert.AreEqual(6722, s.Count, "series count"); Console.WriteLine(s.Count); }
public void BasicRead() { string filename = TestData.DataPath + "\\MILIrunning.xls"; SpreadsheetGearSeries s = GetSimpleSeries(filename); s.Read(); Assert.AreEqual(2.61, s["02/03/05 04:47:14.0"].Value, 0.01); Console.WriteLine(s.Count); }
public void MonthlyIntervalDetection() { string filename = TestData.DataPath + "\\unregulation calculations.xls"; SpreadsheetGearExcel db = new SpreadsheetGearExcel(filename); SpreadsheetGearSeries s = new SpreadsheetGearSeries(filename, "Riverware returns", "A", "B"); s.Read(); Assert.AreEqual(TimeInterval.Monthly, s.TimeInterval); }
public void DatabaseFormat() { string filename = Path.Combine(TestData.DataPath, "DatabaseStyleExcelIdwr.xlsx"); Assert.IsTrue(System.IO.File.Exists(filename), "missing file " + filename); SpreadsheetGearSeries xls = new SpreadsheetGearSeries(filename, "Data", "DataDate", "Flow", false, "SiteID", "13202995"); xls.Read(); Assert.AreEqual(5696, xls.Count); Assert.AreEqual(0, xls[0].Value, 0.001); Assert.AreEqual(10, xls["1986-6-1"].Value, 0.001); }
public void UsingColumnReferenceName() { string filename = TestData.DataPath + @"\QCBID BIOP Data_kt.xls"; Assert.IsTrue(System.IO.File.Exists(filename), "missing file " + filename); SpreadsheetGearSeries s = new SpreadsheetGearSeries(filename, "CC at 5-mile", "C", "J"); s.Read(); for (int i = 0; i < s.Messages.Count; i++) { Console.WriteLine(s.Messages[i]); } Assert.AreEqual(126.3, s[11].Value, .01); }
public void USACEDateFormat() { string filename = Path.Combine(TestData.DataPath, "CumbR_BarbourvilleKY.xlsx"); Assert.IsTrue(System.IO.File.Exists(filename), "missing file " + filename); SpreadsheetGearSeries xls = new SpreadsheetGearSeries(filename, "Sheet1", "Date", "CumbR_BarbourvilleKY", false); xls.Read(); Assert.AreEqual(4416, xls.Count); Assert.AreEqual(771, xls[0].Value, 0.001); Assert.AreEqual(2050, xls[4415].Value, 0.001); }
public void LargeRead() { string filename = TestData.DataPath + @"\UnregulationUpperSnake.xls"; Assert.IsTrue(System.IO.File.Exists(filename), "missing file " + filename); SpreadsheetGearSeries s = new SpreadsheetGearSeries(filename, "data", "Date", "HEII QD"); s.Read(); //s.WriteToConsole(); for (int i = 0; i < s.Messages.Count; i++) { Console.WriteLine(s.Messages[i]); } Assert.AreEqual(28942, s.Count, "wrong number of points from " + filename); }
public void ConvertToCelcius() { var fn = TestData.DataPath + "\\CalculationTests.xlsx"; Series s = new SpreadsheetGearSeries(fn, "ConvertToCelcius", "Date", "value", false); s.Units = "degrees C"; s.Expression = "5/9*(this-32)"; s.Read(); s.WriteToConsole(); s.Clear(); s.Calculate(); //t,t.AddDays(3)); s.WriteToConsole(); Assert.AreEqual(0, s[0].Value, 0.01); Assert.AreEqual(100, s[1].Value, 0.01); }
public void DailyAverageBug() { string filename = TestData.DataPath + "\\Deadwood at SF.xls"; SpreadsheetGearSeries s = GetSimpleSeries(filename); s.Read(); //Assert.AreEqual(31740, s.Count); Assert.AreEqual(33812, s.Count); Point pt = Reclamation.TimeSeries.Math.TimeWeightedAverageForDay(s, DateTime.Parse("10/3/2006")); Console.WriteLine(pt); Assert.IsTrue(pt.IsMissing); pt = Reclamation.TimeSeries.Math.TimeWeightedAverageForDay(s, DateTime.Parse("10/4/2006")); Assert.IsTrue(pt.IsMissing); }
public void WaterYearFormat() { string filename = TestData.DataPath + "\\wateryear.xls"; Assert.IsTrue(System.IO.File.Exists(filename), "missing file " + filename); SpreadsheetGearSeries xls = new SpreadsheetGearSeries(filename, "Sheet1", "WaterYear", "Oct", true); xls.Read(); Assert.AreEqual(12, xls[0].Value, 0.001); Assert.AreEqual(DateTime.Parse("1889-10-1"), xls[0].DateTime); Assert.AreEqual(1100, xls[DateTime.Parse("1934-6-1")].Value); xls.WriteCsv(@"c:\temp\a.csv"); }