Example #1
0
        private void buttonGo_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            Application.DoEvents();
            try
            {
                HydrometHost svr = HydrometInfoUtility.HydrometServerFromPreferences();

                int yr = 2000;
                if (multi.cbtt.Trim() != "")
                {
                    var s    = HydrometDailySeries.GetMultiYearAverage(multi.cbtt, multi.pcode, svr, multi.T1, multi.T2);
                    var list = new SeriesList();
                    list.Add(s);
                    view.SeriesList = list;
                    view.Draw();
                    Application.DoEvents();
                    // comparison period
                    if (compare.cbtt.Trim() != "")
                    {
                        var s2 = HydrometDailySeries.GetMultiYearAverage(compare.cbtt, compare.pcode, svr, compare.T1, compare.T2);
                        list.Add(s2);
                    }
                    if (textBoxCompareSingleYear.Text.Trim() != "" &&
                        textBoxSingleYearCbtt.Text.Trim() != "" &&
                        int.TryParse(this.textBoxCompareSingleYear.Text, out yr))
                    {
                        yr = Convert.ToInt32(textBoxCompareSingleYear.Text);
                        DateTime t1 = new DateTime(yr - 1, 10, 1);
                        DateTime t2 = new DateTime(yr, 9, 30);

                        Series s3 = HydrometDailySeries.Read(textBoxSingleYearCbtt.Text, textBoxSingleYearPcode.Text, t1, t2, svr);
                        s3 = Reclamation.TimeSeries.Math.ShiftToYear(s3, 2000);
                        s3.Appearance.LegendText = yr.ToString();
                        list.Add(s3);
                    }

                    view.SeriesList = list;
                    view.Draw();
                }
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
Example #2
0
        private void buttonGo_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            Application.DoEvents();
            try
            {
                var range = new MonthDayRange(Convert.ToInt16(Range1.Text.Split('/')[0]), Convert.ToInt16(Range1.Text.Split('/')[1]),
                                              Convert.ToInt16(Range2.Text.Split('/')[0]), Convert.ToInt16(Range2.Text.Split('/')[1]));

                int wy1 = Convert.ToInt32(textBoxYear.Text);
                int wy2 = Convert.ToInt32(textBoxEndYear.Text);

                string cbtt  = textBoxCbtt.Text;
                string pcode = textBoxPcode.Text;

                var s = Reclamation.TimeSeries.Math.HydrometDaily(cbtt, pcode);

                var t1 = new DateTime(wy1 - 1, 10, 1);
                var t2 = new DateTime(wy2, 9, 30);

                s.Read(t1, t2);

                if (AF.Checked)
                {
                    Reclamation.TimeSeries.Math.Multiply(s, 1.98347);
                    s.Units = "Acre-Feet";
                }

                var rval = Reclamation.TimeSeries.Math.AnnualSum(s, range, 10);

                rval.Appearance.LegendText = cbtt.ToUpper() + " " + pcode.ToUpper() + " Sum in Range";

                if (checkBoxOldSChool.Checked)
                {
                    var s2  = Reclamation.TimeSeries.Math.HydrometDaily(cbtt, pcode);
                    var t12 = new DateTime(Convert.ToInt32(textBoxRankedYear.Text) - 1, 10, 1);
                    var t22 = new DateTime(Convert.ToInt32(textBoxRankedYear.Text), 9, 30);
                    s2.Read(t12, t22);
                    if (AF.Checked)
                    {
                        Reclamation.TimeSeries.Math.Multiply(s2, 1.98347);
                        s2.Units = "Acre-Feet";
                    }
                    var rval2 = Reclamation.TimeSeries.Math.AnnualSum(s2, range, 10);
                    OldSchoolReport.Display(rval, "DAILY VALUES SUMMATION  - Volume in Acre-feet", "Volume " + s.Units,
                                            cbtt, pcode, range, wy1, wy2, rval2);
                }

                var list = new SeriesList();
                list.Add(rval);
                view.SeriesList = list;
                view.Draw();
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
Example #3
0
        private void buttonGo_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            Application.DoEvents();
            try
            {
                MonthDayRange range = monthDayRangePicker1.MonthDayRange;



                string cbtt  = multiWaterYearSelector1.cbtt;
                string pcode = multiWaterYearSelector1.pcode;

                //var s = Reclamation.TimeSeries.Math.HydrometDaily(cbtt, pcode);

                var          t1  = multiWaterYearSelector1.T1;
                var          t2  = multiWaterYearSelector1.T2;
                HydrometHost svr = HydrometInfoUtility.HydrometServerFromPreferences();

                var s = HydrometDailySeries.Read(cbtt, pcode, t1, t2, svr);

                var rvalMax = Reclamation.TimeSeries.Math.AnnualMax(s, range, range.Month1);
                var rvalMin = Reclamation.TimeSeries.Math.AnnualMin(s, range, range.Month1);

                rvalMax.Appearance.LegendText = cbtt.ToUpper() + " " + pcode.ToUpper() + " Maximum in Range";
                rvalMin.Appearance.LegendText = cbtt.ToUpper() + " " + pcode.ToUpper() + " Minimum in Range";

                var list = new SeriesList();

                list.Add(rvalMax);
                list.Add(rvalMin);

                view.SeriesList = list;
                view.Draw();
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
Example #4
0
        private void buttonGo_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            Application.DoEvents();
            try
            {
                int wy1 = Convert.ToInt32(textBoxYear.Text);
                int wy2 = Convert.ToInt32(textBoxEndYear.Text);

                string cbtt  = textBoxCbtt.Text;
                string pcode = textBoxPcode.Text;

                var s = Reclamation.TimeSeries.Math.HydrometDaily(cbtt, pcode);

                var t1 = new DateTime(wy1 - 1, 10, 1);
                var t2 = new DateTime(wy2, 9, 30);

                s.Read(t1, t2);

                var list = new SeriesList();

                if (checkBoxTotal.Checked)
                {
                    var rval = Reclamation.TimeSeries.Math.MonthlySum(s);
                    rval.Units = "CFS";
                    list.Add(rval);
                }

                if (checkBoxTotalAF.Checked)
                {
                    var tmp = s.Copy();
                    Reclamation.TimeSeries.Math.Multiply(tmp, 1.98347);
                    var rval = Reclamation.TimeSeries.Math.MonthlySum(tmp);
                    rval.Units = "Acre-Feet";
                    list.Add(rval);
                }

                if (checkBoxAverage.Checked)
                {
                    var rval = Reclamation.TimeSeries.Math.MonthlyAverage(s);
                    rval.Units = "CFS";
                    list.Add(rval);
                }

                if (checkBoxAverageAF.Checked)
                {
                    var tmp = s.Copy();
                    Reclamation.TimeSeries.Math.Multiply(tmp, 1.98347);
                    var rval = Reclamation.TimeSeries.Math.MonthlyAverage(tmp);
                    rval.Units = "Acre-Feet";
                    list.Add(rval);
                }

                if (checkBoxChange.Checked)
                {
                    var start = Reclamation.TimeSeries.Math.StartOfMonth(s);
                    var end   = Reclamation.TimeSeries.Math.EndOfMonth(s);
                    var rval  = end - start;// Reclamation.TimeSeries.Math.Add(end, start, true);
                    list.Add(rval);
                }

                if (checkBoxMax.Checked)
                {
                    var rval = Reclamation.TimeSeries.Math.MonthlyMax(s);
                    list.Add(rval);
                }

                if (checkBoxMin.Checked)
                {
                    var rval = Reclamation.TimeSeries.Math.MonthlyMin(s);
                    list.Add(rval);
                }

                if (checkBoxFirstMonth.Checked)
                {
                    var rval = Reclamation.TimeSeries.Math.StartOfMonth(s);
                    list.Add(rval);
                }

                if (checkBoxEndMonth.Checked)
                {
                    var rval = Reclamation.TimeSeries.Math.EndOfMonth(s);
                    list.Add(rval);
                }

                view.SeriesList = list;
                view.Draw();
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }