예제 #1
0
        private void ReadExternalData(DateTime t1, DateTime t2)
        {
            var pc = textBoxPcode.Text.Trim().ToLower();

            if (GetSourceType() == ExternalSource.USGS)
            {
                UsgsDailyParameter usgsParm = FindUsgsParameter(pc);

                externalSeries = new UsgsDailyValueSeries(this.textBoxUsgs.Text.Trim(), usgsParm);
            }
            else
            if (GetSourceType() == ExternalSource.OWRD)
            {
                if (pc == "qd" || pc == "qj")
                {
                    externalSeries = new OwrdSeries(this.textBoxOwrd.Text.Trim(), OwrdSeries.OwrdDataSet.MDF, this.checkBoxProvisional.Checked);
                }
                else
                if (pc == "af")
                {
                    externalSeries = new OwrdSeries(this.textBoxOwrd.Text.Trim(), OwrdSeries.OwrdDataSet.Midnight_Volume, this.checkBoxProvisional.Checked);
                }
                else
                {
                    externalSeries = new Series();
                }
            }
            else
            if (GetSourceType() == ExternalSource.IDACORP)
            {
                externalSeries       = GetIdahoPowerSeries();
                externalSeries.Units = "cfs";
            }
            else if (GetSourceType() == ExternalSource.nrcs)
            {
                var    snotelSiteID    = NrcsSnotelSeries.LookupSiteID(textBoxSnotel.Text);
                string snotelParameter = NrcsSnotelSeries.SnotelParameterFromHydrometPcode(pc);
                externalSeries = new NrcsSnotelSeries(snotelSiteID, snotelParameter);
            }
            else if (GetSourceType() == ExternalSource.Idwr)
            {
                externalSeries = new IDWRDailySeries(textBoxIdwr.Text.Trim());
            }

            externalSeries.Read(t1, t2);
            // convert units if needed

            if (externalSeries.Units == "degrees Celsius")
            {
                externalSeries.Units = "degrees C";
            }

            if (externalSeries.Units == "degrees C")
            {
                Reclamation.TimeSeries.Math.ConvertUnits(externalSeries, "degrees F");
            }


            externalSeries.Appearance.LegendText = GetSourceType().ToString() + " " + externalSeries.Name;
        }
예제 #2
0
파일: TestSnotel.cs 프로젝트: usbr/Pisces
 public void SnotelSnowDepth()
 {
     //var s= NrcsSnotelSeries.GetNRCS("jkpi", "sd", "15E09S");
     var s = new NrcsSnotelSeries("550", "SNWD.I-1 (in)");
     s.Read(DateTime.Parse("2010-10-1"), DateTime.Parse("2011-1-10"));
        s.WriteToConsole();
 }
예제 #3
0
파일: TestSnotel.cs 프로젝트: usbr/Pisces
        public void SnotelSnowWaterEquivalent()
        {
            var s = new NrcsSnotelSeries("550", "WTEQ.I-1 (in)");
            //var s= NrcsSnotelSeries.GetNRCS("jkpi", "se", "15E09S");

            //s.Read();
            s.Read(DateTime.Parse("2009-10-1"), DateTime.Parse("2009-10-16"));
            Assert.AreEqual(1.3, s["10-14-2009"].Value,0.01);
            s.WriteToConsole();
            //Assert.AreEqual(9.1, s["12-15-2003"].Value, 0.01);
        }
예제 #4
0
        private void AddNrcsSnotel(object sender, EventArgs e)
        {
            ImportNrcsSnotel dlg = new ImportNrcsSnotel();

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                DB.SuspendTreeUpdates();
                for (int i = 0; i < dlg.SelectedSiteNumbers.Length; i++)
                {
                    var siteNumber = dlg.SelectedSiteNumbers[i];

                    for (int j = 0; j < dlg.SelectedParameters.Length; j++)
                    {
                        var parameter = dlg.SelectedParameters[j];
                        var s         = new NrcsSnotelSeries(siteNumber, parameter);
                        DB.AddSeries(s, CurrentFolder);
                    }
                }
                DB.ResumeTreeUpdates();
                DatabaseChanged();
            }
        }
예제 #5
0
        private void ReadDailyExternalData(DateTime t1, DateTime t2)
        {
            var pc = textBoxPcode.Text.Trim().ToLower();

            ExternalSource src = GetSourceType();

            switch (src)
            {
            case ExternalSource.USGS:
                UsgsDailyParameter usgsParm = FindUsgsParameter(pc);
                externalSeries = new UsgsDailyValueSeries(this.textBoxUsgs.Text.Trim(), usgsParm);
                break;

            case ExternalSource.OWRD:
                if (pc == "qd" || pc == "qj")
                {
                    externalSeries = new OwrdSeries(this.textBoxOwrd.Text.Trim(), OwrdSeries.OwrdDataSet.MDF, this.checkBoxProvisional.Checked);
                }
                else
                if (pc == "af")
                {
                    externalSeries = new OwrdSeries(this.textBoxOwrd.Text.Trim(), OwrdSeries.OwrdDataSet.Midnight_Volume, this.checkBoxProvisional.Checked);
                }
                else
                {
                    externalSeries = new Series();
                }
                break;

            case ExternalSource.IDACORP:
                externalSeries       = GetIdahoPowerSeries();
                externalSeries.Units = "cfs";
                break;

            case ExternalSource.nrcs:
                var    snotelSiteID    = NrcsSnotelSeries.LookupSiteID(textBoxSnotel.Text);
                string snotelParameter = NrcsSnotelSeries.SnotelParameterFromHydrometPcode(pc);
                externalSeries       = new NrcsSnotelSeries(snotelSiteID, snotelParameter);
                externalSeries.Units = "in";
                break;

            case ExternalSource.Idwr:
                externalSeries = new IDWRDailySeries(textBoxIdwr.Text.Trim());
                break;

            default:
                updateStatus("Invalid Data Source.  Missing data?", true);
                externalSeries = new Series("", TimeInterval.Daily);
                return;
            }

            externalSeries.Read(t1, t2);

            // convert units if needed
            if (externalSeries.Units == "degrees Celsius")
            {
                externalSeries.Units = "degrees C";
            }

            if (externalSeries.Units == "degrees C")
            {
                Reclamation.TimeSeries.Math.ConvertUnits(externalSeries, "degrees F");
            }

            externalSeries.Appearance.LegendText = GetSourceType().ToString() + " " + externalSeries.Name;
        }
예제 #6
0
        private void AddNrcsSnotel(object sender, EventArgs e)
        {
            ImportNrcsSnotel dlg = new ImportNrcsSnotel();
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                DB.SuspendTreeUpdates();
                for (int i = 0; i < dlg.SelectedSiteNumbers.Length; i++)
                {
                    var siteNumber = dlg.SelectedSiteNumbers[i];

                    for (int j = 0; j < dlg.SelectedParameters.Length; j++)
                    {
                        var parameter = dlg.SelectedParameters[j];
                        var s = new NrcsSnotelSeries(siteNumber, parameter);
                        DB.AddSeries(s, CurrentFolder);
                    }
                }
                DB.ResumeTreeUpdates();
                DatabaseChanged();
            }
        }