Ejemplo n.º 1
0
        public void SetProgramNameForMultipleRecords_Dss6()
        {
            string orig = TestUtility.BasePath + "simpleQCT6_RTS.dss";
            string fn   = TestUtility.BasePath + "simpleQCT6Copy_RTS.dss";

            File.Delete(fn);
            File.Copy(orig, fn);
            List <DssPath> paths = new List <DssPath>();

            using (DssWriter w = new DssWriter(fn))
            {
                DssGlobals.SetProgramName("DOTNET");
                for (int i = 0; i < 10; i++)
                {
                    var ts = TimeSeriesTest.CreateSampleTimeSeries(new DateTime(2020, 1, 2), "cfs", "INST", size: 10);
                    ts.Path = new DssPath("a" + i.ToString(), "b", "c", "01Jan2020", E: "1Day", F: "f");
                    paths.Add(ts.Path);
                    w.Write(ts);
                }
            }

            using (DssReader r = new DssReader(fn))
            {
                foreach (DssPath path in paths)
                {
                    var ts = r.GetTimeSeries(path);
                    Assert.AreEqual("DOTNET", ts.ProgramName);
                }
            }
        }
Ejemplo n.º 2
0
        private void AddTS(DssWriter w, DateTime t, string path)
        {
            var ts = TimeSeriesTest.CreateSampleTimeSeries(t, "ft", "", 86400, 11);

            ts.Path = new DssPath(path);
            w.Write(ts, true);
        }
        public void SimpleQualityConsistencyTestDss7_RTS_floats()
        {
            string fn = TestUtility.BasePath + "simpleQCT7.dss";

            File.Delete(fn);
            Array  q     = Enum.GetValues(typeof(BaseQualityFlags));
            Random r     = new Random();
            var    qList = new List <int>();

            using (DssWriter w = new DssWriter(fn))
            {
                var ts = TimeSeriesTest.CreateSampleTimeSeries(new DateTime(2020, 1, 1), "cfs", "INST", size: 10);
                ts.Path = new DssPath("a", "b", "c", "", E: "1Day", F: "f");
                for (int i = 0; i < ts.Values.Length; i++)
                {
                    BaseQualityFlags flag       = (BaseQualityFlags)q.GetValue(r.Next(q.Length));
                    Quality          newQuality = new Quality(flag);
                    qList.Add(newQuality.Value);
                }
                ts.Qualities = qList.ToArray();
                w.Write(ts, true);
            }

            using (DssReader reader = new DssReader(fn))
            {
                TimeSeries ts = reader.GetTimeSeries(new DssPath("/a/b/c//1Day/f/"));
                for (int i = 0; i < ts.Values.Length; i++)
                {
                    Assert.AreEqual(ts.Qualities[i], qList[i]);
                }
            }

            using (DssWriter w = new DssWriter(fn))
            {
                var ts = w.GetTimeSeries(new DssPath("/a/b/c//1Day/f/"));
                qList.Clear();
                for (int i = 0; i < ts.Values.Length; i++)
                {
                    BaseQualityFlags flag       = (BaseQualityFlags)q.GetValue(r.Next(q.Length));
                    Quality          newQuality = new Quality(flag);
                    qList.Add(newQuality.Value);
                }
                ts.Qualities = qList.ToArray();
                w.Write(ts, true);
            }

            using (DssReader reader = new DssReader(fn))
            {
                TimeSeries ts = reader.GetTimeSeries(new DssPath("/a/b/c//1Day/f/"));
                for (int i = 0; i < ts.Values.Length; i++)
                {
                    Assert.AreEqual(ts.Qualities[i], qList[i]);
                }
            }
        }
Ejemplo n.º 4
0
        public void WhatIsCostOfStringinSupplemental()
        {
            String fn = "WhatIsCostOfStringinSupplemental.dss";

            File.Delete(fn);
            using (var w = new DssWriter(fn))
            {
                for (int i = 1; i < 1000; i++)
                {
                    var ts = TimeSeriesTest.CreateSampleTimeSeries(DateTime.Now.Date, "cfs", "Per-AVE", size: 1200);
                    ts.Path = new DssPath("/A/" + i.ToString().PadLeft(4, 'B') + "/flow//1Day/ver1/");
                    LocationInformation loc = new LocationInformation();
                    loc.Supplemental       = "WAT_tag:Realization/" + i + ";";
                    ts.LocationInformation = loc;
                    w.StoreLocation(ts.Path.FullPath, loc, true);
                    w.Write(ts);
                }
            }
        }
Ejemplo n.º 5
0
        public void SetProgramName_Dss7()
        {
            string fn = TestUtility.BasePath + "simpleQCT7.dss";

            File.Delete(fn);

            var ts = TimeSeriesTest.CreateSampleTimeSeries(new DateTime(2020, 1, 2), "cfs", "INST", size: 10);

            ts.Path = new DssPath("a", "b", "c", "01Jan2020", E: "1Day", F: "f");
            using (DssWriter w = new DssWriter(fn))
            {
                DssGlobals.SetProgramName("dotnet");
                w.Write(ts);
            }

            using (DssReader r = new DssReader(fn))
            {
                var temp = r.GetTimeSeries(ts.Path);
                Assert.AreEqual("dotnet", temp.ProgramName);
            }
        }
Ejemplo n.º 6
0
        public void SetProgramName_Dss6()
        {
            string orig = TestUtility.BasePath + "simpleQCT6_RTS.dss";
            string fn   = TestUtility.BasePath + "simpleQCT6Copy_RTS.dss";

            File.Delete(fn);
            File.Copy(orig, fn);

            var ts = TimeSeriesTest.CreateSampleTimeSeries(new DateTime(2020, 1, 2), "cfs", "INST", size: 10);

            ts.Path = new DssPath("A", "B", "C", "01JAN2020", E: "1DAY", F: "F");
            using (DssWriter w = new DssWriter(fn))
            {
                DssGlobals.SetProgramName("DOTNET");
                w.Write(ts);
            }

            using (DssReader r = new DssReader(fn))
            {
                var temp = r.GetTimeSeries(ts.Path);
                Assert.AreEqual("DOTNET", temp.ProgramName);
            }
        }