public void HydrometAutoUpdate() { var t1 = new DateTime(1980, 10, 1); var t2 = new DateTime(1980, 10, 2); Series s1 = new Reclamation.TimeSeries.Hydromet.HydrometDailySeries("jck", "af"); s1.Read(t1, t2); int sdi1 = db.AddSeries(s1); Series s2 = new Reclamation.TimeSeries.Hydromet.HydrometDailySeries("pal", "af"); s2.Read(t1, t2); int sdi2 = db.AddSeries(s2); s1 = db.GetSeries(sdi1); s2 = db.GetSeries(sdi2); HydrometInfoUtility.AutoUpdate = true; t2 = t2.AddHours(24);// reservoir contents are stored at midnight Console.WriteLine(t2); s1.Read(t1, t2); s2.Read(t1, t2); s1.WriteToConsole(); Assert.AreEqual(515150.0, s1[0].Value); Assert.AreEqual(817782.0, s2[0].Value); Assert.AreEqual(3, s1.Count); Assert.AreEqual(3, s2.Count); SeriesList sl = new SeriesList(); sl.Add(s1); sl.Add(s2); SimpleMathSeries c1 = new SimpleMathSeries("", sl, new MathOperation[] { MathOperation.Add }); SimpleMathSeries c2 = new SimpleMathSeries("", sl, new MathOperation[] { MathOperation.Subtract }); int sdi3 = db.AddSeries(c1); int sdi4 = db.AddSeries(c2); Series s3 = db.GetSeries(sdi3); Series s4 = db.GetSeries(sdi4); s3.Read(t1, t2); s4.Read(t1, t2); Assert.AreEqual(515150.0 + 817782.0, s3[0].Value); Assert.AreEqual(515150.0 - 817782.0, s4[0].Value); }
public void HydrometAutoUpdate() { var t1 = new DateTime(1980, 10, 1); var t2 = new DateTime(1980, 10, 2); Series s1 = new Reclamation.TimeSeries.Hydromet.HydrometDailySeries("jck", "af"); s1.Read(t1, t2); int sdi1 = db.AddSeries(s1); Series s2 = new Reclamation.TimeSeries.Hydromet.HydrometDailySeries("pal", "af"); s2.Read(t1, t2); int sdi2 = db.AddSeries(s2); s1 = db.GetSeries(sdi1); s2 = db.GetSeries(sdi2); HydrometInfoUtility.AutoUpdate = true; t2 = t2.AddHours(24);// reservoir contents are stored at midnight Console.WriteLine(t2); s1.Read(t1, t2); s2.Read(t1, t2); s1.WriteToConsole(); Assert.AreEqual(515150.0, s1[0].Value); Assert.AreEqual(817782.0, s2[0].Value); Assert.AreEqual(3, s1.Count); Assert.AreEqual(3, s2.Count); SeriesList sl = new SeriesList(); sl.Add(s1); sl.Add(s2); SimpleMathSeries c1 = new SimpleMathSeries("",sl,new MathOperation[]{ MathOperation.Add}); SimpleMathSeries c2 = new SimpleMathSeries("",sl, new MathOperation[] {MathOperation.Subtract}); int sdi3 = db.AddSeries(c1); int sdi4 = db.AddSeries(c2); Series s3 = db.GetSeries(sdi3); Series s4 = db.GetSeries(sdi4); s3.Read(t1, t2); s4.Read(t1, t2); Assert.AreEqual(515150.0 + 817782.0, s3[0].Value); Assert.AreEqual(515150.0 - 817782.0, s4[0].Value); }