public void V7ReadV6SHG()
        {
            string path = "/SHG/TRUCKEE RIVER/TEMP-AIR/31JAN2016:2400//INTERPOLATED-ROUNDED/";
            string fn   = TestUtility.BasePath + "version7AlbersGrid.dss";

            Console.WriteLine(Directory.GetCurrentDirectory());

            if (!File.Exists(fn))
            {
                Console.WriteLine("File does not exist " + fn);
            }
            DssReader r = new DssReader(fn);

            var  t1 = DateTime.Now;
            Grid g2 = r.GetGrid(path, true);

            for (int i = 0; i < g2.Data.Length; i++)
            {
                var f = g2.Data[i];
            }

            var      t2 = DateTime.Now;
            TimeSpan ts = t2.Subtract(t1);

            Console.WriteLine("grid read time " + ts.TotalSeconds);
            Assert.IsNotNull(g2);

            string s = g2.Info();
        }
Esempio n. 2
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);
                }
            }
        }
        public void ReadAllGrids()
        {
            string fn            = TestUtility.BasePath + "precip.2018.09.dss";
            string pathname      = "/SHG/MARFC/PRECIP///NEXRAD/";
            var    targetDSSPath = new DssPath(pathname);

            double sum = 0;

            using (var dssr = new DssReader(fn, DssReader.MethodID.MESS_METHOD_GENERAL_ID, DssReader.LevelID.MESS_LEVEL_CRITICAL))
            {
                var cat   = dssr.GetCatalog(false);
                var paths = cat.Paths.Select(dssPath => dssPath.FullPath).ToArray();

                var filterPaths = PathAssist.FilterByPart(paths, targetDSSPath);

                for (int i = 0; i < filterPaths.Count; i++)
                {
                    string subpath = filterPaths[i];
                    var    dssPath = new DssPath(subpath);

                    var grd = dssr.GetGrid(dssPath, true);
                    sum += grd.MaxDataValue;
                }

                Console.WriteLine(sum.ToString());
            }
        }
        public void FilterTest()
        {
            string fn       = Path.GetFullPath(TestUtility.BasePath + "NDFD_Wind.dss");
            string pathname = "/SHG/CONUS/WIND DIRECTION///NDFD (YUBZ98) (001-003)/";

            /* Catalog.Paths:
             *  [0]: "/SHG/CONUS/WIND DIRECTION/08SEP2018:2400-11SEP2018:2400//NDFD (YUBZ98) (001-003)/"
             *  [1]: "/SHG/CONUS/WIND SPEED/08SEP2018:2400-11SEP2018:2400//NDFD (YWUZ98) (001-003)/"
             */

            using (var dssr = new DssReader(fn))
            {
                var targetDSSPath = new DssPath(pathname);

                // Should cache catalogue in local var?
                var cat = dssr.GetCatalog(false);

                // var paths = cat.Paths.Select(dssPath => dssPath.FullPath).ToArray();
                // var filterPaths = PathAssist.FilterByPart(paths, targetDSSPath);

                // No 'FilterByPart' overload that takes DSSPath objects (not strings) and accepts a dss path to filter on
                // D and E part are empty, but filtering is failing. Is there a wildcard?
                var filterPaths = PathAssist.FilterByPart(cat.Paths, targetDSSPath.Apart, targetDSSPath.Bpart, targetDSSPath.Cpart, targetDSSPath.Dpart, targetDSSPath.Epart, targetDSSPath.Fpart);
                if (filterPaths.Count == 0)
                {
                    Console.WriteLine("No filtered paths found.");
                    return;
                }
            }
        }
        private static void Run(Options opts)
        {
            VerifyExportArgs(opts);

            using (DssReader r = new DssReader(opts.DssFile))
            {
                object      record;
                ExcelWriter ew = new ExcelWriter(opts.ExcelFile);

                for (int i = 0; i < opts.Paths.ToList <string>().Count; i++)
                {
                    string sheet;
                    while (true)
                    {
                        sheet = "dssvue_import_" + ExcelTools.RandomString(5);
                        if (!ew.SheetExists(sheet))
                        {
                            break;
                        }
                    }
                    DssPath p    = new DssPath(opts.Paths.ElementAt(i));
                    var     type = r.GetRecordType(p);
                    if (type is RecordType.RegularTimeSeries || type is RecordType.IrregularTimeSeries)
                    {
                        record = r.GetTimeSeries(p);
                        ew.Write(record as TimeSeries, sheet);
                    }
                    else if (type is RecordType.PairedData)
                    {
                        record = r.GetPairedData(p.FullPath);
                        ew.Write(record as PairedData, sheet);
                    }
                }
            }
        }
Esempio n. 6
0
        public void WriteThenReadVerticalDatum()
        {
            VerticalDatumInfo vdi = CreateVDI();

            var locationInfo = new LocationInformation();
            LocationInformation loc;

            locationInfo.XOrdinate         = 765.432;
            locationInfo.VerticalDatumInfo = vdi;
            string path    = "a/b/Location Info";
            var    dssFile = "WriteThenReadVerticalDatum.dss";

            File.Delete(dssFile);
            using (var w = new DssWriter(dssFile))
            {
                w.StoreLocation(path, locationInfo);
            }

            using (var r = new DssReader(dssFile))
            {
                loc = r.GetLocationInfo(path);
                DoAssertions(CreateVDI(), loc.VerticalDatumInfo);
                Assert.AreEqual(locationInfo.XOrdinate, loc.XOrdinate);
            }

            Console.WriteLine(loc.VerticalDatumInfo.ToXml(true));
        }
        public void ReadConnecticutGrids()
        {
            // This path doesn't have a  E part.....
            DssPath path = new DssPath("/SHG/CONNECTICUT/AIRTEMP/07MAY2019:1400//GAGEINTERP/");
            string  fn   = TestUtility.BasePath + "ConnecticutGrids.dss";

            DssReader r = new DssReader(fn);

            var catalog = r.GetCatalog();

            for (int i = 0; i < catalog.Count; i++)
            {
                var p = catalog[i].FullPath;
                if (p.IndexOf("GAGEINTERP") > 0)
                {
                    Console.WriteLine(p);
                }
            }

            Assert.IsTrue(r.ExactPathExists(path));

            Grid g1 = r.GetGrid(path, false);
            Grid g2 = r.GetGrid(path, true);

            Assert.IsNotNull(g1);
            Assert.IsNotNull(g2);

            string expected = Hec.Dss.Native.DSS.AlbersSRS();

            Console.WriteLine("expected:\n" + expected);
            Console.WriteLine(g2.SRSDefinition);
            Assert.IsTrue(expected.ToLower() == g2.SRSDefinition.ToLower());
            // Assert.IsTrue(g1.SRSDefinitionType == 1);
        }
 public void ReadPairedData3()
 {
     using (DssReader r = new DssReader(TestUtility.BasePath + "indexedPairedData1.dss"))
     {
         var p = r.GetPairedData("/excel/import/plugin//e/pairedData3CR/");
     }
 }
Esempio n. 9
0
        public void CheckIfDPartComingOutAsDateTimeWithRange()
        {
            string dssFile = @".\tempdssfile.dss";
            string srcFile = TestUtility.BasePath + "version7AlbersGridsTimeSeries.dss";

            File.Delete(dssFile);
            CopyAsReadWrite(srcFile, dssFile);
            string path = @"//BERLIN/FLOW/01May2016-01Jun2016/1Hour/Q0W0/";

            using (DssReader dss = new DssReader(dssFile))
            {
                DssPathCollection paths = dss.GetCatalog();
                var dsspath             = paths.FindExactPath(path);
                if (dsspath != DssPath.NotFound)
                {
                    var dpartdt = (dsspath as DssPathCondensed).GetDPartAsDateTimeRange();
                    Assert.IsTrue(dpartdt.Item1.Month == 5);
                    Assert.IsTrue(dpartdt.Item1.Day == 1);
                    Assert.IsTrue(dpartdt.Item1.Year == 2016);
                    Assert.IsTrue(dpartdt.Item2.Month == 6);
                    Assert.IsTrue(dpartdt.Item2.Day == 1);
                    Assert.IsTrue(dpartdt.Item2.Year == 2016);
                }
                else
                {
                    Assert.Fail();
                }
            }
        }
Esempio n. 10
0
        public void CheckIfDPartComingOutAsDateTimeNoRange()
        {
            string dssFile = @".\tempdssfile.dss";
            string srcFile = TestUtility.BasePath + "version7AlbersGrid.dss";

            File.Delete(dssFile);
            CopyAsReadWrite(srcFile, dssFile);
            string path = @"/SHG/TRUCKEE RIVER/TEMP-AIR/31JAN2016:2400//INTERPOLATED-ROUNDED/";

            using (DssReader dss = new DssReader(dssFile))
            {
                DssPathCollection paths = dss.GetCatalog();
                var dsspath             = paths.FindExactPath(path);
                if (dsspath != DssPath.NotFound)
                {
                    var dpartdt = dsspath.GetDPartAsDateTime();
                    Assert.IsTrue(dpartdt.Month == 2);
                    Assert.IsTrue(dpartdt.Day == 1);
                    Assert.IsTrue(dpartdt.Year == 2016);
                    Assert.IsTrue(dpartdt.Hour == 0);
                    Assert.IsTrue(dpartdt.Minute == 0);
                }
                else
                {
                    Assert.Fail();
                }
            }
        }
Esempio n. 11
0
        public void ReadTs()
        {
            DssPath path = new DssPath("//SACRAMENTO/TEMP-MIN/01Jan1877/1Day/OBS/");

            DssReader r  = new DssReader(TestUtility.BasePath + "sample7.dss");
            var       ts = r.GetTimeSeries(path);

            for (int i = 0; i < ts.Count; i++)
            {
                var d = ts.Values[i];
                if (DssReader.IsValid(d))
                {
                }
            }

            //DateTime
            //11jul1877 24:00  60 DEG-F
            DateTime t = new DateTime(1877, 7, 12); // next day because of 24:00

            //ts.WriteToConsole();
            int idx = ts.IndexOf(t);

            Assert.IsTrue(idx >= 0);
            Assert.AreEqual(60, ts.Values[idx], 0.001);

            Console.WriteLine(ts.Values.Length);
        }
        static void Main(string[] args)
        {
            string fn            = @"C:\Users\q0hecngn\Downloads\precip.2018.09.dss";
            string pathname      = "/SHG/MARFC/PRECIP///NEXRAD/";
            var    targetDSSPath = new DssPath(pathname);

            double sum = 0;

            for (int j = 0; j < 4; j++)
            {
                using (var dssr = new DssReader(fn, DssReader.MethodID.MESS_METHOD_GENERAL_ID, DssReader.LevelID.MESS_LEVEL_CRITICAL))
                {
                    var cat   = dssr.GetCatalog(false);
                    var paths = cat.Paths.Select(dssPath => dssPath.FullPath).ToArray();

                    var filterPaths = PathAssist.FilterByPart(paths, targetDSSPath);

                    for (int i = 0; i < filterPaths.Count; i++)
                    {
                        string subpath = filterPaths[i];
                        var    dssPath = new DssPath(subpath);

                        var grd = dssr.GetGrid(dssPath, true);
                        sum += grd.MaxDataValue;
                    }

                    Console.WriteLine(sum.ToString());
                }
            }
        }
Esempio n. 13
0
 public void TestGetRecordTypeNoDPart()
 {
     using (DssReader r = new DssReader(TestUtility.BasePath + "sample7.dss"))
     {
         var recordType = r.GetRecordType(new DssPath("//SACRAMENTO/PRECIP-INC//1Day/OBS/"));
         Assert.IsTrue(recordType == RecordType.RegularTimeSeries);
     }
 }
Esempio n. 14
0
 public void ReadLocationFromVersion6File()
 {
     using (var r = new DssReader(TestUtility.BasePath + "sample.dss"))
     {
         string path = "//SACRAMENTO/TEMP-MAX/01JAN1877/1DAY/OBS/";
         var    L    = r.GetLocationInfo(path);
     }
 }
Esempio n. 15
0
 public void ReadMinimalTimeSeriesV6()
 {
     using (DssReader r = new DssReader(TestUtility.BasePath + "sample6.dss"))
     {
         var ts = r.GetEmptyTimeSeries(new DssPath("//SACRAMENTO/PRECIP-INC/01Jan1877/1Day/OBS/"));
         Assert.AreEqual("INCHES", ts.Units);
         Assert.AreEqual("PER-CUM", ts.DataType);
     }
 }
Esempio n. 16
0
 private static void RunReadTest(string dssFile)
 {
     using (DssReader dss = new DssReader(dssFile))
     {
         DssPathCollection paths = dss.GetCatalog();
         var    pathsFound       = paths.FilterByPart();
         string path             = pathsFound[0].FullPath;
     }
 }
Esempio n. 17
0
 public void ReadMissingBlocks()
 {
     using (DssReader r = new DssReader(TestUtility.BasePath + "sample7.dss"))
     {
         var path       = new DssPath("//SACRAMENTO/PRECIP-INC/01JAN1944/1Day/OBS/");
         var timeSeries = r.GetTimeSeries(path, new DateTime(2009, 11, 1), new DateTime(2025, 10, 31));
         Assert.AreEqual(0, timeSeries.Values.Length);
     }
 }
Esempio n. 18
0
 public void Read1944PathWith1950TimeWindow()
 {
     using (DssReader r = new DssReader(TestUtility.BasePath + "sample7.dss"))
     {
         var path       = new DssPath("//SACRAMENTO/PRECIP-INC/01JAN1944/1Day/OBS/");
         var timeSeries = r.GetTimeSeries(path, new DateTime(1950, 11, 1), new DateTime(1952, 10, 31));
         Assert.AreEqual(731, timeSeries.Values.Length);
     }
 }
Esempio n. 19
0
 public void TryReadCondensedPathNameFail()
 {
     using (DssReader r = new DssReader(TestUtility.BasePath + "sample7.dss"))
     {
         var  catalog = r.GetCatalog(true);
         bool result  = catalog.TryGetCondensedPath(new DssPath("//SACRAMENTO/PRECIP-INC/nothing/1Day/OBS/"), out DssPathCondensed nothing);
         Assert.IsFalse(result);
     }
 }
Esempio n. 20
0
        public void BogusPathTest()
        {
            DssPath path = new DssPath("/AmazonRiver/ST. LOUIS/FLOW//1Day/OBS/");

            using (DssReader r = new DssReader(TestUtility.BasePath + "sample7.dss"))
            {
                r.GetTimeSeries(path);
            }
        }
 public void CondensedPathTest()
 {
     using (DssReader r = new DssReader(TestUtility.BasePath + "AAA.dss"))
     {
         var p = r.GetCatalog();
         Assert.IsTrue(p.CondensedPaths.Count == 6);
         Assert.IsTrue(Enumerable.SequenceEqual(p.UnCondensedPaths.OrderBy(e => e), p.Paths.OrderBy(e => e)));
     }
 }
        public void V7ReadSimpleAlbersUndefinedProjection()
        {
            string path = "/a/b/c/01jan2001:1200/01jan2001:1300/f/";
            string fn   = TestUtility.BasePath + "gridtest.dss";

            DssReader r = new DssReader(fn);

            Grid g1 = r.GetGrid(path, false);
            Grid g2 = r.GetGrid(path, true);

            Assert.IsNotNull(g1);
            Assert.IsNotNull(g2);

            var x = g2.Data;

            for (int i = 0; i < x.Length; i++)
            {
                float expected = i * 1.2f;
                Assert.AreEqual(expected, x[i], 0.0001);
            }
            Assert.AreEqual(0, g2.StorageDataType);
            float delta = 0.000001f;                                // tolarance for comparisons;

            Assert.AreEqual(DssDataType.PER_AVER, g2.DataType);     //  Data Type: PER-AVER
            Assert.AreEqual(50, g2.Data.Length);
            Assert.AreEqual(0, g2.LowerLeftCellX);                  //  Lower Left Cell: (0, 0)
            Assert.AreEqual(0, g2.LowerLeftCellY);
            Assert.AreEqual("mm", g2.DataUnits.ToLower());          // Data Units: mm
            Assert.AreEqual(5, g2.NumberOfCellsX);                  //Grid Extents: (5, 10)
            Assert.AreEqual(10, g2.NumberOfCellsY);
            Assert.AreEqual(5.0f, g2.CellSize, delta);              //Cell Size: 5.0

            Assert.AreEqual(60.0f, g2.MaxDataValue, delta);         // Max Data Value: 60.0
            Assert.AreEqual(0.001, g2.MinDataValue, delta);         //Min Data Value: 0.001
            Assert.AreEqual(30.0f, g2.MeanDataValue, delta);        // Mean Data Value: 30.0
            Assert.AreEqual(10.2f, g2.XCoordOfGridCellZero, delta); // XCoord Of Grid Cell Zero: 10.2
            Assert.AreEqual(20.3f, g2.YCoordOfGridCellZero, delta); //YCoord Of Grid Cell Zero: 20.3

            Assert.AreEqual(path.ToLower(), g2.PathName.ToLower());
            Assert.AreEqual(DssGridType.ALBERS, g2.GridType); //Grid Type: ALBERS
            Assert.AreEqual(12, g2.NumberOfRanges);

            /*
             *
             * Start Time(assumed UTC): 1 January 2001, 12:00
             * End Time(assumed UTC):   1 January 2001, 13:00
             * = = = AlbersInfo = = =
             * Projection Datum: UNDEFINED DATUM
             * Projection Units:
             * First Standard Parallel: 0.0
             * Second Standard Parallel: 0.0
             * Central Meridian: 0.0
             * Latitude Of ProjectionOrigin: 0.0
             * False Easting: 0.0
             * False Northing: 0.0
             */
        }
        public void SimpleQualityConsistencyTestDss6_IRTS()
        {
            string orig = TestUtility.BasePath + "simpleQCT6_IRTS.dss";
            string fn   = TestUtility.BasePath + "simpleQCT6Copy_IRTS.dss";

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

            using (DssWriter w = new DssWriter(fn))
            {
                var ts = w.GetTimeSeries(new DssPath("/A/B/C//IR-YEAR/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//IR-YEAR/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//IR-YEAR/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//IR-YEAR/F/"));
                for (int i = 0; i < ts.Values.Length; i++)
                {
                    Assert.AreEqual(ts.Qualities[i], qList[i]);
                }
            }
        }
Esempio n. 24
0
 public void ReadCondensedPathNameWithTimeWindow()
 {
     using (DssReader r = new DssReader(TestUtility.BasePath + "sample7.dss"))
     {
         var catalog    = r.GetCatalog(true);
         var path       = catalog.GetCondensedPath(new DssPath("//SACRAMENTO/PRECIP-INC/11Jul1877 - 30Jun2009/1Day/OBS/"));
         var timeSeries = r.GetTimeSeries(path, new DateTime(1950, 11, 1), new DateTime(1952, 10, 31));
         Assert.AreEqual(731, timeSeries.Values.Length);
     }
 }
Esempio n. 25
0
        public void ToDataTableWithQuality()
        {
            DssPath path = new DssPath("/MISSISSIPPI/ST. LOUIS/FLOW//1Day/OBS/");

            using (DssReader r = new DssReader(TestUtility.BasePath + "sample7.dss"))
            {
                var ts = r.GetTimeSeries(path);
                var dt = ts.ToDataTable();
            }
        }
Esempio n. 26
0
        public void OverwriteTimeSeriesUsingTimeSeriesPoints()
        {
            DssPath path = new DssPath("//SACRAMENTO/PRECIP-INC//1Day/OBS/");

            using (DssReader r = new DssReader(TestUtility.BasePath + "sample7.dss"))
            {
                var ts = r.GetTimeSeries(path);
                var dt = ts.ToDataTable();
            }
        }
Esempio n. 27
0
        public void TimeIntervalMethodTest()
        {
            DssPath path = new DssPath("/MISSISSIPPI/ST. LOUIS/FLOW//1Day/OBS/");

            using (DssReader r = new DssReader(TestUtility.BasePath + "sample7.dss"))
            {
                var s = TimeWindow.GetInterval(r.GetTimeSeries(path));
                Debug.WriteLine(s);
            }
        }
        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]);
                }
            }
        }
Esempio n. 29
0
        public void AnyValueCompression()
        {
            DssPath p = new DssPath(@"//SACRAMENTO/PRECIP-INC//1Day/OBS/");

            using (DssReader r = new DssReader(TestUtility.BasePath + "sample7.dss"))
            {
                var ts  = r.GetTimeSeries(p);
                var ts2 = r.GetTimeSeries(p, compression: TimeWindow.ConsecutiveValueCompression.AnyValue);
                Assert.IsTrue(ts2.Count <= ts.Count); // ts2 should not have more than 2 of the same value at a time
            }
        }
Esempio n. 30
0
        public void ZeroAndNoDataCompression()
        {
            DssPath p = new DssPath(@"//SACRAMENTO/PRECIP-INC//1Day/OBS/");

            using (DssReader r = new DssReader(TestUtility.BasePath + "sample7.dss"))
            {
                var ts  = r.GetTimeSeries(p);
                var ts2 = r.GetTimeSeries(p, compression: TimeWindow.ConsecutiveValueCompression.ZeroAndNoData);
                Assert.IsTrue(ts2.Count <= ts.Count); // ts2 should have no more than 2 consecutive zero's or no data values at a time
            }
        }