public void ClimatologyYearlyTimeseriesTest() { Random r = new Random(46); using (DataSet ds = DataSet.Open("msds:memory")) { Assert.AreEqual(0, ds.Variables.Count); ds.AddClimatologyAxisYearly(); Assert.AreEqual(2, ds.Variables.Count); var clim = ds.Variables.Where(v => v.Rank == 2).First(); DateTime dt0 = ((DateTime[, ])clim.GetData(new int[] { 0, 0 }, new int[] { 1, 1 }))[0, 0]; DateTime dt1 = ((DateTime[, ])clim.GetData(new int[] { 0, 1 }, new int[] { 1, 1 }))[0, 0]; DateTime dt2 = ((DateTime[, ])clim.GetData(new int[] { 1, 0 }, new int[] { 1, 1 }))[0, 0]; DateTime dt3 = ((DateTime[, ])clim.GetData(new int[] { 1, 1 }, new int[] { 1, 1 }))[0, 0]; Assert.AreNotEqual(dt0.Year, dt2.Year); Assert.AreEqual(dt0.Hour, dt2.Hour); Assert.AreEqual(dt0.DayOfYear, dt2.DayOfYear); Assert.AreNotEqual(dt1.Year, dt3.Year); Assert.AreEqual(dt1.Hour, dt3.Hour); Assert.AreEqual(dt1.DayOfYear, dt3.DayOfYear); } using (DataSet ds = DataSet.Open("msds:memory")) { Assert.AreEqual(0, ds.Variables.Count); ds.AddClimatologyAxisYearly(1940, 1954, 3, 230, 3, 5, 2, "tim123", "climatAx"); Assert.AreEqual(2, ds.Variables.Count); var clim = ds.Variables["climatAx"]; Assert.AreEqual("climatAx", ds.Variables["tim123"].Metadata["climatology"]); DateTime dt0 = ((DateTime[, ])clim.GetData(new int[] { 0, 0 }, new int[] { 1, 1 }))[0, 0]; DateTime dt1 = ((DateTime[, ])clim.GetData(new int[] { 0, 1 }, new int[] { 1, 1 }))[0, 0]; DateTime dt2 = ((DateTime[, ])clim.GetData(new int[] { 1, 0 }, new int[] { 1, 1 }))[0, 0]; DateTime dt3 = ((DateTime[, ])clim.GetData(new int[] { 1, 1 }, new int[] { 1, 1 }))[0, 0]; Assert.AreNotEqual(dt0.Year, dt2.Year); Assert.AreEqual(dt0.Hour, dt2.Hour); Assert.AreEqual(3, dt0.Hour); Assert.AreEqual(dt0.DayOfYear, dt2.DayOfYear); Assert.AreEqual(3, dt0.DayOfYear); Assert.AreNotEqual(dt1.Year, dt3.Year); Assert.AreEqual(dt1.Hour, dt3.Hour); Assert.AreEqual(5, dt1.Hour); Assert.AreEqual(dt1.DayOfYear, dt3.DayOfYear); Assert.AreEqual(230, dt1.DayOfYear); } }