public TestUofIDisaggregation()
        {
            string zipFile = Path.Combine(TestData.DataPath, "UofIDisaggregationTest.zip");

            path = FileUtility.GetTempPath() + @"\UofIDisaggregationTest.pdb";
            ZipFileUtility.UnzipFile(zipFile, path);
        }
Beispiel #2
0
        public void InterpolateWithStyle()
        {
            string zipFile = Path.Combine(TestData.DataPath, "UofIDisaggregationTest.zip");
            var    path    = FileUtility.GetTempPath() + @"\UofIDisaggregationTest.pdb";

            ZipFileUtility.UnzipFile(zipFile, path);

            Reclamation.Core.SQLiteServer pDB = new Reclamation.Core.SQLiteServer(path);
            TimeSeriesDatabase            DB  = new TimeSeriesDatabase(pDB, false);
            Series sReal = DB.GetSeriesFromName("SS_Day_Mean"); sReal.Read();
            Series sEst  = DB.GetSeriesFromName("TS_Mon_Mean"); sEst.Read();

            Series sOut = Reclamation.TimeSeries.Math.InterpolateWithStyle(sReal, sEst, "2001-3-1", "2003-12-1");

            // Can't get the Series.Values.Sum() extension... workaround below.
            double sum1 = 0, sum2 = 0;

            for (int i = 0; i < sEst.Count; i++)
            {
                sum1 = sum1 + sEst[i].Value;
                sum2 = sum2 + sOut[i].Value;
            }
            sum1 = System.Math.Round(sum1, 2);
            sum2 = System.Math.Round(sum2, 2);
            Assert.AreEqual(sum1, sum2);
        }
Beispiel #3
0
        private static string DownloadAndUnzip(string url)
        {
            var zip = FileUtility.GetTempFileName(".zip");

            Console.WriteLine("Downloading: " + url);
            Web.GetFile(url, zip);


            var csv = FileUtility.GetTempFileName(".csv");

            Console.WriteLine("Unzipping to-> " + csv);
            ZipFileUtility.UnzipFile(zip, csv);
            return(csv);
        }
Beispiel #4
0
        private static string DownloadAndUnzip(DateTime t)
        {
            //http://www.noaa.inel.gov/mvp/data/2014/02/x28.zip
            string url = System.Configuration.ConfigurationManager.AppSettings["INEL_URL"];

            url += t.Year + "/" + t.Month.ToString().PadLeft(2, '0') + "/x" + t.Day.ToString().PadLeft(2, '0') + ".zip";
            var zip = FileUtility.GetTempFileName(".zip");

            Console.WriteLine("Downloading: " + url);
            Web.GetFile(url, zip);


            var xmlFileName = FileUtility.GetTempFileName(".xml");

            Console.WriteLine("Unzipping to-> " + xmlFileName);
            ZipFileUtility.UnzipFile(zip, xmlFileName);
            return(xmlFileName);
        }