Ejemplo n.º 1
0
        public static UsgsDailyValueSeries Read(string site_no, UsgsDailyParameter parameter, DateTime t1, DateTime t2)
        {
            UsgsDailyValueSeries s = new UsgsDailyValueSeries(site_no, parameter);

            s.Read(t1, t2);
            return(s);
        }
Ejemplo n.º 2
0
        private static UsgsDailyParameter FindUsgsParameter(string pc)
        {
            UsgsDailyParameter rval = UsgsDailyParameter.DailyMeanDischarge;

            if (pc == "qd")
            {
                rval = UsgsDailyParameter.DailyMeanDischarge;
            }

            if (pc == "wi")
            {
                rval = UsgsDailyParameter.DailyMinTemperature;
            }
            if (pc == "wk")
            {
                rval = UsgsDailyParameter.DailyMaxTemperature;
            }
            if (pc == "wz")
            {
                rval = UsgsDailyParameter.DailyMeanTemperature;
            }


            return(rval);
        }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 4
0
        public UsgsDailyValueSeries(TimeSeriesDatabase db, TimeSeriesDatabaseDataSet.SeriesCatalogRow sr) : base(db, sr)
        {
            m_parameter = UsgsDailyParameter.DailyMeanDischarge;
            string str = ConnectionStringUtility.GetToken(ConnectionString, "UsgsDailyParameter", "");

            if (Enum.IsDefined(typeof(UsgsDailyParameter), str))
            {
                m_parameter = (UsgsDailyParameter)Enum.Parse(typeof(UsgsDailyParameter), str);
            }
            m_site_no = ConnectionStringUtility.GetToken(ConnectionString, "site_no", "");
        }
Ejemplo n.º 5
0
        public UsgsDailyValueSeries(string site_no, UsgsDailyParameter parameter)
        {
            site_no = site_no.Trim();
            if (site_no.Length == 7)
            {
                site_no = "0" + site_no;
            }

            this.SiteID      = site_no;
            m_site_no        = site_no;
            m_parameter      = parameter;
            m_columnName     = "";
            m_flagColumnName = "";
            Table.TableName  = "USGSDaily" + parameter.ToString() + "_" + site_no;
            ConnectionString = "Source=USGS;site_no=" + site_no + ";UsgsDailyParameter=" + parameter.ToString();
            TimeInterval     = TimeInterval.Daily;
            Source           = "USGS";
            Provider         = "UsgsDailyValueSeries";
        }
Ejemplo n.º 6
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;
        }