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); }
private static void SetRegioninSiteTable(TimeSeriesDatabase db, TimeSeriesDatabaseDataSet.sitecatalogDataTable sites) { var sc = db.GetSeriesCatalog("isfolder=0"); for (int i = 0; i < sites.Rows.Count; i++) { var siteid = sites[i].siteid; var rows = sc.Select("connectionString like 'server=PN;cbtt=" + siteid + ";%'"); if (rows.Length > 0 && sites[i].agency_region == "") { sites[i].agency_region = "PN"; } rows = sc.Select("connectionString like 'server=LCHDB2%' and siteid ='" + siteid + "'"); if (rows.Length > 0 && sites[i].agency_region == "") { sites[i].agency_region = "LC"; } rows = sc.Select("connectionString like 'server=UCHDB2%' and siteid ='" + siteid + "'"); if (rows.Length > 0 && sites[i].agency_region == "") { sites[i].agency_region = "UC"; } } }
public FormNewMeasurment(TimeSeriesDatabaseDataSet.sitecatalogDataTable siteCatalog) { InitializeComponent(); buttonSave.Enabled = false; m_siteCatalog = siteCatalog; Prepare(); this.Text = "Input New Measurement"; }
internal static bool IsAgrimetSite(string cbtt) { if (s_sites == null) { s_sites = s_db.GetSiteCatalog("type = 'agrimet'"); } return(s_sites.Select("siteid = '" + cbtt + "'").Length > 0); }
public FormNewMeasurment( TimeSeriesDatabaseDataSet.sitecatalogDataTable siteCatalog) { InitializeComponent(); buttonSave.Enabled = false; m_siteCatalog = siteCatalog; Prepare(); this.Text="Input New Measurement"; }
private void Setup() { m_sites = m_db.GetSiteCatalog(); this.comboBox1.DataSource = m_sites; this.comboBox1.DisplayMember = "siteid"; this.comboBox1.ValueMember = "siteid"; comboBox1.SelectedValue = "boii"; m_seriesCatalog = new TimeSeriesDatabaseDataSet.SeriesCatalogDataTable(); }
private static bool KeepThisSeries(TimeSeriesDatabaseDataSet.sitecatalogDataTable sitecatalog, string siteid, string pcode, string years) { HydrometMonthlySeries m = new HydrometMonthlySeries(siteid, pcode, HydrometHost.PN); var goodYears = Regex.IsMatch(years, "20[0-9]{2}"); var rows = sitecatalog.Select("siteid='" + siteid + "'"); if (rows.Length == 0 && m.Name != "") { //Console.WriteLine("siteid could be added to catalog:'"+siteid+"' "+m.Name); } return(rows.Length == 1 && goodYears); }
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"; } }
private void Setup() { m_sites = m_db.GetSiteCatalog(); this.comboBox1.DataSource = m_sites; this.comboBox1.DisplayMember = "siteid"; this.comboBox1.ValueMember = "siteid"; comboBox1.SelectedValue = "boii"; m_seriesCatalog = new TimeSeriesDatabaseDataSet.SeriesCatalogDataTable(); properties.Columns.Add("name"); properties.Columns.Add("value"); //properties.Rows.Add("program", "hydromet"); //properties.Rows.Add("basin", "yakima"); dataGridViewProperties.DataSource = properties; }
private void SetupComboBox() { comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend; comboBox1.AutoCompleteSource = AutoCompleteSource.ListItems; m_props = m_db.GetSiteProperties(); m_sites = m_db.GetSiteCatalog(); var temp = m_sites.Copy(); // copy for the combo box (selection only) for (int i = 0; i < temp.Rows.Count; i++) { var r = temp.Rows[i]; r["description"] = r["siteid"].ToString().ToUpper() + " " + r["description"].ToString(); } comboBox1.DataSource = temp; comboBox1.ValueMember = "siteid"; comboBox1.DisplayMember = "description"; }
public SiteMetaData(TimeSeriesDatabase db) { m_db = db; InitializeComponent(); comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend; comboBox1.AutoCompleteSource = AutoCompleteSource.ListItems; m_props = db.GetSiteProperties(); m_sites = db.GetSiteCatalog(); var temp = m_sites.Copy(); // copy for the combo box (selection only) for (int i = 0; i < temp.Rows.Count; i++) { var r = temp.Rows[i]; r["description"] = r["siteid"].ToString().ToUpper() + " " + r["description"].ToString(); } comboBox1.DataSource = temp; comboBox1.ValueMember = "description"; comboBox1.DisplayMember = "description"; }
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; } } }
public SiteMetaData(TimeSeriesDatabase db) { m_db = db; InitializeComponent(); comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend; comboBox1.AutoCompleteSource = AutoCompleteSource.ListItems; m_props = db.GetSiteProperties(); m_sites = db.GetSiteCatalog(); var temp = m_sites.Copy(); // copy for the combo box (selection only) for (int i = 0; i < temp.Rows.Count; i++) { var r = temp.Rows[i]; r["description"] = r["siteid"].ToString().ToUpper() + " " + r["description"].ToString(); } comboBox1.DataSource = temp; comboBox1.ValueMember = "description"; comboBox1.DisplayMember = "description"; }
private void Setup() { m_sites = m_db.GetSiteCatalog(); this.comboBox1.DataSource = m_sites; this.comboBox1.DisplayMember = "siteid"; this.comboBox1.ValueMember = "siteid"; comboBox1.SelectedValue = "boii"; m_seriesCatalog = new TimeSeriesDatabaseDataSet.SeriesCatalogDataTable(); }
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.ToString(); this.textBoxlatitude.Text = m_siteRow.latitude.ToString(); this.textBoxlongitude.Text = m_siteRow.longitude.ToString(); this.textBoxInstall.Text = m_siteRow.install; this.textBoxTimezone.Text = m_siteRow.timezone; this.textBoxState.Text = m_siteRow.state; } } }
public EquationTemplates(TimeSeriesDatabase db, string outputFileName) { m_db = db; m_sites = m_db.GetSiteCatalog(); sw = new StreamWriter(outputFileName); }
public DailyCalcGenerator(TimeSeriesDatabase db, string outputFileName) { m_db = db; m_sites = m_db.GetSiteCatalog(); sw = new StreamWriter(outputFileName); }
private static void InsertMontanaSitesFromJsonToPisces(FeatureCollection collection, TimeSeriesDatabaseDataSet.sitecatalogDataTable sc) { // insert montana sites into pisces for (int i = 0; i < collection.Features.Count; i++) { Feature item = collection.Features[i]; if (item.Properties["title"].ToString().IndexOf(" MT ") < 0) { continue; } var rows = sc.Select("siteid = '" + item.Id.ToLower() + "'"); if (rows.Length == 0) // not in Pisces { Console.WriteLine(item.Id + " not found in Pisces"); // put it Pisces. var desc = item.Properties["title"].ToString(); var pt = item.Geometry as GeoJSON.Net.Geometry.Point; var pos = pt.Coordinates as GeoJSON.Net.Geometry.GeographicPosition; var lat = pos.Latitude.ToString(); var lo = pos.Longitude.ToString(); //sc.AddsitecatalogRow(item.Id.ToLower(), desc, "MT", lat, lo, "", "US/Mountain", "", "", "", 0, "usbr_map.json", "", "", "agrimet", "great_plains"); } } }