Пример #1
0
        public static UsgsRealTimeSeries Read(string site_no, UsgsRealTimeParameter parameter, DateTime t1, DateTime t2)
        {
            var s = new UsgsRealTimeSeries(site_no, parameter);

            s.ReadCore(t1, t2);
            return(s);
        }
Пример #2
0
        /// <summary>
        /// Read Published 15-min stream flow values.
        /// gets data between dates specified.
        /// </summary>
        /// <param name="t1">beginning DateTime</param>
        /// <param name="t2">ending DateTime</param>
        protected override void ReadCore(DateTime t1, DateTime t2)
        {
            if (t2 >= DateTime.Now.Date)
            { // don't waste time looking to the future
                t2 = DateTime.Now.Date;
            }
            if (m_db != null)
            {
                if (Utility.AutoUpdate)
                {
                    base.UpdateCore(t1, t2, true);
                }
                base.ReadCore(t1, t2);
            }
            else
            {
                string url = m_url;
                url = url.Replace("sites=14354200", "sites=" + SiteID);
                url = url.Replace("startDT=2012-05-01", "startDT=" + t1.Year + "-" + t1.Month + "-" + t1.Day);
                url = url.Replace("endDT=2012-05-01", "endDT=" + t2.Year + "-" + t2.Month + "-" + t2.Day);
                UsgsRealTimeParameter parameter = (UsgsRealTimeParameter)Enum.Parse(typeof(UsgsRealTimeParameter), Parameter);
                int paramCode = (int)parameter;
                url = url.Replace("parameterCd=00060", "parameterCd=000" + paramCode);

                Messages.Add(url);
                ReadSeriesData(url);
            }
        }
Пример #3
0
 public UsgsRealTimeSeries(TimeSeriesDatabase db,Reclamation.TimeSeries.TimeSeriesDatabaseDataSet.SeriesCatalogRow sr)
     : base(db,sr)
 {
     var p = ConnectionStringUtility.GetToken(ConnectionString,"UsgsParameter","");
     m_parameter = (UsgsRealTimeParameter)Enum.Parse(typeof(UsgsRealTimeParameter), p);
     m_site_no = ConnectionStringToken( "site_no");
 }
Пример #4
0
        public UsgsRealTimeSeries(TimeSeriesDatabase db, Reclamation.TimeSeries.TimeSeriesDatabaseDataSet.SeriesCatalogRow sr)
            : base(db, sr)
        {
            var p = ConnectionStringUtility.GetToken(ConnectionString, "UsgsParameter", "");

            m_parameter = (UsgsRealTimeParameter)Enum.Parse(typeof(UsgsRealTimeParameter), p);
            m_site_no   = ConnectionStringToken("site_no");
        }
Пример #5
0
        public void TestRealTime()
        {
            string site_no = "13069500"; // / SNAKE RIVER NR BLACKFOOT ID
            UsgsRealTimeParameter parameter = UsgsRealTimeParameter.Discharge;
            UsgsRealTimeSeries    s         = new UsgsRealTimeSeries(site_no, parameter);

            s.Read(new DateTime(2011, 1, 12), new DateTime(2011, 1, 13));
            Assert.AreEqual(192, s.Count);
            Assert.AreEqual(2240, s[0].Value);
        }
Пример #6
0
        public static SeriesList GetSeries(string[] sites, UsgsRealTimeParameter parameter)
        {
            SeriesList rval = new SeriesList();
            foreach (string site in sites)
            {
                UsgsRealTimeSeries s = new UsgsRealTimeSeries(site, parameter);
                rval.Add(s);
            }

            return rval;
        }
Пример #7
0
        public static SeriesList GetSeries(string[] sites, UsgsRealTimeParameter parameter)
        {
            SeriesList rval = new SeriesList();

            foreach (string site in sites)
            {
                UsgsRealTimeSeries s = new UsgsRealTimeSeries(site, parameter);
                rval.Add(s);
            }

            return(rval);
        }
Пример #8
0
 public UsgsRealTimeSeries(string site_no, UsgsRealTimeParameter parameter)
 {
     TimeInterval     = TimeSeries.TimeInterval.Irregular;
     this.SiteID      = site_no;
     this.Parameter   = parameter.ToString();
     m_site_no        = site_no;
     m_parameter      = parameter;
     m_columnName     = "";
     m_flagColumnName = "";
     Table.TableName  = "UsgsRealTime_" + parameter.ToString() + "_" + site_no;
     ConnectionString = "Source=USGS;site_no=" + site_no + ";UsgsParameter=" + parameter.ToString();
     Source           = "USGS";
     Provider         = "UsgsRealTimeSeries";
 }
Пример #9
0
 public UsgsRealTimeSeries(string site_no, UsgsRealTimeParameter parameter)
 {
     TimeInterval = TimeSeries.TimeInterval.Irregular;
     this.SiteID = site_no;
     this.Parameter = parameter.ToString();
     m_site_no = site_no;
     m_parameter = parameter;
     m_columnName = "";
     m_flagColumnName = "";
     Table.TableName = "UsgsRealTime_" + parameter.ToString() + "_" + site_no;
     ConnectionString = "Source=USGS;site_no=" + site_no+";UsgsParameter="+parameter.ToString();
     Source = "USGS";
     Provider = "UsgsRealTimeSeries";
 }
Пример #10
0
        /// <summary>
        /// Read Published 15-min stream flow values.
        /// gets last 10 days.
        /// </summary>
        protected override void ReadCore()
        {
            if (m_db != null)
            {
                base.ReadCore();
            }
            else
            {
                // not most efficient.. we are going for all parameters,
                // get last 10 days by default.
                string url = m_url;
                url = url.Replace("sites=14354200", "sites=" + SiteID);
                url = url.Replace("startDT=2012-05-01&endDT=2012-05-01", "period=P10D");
                UsgsRealTimeParameter parameter = (UsgsRealTimeParameter)Enum.Parse(typeof(UsgsRealTimeParameter), Parameter);
                int paramCode = (int)parameter;
                url = url.Replace("parameterCd=00060", "parameterCd=000" + paramCode);

                Messages.Add(url);
                ReadSeriesData(url);
            }
        }
Пример #11
0
 public static UsgsRealTimeSeries Read(string site_no, UsgsRealTimeParameter parameter, DateTime t1, DateTime t2)
 {
     var s = new UsgsRealTimeSeries(site_no, parameter);
     s.ReadCore(t1,t2);
     return s;
 }