Example #1
0
        private static string EstimateProgramName(TimeSeriesDatabaseDataSet.sitecatalogDataTable siteCatalog, Series s)
        {
            var program = s.Properties.Get("program");

            if (program == "")
            {
                // Console.WriteLine("program not defined: " + tn.GetTableName());
                // try site name
                var site = siteCatalog.FindBysiteid(s.SiteID);

                if (site == null)
                {
                    Console.WriteLine("Null site " + s.SiteID);
                    return("");
                }

                if (site.type == "" || site.type == "hydromet" || site.type == "reservoir" || site.type == "weather station")
                {
                    program = "hydromet";
                }
                if (site.type == "agrimet")
                {
                    program = "agrimet";
                }
            }
            return(program);
        }
Example #2
0
        private static void UpdateGPSiteInfo(TimeSeriesDatabaseDataSet.sitecatalogDataTable sc)
        {
            Console.WriteLine("reading gp excel");
            var fn  = @"U:\water.usbr.gov\data\GPsitesTESSELAPP_kt.xlsx";
            var xls = new NpoiExcel(fn);
            var tbl = xls.ReadDataTable(0);

            //var tbl = ExcelDB.Read(fn, 0);

            for (int i = 0; i < tbl.Rows.Count; i++)
            {
                var desc  = tbl.Rows[i]["Description"].ToString();
                var lat   = tbl.Rows[i]["Latitude"].ToString().Trim();
                var lon   = tbl.Rows[i]["Longitude"].ToString().Trim();
                var state = tbl.Rows[i]["State"].ToString().Trim();
                if (lon[0] != '-')
                {
                    lon = "-" + lon;
                }
                //var office = tbl.Rows[i]["office"].ToString();
                var siteid   = tbl.Rows[i]["Site Name"].ToString().ToLower().Trim();
                var siteType = tbl.Rows[i]["type"].ToString().ToLower().Trim();


                var siteRow = sc.FindBysiteid(siteid);

                if (siteRow == null)
                {
                    Console.WriteLine("new site : " + siteid);
                    siteRow        = sc.NewsitecatalogRow();
                    siteRow.siteid = siteid;
                    sc.AddsitecatalogRow(siteRow);
                }
                else
                {
                    Console.WriteLine("existing site : " + siteRow.siteid);
                }

                siteRow.description = desc;
                siteRow.state       = state;
                siteRow.latitude    = lat;
                siteRow.longitude   = lon;
                //siteRow.responsibility = office;
                siteRow.type          = siteType;
                siteRow.agency_region = "GP";
            }
        }
Example #3
0
        private void textBoxSiteID_TextChanged(object sender, EventArgs e)
        {
            if (textBoxdescription.Text.Trim() == "" && textBoxSiteID.Text.Trim().Length > 2)
            {
                if (m_siteCatalog == null)
                {
                    m_siteCatalog = m_db.GetSiteCatalog();
                }

                m_siteRow = m_siteCatalog.FindBysiteid(textBoxSiteID.Text.Trim());
                if (m_siteRow != null)
                {
                    this.textBoxdescription.Text = m_siteRow.description;
                    this.textBoxElevation.Text   = m_siteRow.elevation;
                    this.textBoxlatitude.Text    = m_siteRow.latitude;
                    this.textBoxlongitude.Text   = m_siteRow.longitude;
                    this.textBoxInstall.Text     = m_siteRow.install;
                    this.textBoxTimezone.Text    = m_siteRow.timezone;
                    this.textBoxState.Text       = m_siteRow.state;
                }
            }
        }