示例#1
0
        public override IExplorerView Run()
        {
            Logger.WriteLine("TimeSeriesAnalysis.Run()");
            SeriesList list = Explorer.CreateSelectedSeries();

            ReadSeriesList(list);
            if (Explorer.SelectedSeries.Length == 1 && Explorer.MergeSelected)
            { // merge single Year Traces.
                var s = list.MergeYearlyScenarios();
                list = new SeriesList();
                list.Add(s);
            }

            view.SeriesList = list;
            string title = list.Text.TitleText();

            if (Explorer.SubtractFromBaseline)
            {
                title = "Subtract Reference \n" + title;
            }
            view.Title    = title;
            view.SubTitle = list.MissingRecordsMessage;
            //view.DataTable = myList.CompositeTable;
            return(view);
        }
示例#2
0
        public override IExplorerView Run()
        {
            Logger.WriteLine("SummaryHydrographAnalysis.Run()");
            SeriesList list = Explorer.CreateSelectedSeries();

            ReadSeriesList(list);


            if (Explorer.SelectedSeries.Length == 1 && Explorer.MergeSelected)
            { // merge single Year Traces.
                list.RemoveMissing();
                var s = list.MergeYearlyScenarios();
                list = new SeriesList();
                list.Add(s);
            }

            view.Messages.Add(list.MissingRecordsMessage);

            string title    = list.Text.TitleText();
            string subTitle = list.MissingRecordsMessage;



            SeriesList myList = new SeriesList();

            list.RemoveMissing();

            if (Explorer.AlsoPlotYear && list.Count == 1)
            {
                YearRange yearRng = new YearRange(Explorer.PlotYear, Explorer.BeginningMonth);
                DateTime  t1      = yearRng.DateTime1;
                DateTime  t2      = yearRng.DateTime2;

                Series s = Math.Subset(list[0], t1, t2);
                s.Appearance.LegendText = yearRng.Year.ToString();
                view.Messages.Add(yearRng.Year.ToString() + " included as separate series ");
                myList.Add(s);
                myList.Add(list.SummaryHydrograph(Explorer.ExceedanceLevels, t1,
                                                  Explorer.PlotMax, Explorer.PlotMin, Explorer.PlotAvg, true));//,true));
            }
            else
            {
                DateTime t = new DateTime(DateTime.Now.Year, Explorer.BeginningMonth, 1);
                myList = list.SummaryHydrograph(Explorer.ExceedanceLevels, t,
                                                Explorer.PlotMax, Explorer.PlotMin, Explorer.PlotAvg, true);//,true);
            }

            Explorer.WriteProgressMessage("drawing graph", 80);
            view.Title      = title;
            view.SubTitle   = subTitle;
            view.SeriesList = myList;
            view.DataTable  = myList.ToDataTable(true);
            //view.Draw();
            return(view);
        }
示例#3
0
        public override IExplorerView Run()
        {
            Logger.WriteLine("TimeSeriesAnalysis.Run()");
            SeriesList list = Explorer.CreateSelectedSeries();

            ReadSeriesList(list);
            if (Explorer.SelectedSeries.Length == 1 && Explorer.MergeSelected)
            { // merge single Year Traces.
                var s = list.MergeYearlyScenarios();
                list = new SeriesList();
                list.Add(s);
            }

            SeriesList myList = list;

            if (Explorer.StatisticalMethods != StatisticalMethods.None)
            {
                myList = list.AggregateAndSubset(Explorer.StatisticalMethods,
                                                 Explorer.MonthDayRange, Explorer.BeginningMonth);//,Explorer.HasTraces);
            }

            //if (Explorer.HasTraces && Explorer.StatisticalMethods != StatisticalMethods.None)
            //{
            //    // multiple sums are brought together as a single series.
            //    myList = myList.Merge();
            //}
            Logger.WriteLine("Drawing Graph");

            if (myList.Count == 1 && myList[0].TimeInterval == TimeInterval.Monthly)
            {
                myList.DateFormat = "MMM-yyyy";
            }
            view.SeriesList = myList;
            string title = list.Text.TitleText();

            if (Explorer.SubtractFromBaseline)
            {
                title = "Subtract Reference \n" + title;
            }
            view.Title    = title;
            view.SubTitle = list.MissingRecordsMessage;
            //view.DataTable = myList.CompositeTable;
            return(view);
        }
示例#4
0
        /// <summary>
        /// Used by Exceedance and Probability
        /// </summary>
        /// <param name="sortType"></param>
        protected void SortAndRank(RankType sortType)
        {
            //  Logger.WriteLine("Settings.HasTraces: " + Explorer.HasTraces);
            SeriesList list = Explorer.CreateSelectedSeries();

            ReadSeriesList(list);
            list.RemoveMissing();
            if (Explorer.SelectedSeries.Length == 1 && Explorer.MergeSelected)
            { // merge single Year Traces.
                var s = list.MergeYearlyScenarios();
                list = new SeriesList();
                list.Add(s);
            }
            Explorer.WriteProgressMessage("SubSet using Month Range " + Explorer.MonthDayRange.ToString(), 10);
            SeriesList myList = list.Subset(Explorer.MonthDayRange);

            Performance p = new Performance();

            myList = myList.AggregateAndSubset(Explorer.StatisticalMethods,
                                               Explorer.MonthDayRange, Explorer.BeginningMonth);//, Explorer.HasTraces);
            p.Report("kt");

            //if (Explorer.HasTraces && Explorer.StatisticalMethods != StatisticalMethods.None)
            //{
            //    // combine each 'year/scenario' into a single series
            //    myList = myList.Merge();
            //}
            SeriesList proababilityList = new SeriesList();

            foreach (Series s in myList)
            {
                s.Appearance.Style = Styles.Line;
                proababilityList.Add(Math.Sort(s, sortType));
            }

            Explorer.WriteProgressMessage("drawing graph", 86);

            view.Title = Explorer.MonthDayRange.ToString() + " " + list.Text.TitleText();

            proababilityList.Type = SeriesListType.Sorted;
            view.SubTitle         = list.MissingRecordsMessage;

            view.SeriesList = proababilityList;
        }
示例#5
0
        public override IExplorerView Run()
        {
            SeriesList list = Explorer.CreateSelectedSeries();

            ReadSeriesList(list);
            if (Explorer.SelectedSeries.Length == 1 && Explorer.MergeSelected)
            { // merge single Year Traces.
                var s = list.MergeYearlyScenarios();
                list = new SeriesList();
                list.Add(s);
            }

            SeriesList myList = list;
            if (Explorer.StatisticalMethods != StatisticalMethods.None)
            {
                myList = list.AggregateAndSubset(Explorer.StatisticalMethods,
                    Explorer.MonthDayRange, Explorer.BeginningMonth);
            }

            Logger.WriteLine("Drawing Graph");

            if (myList.Count == 1 && myList[0].TimeInterval == TimeInterval.Monthly)
            {
                myList.DateFormat = "MMM-yyyy";
            }
            // [JR] hack for POET testing and development
            //if (view == null)
            //{
            //    view = Explorer.View;
            //}
            view.SeriesList = myList;
            string title = list.Text.TitleText();
            if (Explorer.SubtractFromBaseline)
                title = "Subtract Reference \n" + title;
            view.Title = title;
            view.SubTitle = list.MissingRecordsMessage;
            //view.DataTable = myList.CompositeTable;
            return view;
        }
示例#6
0
        public override IExplorerView Run()
        {
            Logger.WriteLine("TraceAnalysis.Run()");
            SeriesList list = Explorer.CreateSelectedSeries();

            ReadSeriesList(list);
            string title    = list.Text.TitleText();
            string subTitle = list.MissingRecordsMessage;

            // [JR] don't perform trace analysis if trace count < 10...
            if (list.Count < 10)
            {
                view.Messages.Add("Trace exceedance analysis is not available if trace count < 10");
                view.Title      = title;
                view.SubTitle   = subTitle;
                view.SeriesList = list;
                view.DataTable  = list.ToDataTable(true);
                return(view);
            }

            // This seems to be common between all the analysis options
            if (Explorer.SelectedSeries.Length == 1 && Explorer.MergeSelected)
            { // merge single Year Traces.
                list.RemoveMissing();
                var s = list.MergeYearlyScenarios();
                list = new SeriesList();
                list.Add(s);
            }
            view.Messages.Add(list.MissingRecordsMessage);
            list.RemoveMissing();

            // Initialize the output container
            SeriesList traceAnalysisList = new SeriesList();

            // Get exceedance curves
            if (Explorer.traceExceedanceAnalysis)
            {
                traceAnalysisList = getTraceExceedances(list,
                                                        Explorer.ExceedanceLevels, Explorer.AlsoPlotTrace,
                                                        Explorer.PlotTrace, Explorer.PlotMinTrace,
                                                        Explorer.PlotAvgTrace, Explorer.PlotMaxTrace);
            }

            // Get aggregated values
            if (Explorer.traceAggregationAnalysis)
            {
                string sumType = "";
                if (Explorer.sumCYRadio)
                {
                    sumType = "CY";
                }
                else if (Explorer.sumWYRadio)
                {
                    sumType = "WY";
                }
                else if (Explorer.sumCustomRangeRadio)
                {
                    sumType = "XX";
                }
                else
                {
                }
                traceAnalysisList = getTraceSums(list, sumType);
            }

            // [JR] Add other analysis/report building options here...

            Explorer.WriteProgressMessage("drawing graph", 80);
            view.Title      = title;
            view.SubTitle   = subTitle;
            view.SeriesList = traceAnalysisList;
            view.DataTable  = traceAnalysisList.ToDataTable(true);
            //view.Draw();
            return(view);
        }
示例#7
0
        public override IExplorerView Run()
        {
            Logger.WriteLine("SummaryHydrographAnalysis.Run()");
            SeriesList list = Explorer.CreateSelectedSeries();

            ReadSeriesList(list);


            if (Explorer.SelectedSeries.Length == 1 && Explorer.MergeSelected)
            { // merge single Year Traces.
                list.RemoveMissing();
                var s = list.MergeYearlyScenarios();
                list = new SeriesList();
                list.Add(s);
            }

            view.Messages.Add(list.MissingRecordsMessage);

            string title    = list.Text.TitleText();
            string subTitle = list.MissingRecordsMessage;



            SeriesList myList = new SeriesList();

            list.RemoveMissing();

            if (Explorer.AlsoPlotYear && list.Count == 1)
            {
                int[]    yearsToPlot   = Explorer.PlotYear;
                int      xtraYearCount = 0;
                DateTime tSumHyd1      = DateTime.Now;
                DateTime tSumHyd2      = DateTime.Now;
                foreach (var year in yearsToPlot)
                {
                    YearRange yearRng = new YearRange(year, Explorer.BeginningMonth);
                    DateTime  t1      = yearRng.DateTime1;
                    DateTime  t2      = yearRng.DateTime2;
                    Series    s       = Math.Subset(list[0], t1, t2);

                    if (xtraYearCount == 0)//first series
                    {
                        s.Appearance.LegendText = yearRng.Year.ToString();
                        view.Messages.Add(yearRng.Year.ToString() + " included as separate series ");
                        myList.Add(s);
                        if (yearsToPlot.Length == 1)
                        {
                            myList.Add(list.SummaryHydrograph(Explorer.ExceedanceLevels, t1, Explorer.PlotMax, Explorer.PlotMin, Explorer.PlotAvg, true));
                        }
                        else
                        {
                            myList.Add(list.SummaryHydrograph(new int[] { }, t1, false, false, false, true));
                        }
                        tSumHyd1 = t1;
                        tSumHyd2 = t2;
                    }
                    else//every series
                    {
                        Series sDummy = new Series();
                        foreach (Point pt in s)
                        {
                            if (!(pt.DateTime.Month == 2 && pt.DateTime.Day == 29))   //sigh... leap days...
                            {
                                sDummy.Add(pt.DateTime.AddYears(tSumHyd1.Year - t1.Year), pt.Value);
                            }
                        }
                        sDummy.TimeInterval          = s.TimeInterval;
                        sDummy.Name                  = s.Name;
                        sDummy.Units                 = s.Units;
                        sDummy.Parameter             = s.Parameter;
                        sDummy.Appearance.LegendText = yearRng.Year.ToString();;
                        view.Messages.Add(yearRng.Year.ToString() + " included as separate series ");
                        myList.Add(sDummy);
                        if (xtraYearCount == yearsToPlot.Length - 1)//last series
                        {
                            myList.Add(list.SummaryHydrograph(Explorer.ExceedanceLevels, tSumHyd1, Explorer.PlotMax, Explorer.PlotMin, Explorer.PlotAvg, true));
                        }
                        else
                        {
                            myList.Add(list.SummaryHydrograph(new int[] { }, tSumHyd1, false, false, false, true));
                        }
                    }
                    xtraYearCount++;
                }
            }
            else
            {
                DateTime t = new DateTime(DateTime.Now.Year, Explorer.BeginningMonth, 1);
                myList = list.SummaryHydrograph(Explorer.ExceedanceLevels, t,
                                                Explorer.PlotMax, Explorer.PlotMin, Explorer.PlotAvg, true);//,true);
            }

            Explorer.WriteProgressMessage("drawing graph", 80);
            view.Title      = title;
            view.SubTitle   = subTitle;
            view.SeriesList = myList;
            view.DataTable  = myList.ToDataTable(true);
            //view.Draw();
            return(view);
        }