Example #1
0
        private void updateTableAndChart()
        {
            _statistics = "No Statistics Data Available";
            if (onDataStatisticsChanged != null)
            {
                onDataStatisticsChanged(this, new EventArgs());
            }

            if (_resultType == null || _col == null)
            {
                return;
            }

            if (!this._scenario.Watershed.Results.ContainsKey(_resultType))
            {
                return;
            }

            ArcSWAT.SWATUnitResult result = this._scenario.Watershed.Results[_resultType];
            if (!result.Columns.Contains(_col))
            {
                return;
            }

            int year = -1;

            if ((result.Interval == ArcSWAT.SWATResultIntervalType.DAILY || result.Interval == ArcSWAT.SWATResultIntervalType.MONTHLY) && yearCtrl1.DisplayByYear)
            {
                year = yearCtrl1.Year;
            }

            if (_compareResult == null) //don't compare
            {
                ArcSWAT.SWATUnitColumnYearResult oneResult = result.getResult(_col, year);

                this.tableView1.Result          = oneResult;
                this.outputDisplayChart1.Result = oneResult;
                _statistics = oneResult.Statistics.ToString();
                if (onDataStatisticsChanged != null)
                {
                    onDataStatisticsChanged(this, new EventArgs());
                }
            }
            else //compare
            {
                try
                {
                    ArcSWAT.SWATUnitColumnYearCompareResult compare =
                        result.getResult(_col, year).Compare(_compareResult);
                    this.tableView1.CompareResult          = compare;
                    this.outputDisplayChart1.CompareResult = compare;
                    _statistics = compare.Statistics.ToString();
                    if (onDataStatisticsChanged != null)
                    {
                        onDataStatisticsChanged(this, new EventArgs());
                    }
                }
                catch (System.Exception e)
                {
                    SWAT_SQLite.showInformationWindow(e.ToString());
                }
            }
        }
Example #2
0
 public StatisticCompare(SWATUnitColumnYearCompareResult result, SeasonType season)
 {
     _result = result;
     _season = season;
 }
 public StatisticCompare(SWATUnitColumnYearCompareResult result,SeasonType season)
 {
     _result = result;
     _season = season;
 }
Example #4
0
        private void updateTableAndChart()
        {
            tableView1.DataTable = null;
            outputDisplayChart1.clear();
            _statistics = "No Statistics Data Available";
            if (onDataStatisticsChanged != null)
            {
                onDataStatisticsChanged(this, new EventArgs());
            }

            if (_resultType == null || _col == null || _unit == null)
            {
                return;
            }

            if (!_unit.Results.ContainsKey(_resultType))
            {
                return;
            }

            ArcSWAT.SWATUnitResult result = _unit.Results[_resultType];
            if (!result.Columns.Contains(_col))
            {
                return;
            }

            //consider year selection
            int year = -1;

            if ((result.Interval == ArcSWAT.SWATResultIntervalType.DAILY || result.Interval == ArcSWAT.SWATResultIntervalType.MONTHLY) && yearCtrl1.DisplayByYear)
            {
                year = yearCtrl1.Year;
            }

            //current working result
            ArcSWAT.SWATUnitColumnYearResult oneResult = result.getResult(_col, year);

            //set compare control
            //compareCtrl1.HasObervedData = (oneResult.ObservedData != null);

            //do the update
            if (compareCtrl1.CompareResult == null) //don't compare
            {
                if (oneResult.Table.Rows.Count == 0 && _type == ArcSWAT.SWATUnitType.HRU)
                {
                    MessageBox.Show("No results for HRU " + _unit.ID.ToString() + ". For more results, please modify file.cio.");
                }

                this.tableView1.Result          = oneResult;
                this.outputDisplayChart1.Result = oneResult;
                this._statistics = oneResult.SeasonStatistics(seasonCtrl1.Season).ToString();
                if (oneResult.ObservedData != null)
                {
                    this._statistics += " || Compare to Observed: " + oneResult.CompareWithObserved.SeasonStatistics(seasonCtrl1.Season).ToString() + ")";
                }
                if (onDataStatisticsChanged != null)
                {
                    onDataStatisticsChanged(this, new EventArgs());
                }
            }
            else //compare
            {
                try
                {
                    ArcSWAT.SWATUnitColumnYearCompareResult compare = null;
                    if (compareCtrl1.CompareResult != null)
                    {
                        compare = oneResult.Compare(compareCtrl1.CompareResult);

                        //compare to scenario
                        this._statistics = string.Format("{0} vs {1}: {2}",
                                                         result.Unit.Scenario.ModelType,
                                                         compareCtrl1.CompareResult.ModelType,
                                                         compare.SeasonStatistics(seasonCtrl1.Season));

                        if (oneResult.ObservedData != null)
                        {
                            //compare to observed
                            this._statistics += " || ";
                            this._statistics += string.Format("{0} vs Observed: {1}",
                                                              result.Unit.Scenario.ModelType,
                                                              oneResult.CompareWithObserved.SeasonStatistics(seasonCtrl1.Season));

                            ArcSWAT.SWATUnitColumnYearResult comparedData = compare.ComparedData as ArcSWAT.SWATUnitColumnYearResult;
                            this._statistics += " || ";
                            this._statistics += string.Format("{0} vs Observed: {1}",
                                                              compareCtrl1.CompareResult.ModelType,
                                                              comparedData.CompareWithObserved.SeasonStatistics(seasonCtrl1.Season));
                        }
                    }
                    else
                    {
                        compare          = oneResult.CompareWithObserved;
                        this._statistics = compare.SeasonStatistics(seasonCtrl1.Season).ToString();
                    }
                    this.tableView1.CompareResult          = compare;
                    this.outputDisplayChart1.CompareResult = compare;
                    if (onDataStatisticsChanged != null)
                    {
                        onDataStatisticsChanged(this, new EventArgs());
                    }
                }
                catch (System.Exception e)
                {
                    SWAT_SQLite.showInformationWindow(e.ToString());
                }
            }
        }