Ejemplo n.º 1
0
        public void ProfileTesting()
        {
            var fn = @"C:\temp\dss7_profile_ensemble.dss";

            File.Delete(fn);


            string     csvFilename = Path.Combine(EnsembleTester.CacheDir, "test.csv");
            RfcCsvFile csv         = new RfcCsvFile(csvFilename);

            float[,] ensemble = null;

            csv.GetEnsemble("SCRN2", ref ensemble);

            Watershed ws        = new Watershed("test");
            DateTime  issueDate = new DateTime(2001, 11, 15, 12, 0, 0);

            ws.AddForecast("SCRN2", issueDate, ensemble, csv.TimeStamps);


            DssEnsemble.WriteToTimeSeriesProfiles(fn, ws);

            var ws2 = DssEnsemble.ReadTimeSeriesProfiles("test", issueDate, issueDate, fn);

            Assert.AreEqual(1, ws2.Locations.Count);

            var data = ws2.Locations[0].Forecasts[0].Ensemble;

            Assert.AreEqual(-1.0f, data[0, 0]);
            Assert.AreEqual(-2.1f, data[0, 1]);
            Assert.AreEqual(-3.1f, data[0, 2]);
            Assert.AreEqual(-59.0f, data[58, 0]);
            Assert.AreEqual(-59.1f, data[58, 1]);
            Assert.AreEqual(-59.2f, data[58, 2]);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            // read from web.

            // import
            var re = new CsvEnsembleReader(@"c:\temp\hefs_cache");
            var t  = new DateTime(2021, 10, 1, 12, 0, 0);
            var ws = re.Read("RussianNapa", t, t);

            DssEnsemble.WriteToTimeSeriesProfiles(@"C:\temp\" + ws.Name + ".dss", ws);
            Console.WriteLine(ws);
        }