Пример #1
0
 private void AddRows(TimeSeriesDatabaseDataSet.SeriesCatalogDataTable tbl)
 {
     foreach (var item in tbl)
     {
         var r = m_seriesCatalog.NewSeriesCatalogRow();
         r.ItemArray = item.ItemArray;
         m_seriesCatalog.AddSeriesCatalogRow(r);
     }
 }
Пример #2
0
        private void CreateSeriesAF(AccessDB mdb, string plantName, string dataType, int parentID)
        {
            string units     = "acre-feet";
            string name      = plantName + " " + dataType + " " + units;
            string sheetName = plantName + " " + dataType;
            string cs        = "FileName=" + m_mdbFileName + ";PlantName=" + plantName + ";DataType=" + dataType; // connection string

            cs = ConnectionStringUtility.MakeFileNameRelative(cs, m_databasePath);
            seriesCatalog.AddSeriesCatalogRow(ID++, parentID, false, ID, "BpaHydsimSeriesAccess", name, sheetName, units,
                                              TimeInterval.Monthly.ToString(), "Parameter", "", "BpaHydsimSeriesAccess", cs, "", "", true);
        }
Пример #3
0
        /// <summary>
        /// Creates table that can be
        /// appended to the SeriesCatalog in Pisces
        /// </summary>
        /// <returns></returns>
        public static TimeSeriesDatabaseDataSet.SeriesCatalogDataTable PiscesSeriesCatalog(int model_id,
                                                                                           string m_table,   // model table i.e. m_month, m_day,...
                                                                                           DateTime t,       // consider model runs after this date
                                                                                           int nextPiscesID, // next avaliable id in Pisces
                                                                                           int parentID)     // container for this model
        {                                                                                                    // get unique list of site_datatype_id -- based on these parameters
            var       rval = new TimeSeriesDatabaseDataSet.SeriesCatalogDataTable();
            DataTable sitesAndParameters = Hdb.Instance.ModelParameterList(t, model_id, m_table);
            DataTable siteList           = DataTableUtility.SelectDistinct(sitesAndParameters, "Site_ID");
            int       model_run_id       = -1;
            string    model_run_name     = "";
            string    run_date           = "";

            Hdb.Instance.FirstModelRunInfo(t, model_id, out model_run_id, out model_run_name, out run_date);
            //string scenarioName =  "";// "(" + model_run_id + ")";

            for (int i = 0; i < siteList.Rows.Count; i++)
            {
                int       site_id   = Convert.ToInt32(siteList.Rows[i]["site_id"]);
                DataRow[] rows      = sitesAndParameters.Select("Site_ID=" + site_id);
                int       siteRowID = nextPiscesID++;
                rval.AddSeriesCatalogRow(siteRowID, parentID, true, 1, "HdbModel",
                                         rows[0]["site_name"].ToString(), "", "", "", "", "", "", "", "", "", true);

                for (int j = 0; j < rows.Length; j++)
                {
                    string cs = HdbModelSeries.BuildConnectionString(m_table, model_run_id.ToString(), model_run_name, run_date, rows[j]["site_datatype_id"].ToString());
                    rval.AddSeriesCatalogRow(nextPiscesID++, siteRowID, false, j,
                                             "HdbModel", rows[j]["datatype_common_name"].ToString(),
                                             rows[j]["site_name"].ToString(),
                                             rows[j]["unit_common_name"].ToString(),
                                             IntervalString(m_table),
                                             rows[j]["datatype_common_name"].ToString(),
                                             "", "HdbModelSeries", cs, "", "", true);
                }
            }
            return(rval);
        }
Пример #4
0
        private static void LoadUpperSnakeHydromet(TimeSeriesDatabaseDataSet.SeriesCatalogDataTable sc_vm)
        {
            // load hydromet/upper snake
            var lines = upperSnakeDaily.Split('\n');

            foreach (var item in lines)
            {
                var                 tokens   = item.Trim().Split(' ', '\t');
                var                 cbtt     = tokens[0].Trim().ToLower();
                var                 pcode    = tokens[1].Trim().ToLower();
                string[]            path     = { "water.usbr.gov", "pn", "hydromet", cbtt, "daily" };
                var                 folderID = sc_vm.GetOrCreateFolder(path);
                HydrometDailySeries s        = new HydrometDailySeries(cbtt, pcode);
                s.SiteID    = cbtt;
                s.Parameter = HydrometInfoUtility.LookupDailyParameterName(pcode);
                sc_vm.AddSeriesCatalogRow(s, sc_vm.NextID(), folderID, "pnhydromet_" + s.Table.TableName);
            }
        }