/// <summary> /// Crates Scenario based on scenaroName as xyfile name without extension (.xy) /// </summary> public override Series CreateScenario(TimeSeriesDatabaseDataSet.ScenarioRow scenario) { string fn = ConnectionStringUtility.GetFileName(scenario.Path, m_db.DataSource); if (fn == m_xyFilename) { return(this); } Logger.WriteLine("Reading series from: '" + fn + "'"); if (!File.Exists(fn)) { Logger.WriteLine("File not found: '" + fn + "'"); throw new FileNotFoundException(); //Logger.WriteLine("Error: Can't create scenario"); //return new Series(); } var rval = new ModsimSeries(fn, modsimName, timeSeriesName); rval.Name = this.Name; rval.Appearance.LegendText = scenario.Name + " " + Name; rval.ScenarioName = scenario.Name; rval.SiteID = this.SiteID; rval.TimeInterval = this.TimeInterval; return(rval); }
private void Init(TimeSeriesDatabase db) { m_fileName = ConnectionStringUtility.GetFileName(ConnectionString, db.DataSource); ScenarioName = Path.GetFileNameWithoutExtension(m_fileName); m_plantName = ConnectionStringUtility.GetToken(ConnectionString, "PlantName", ""); m_dataType = ConnectionStringUtility.GetToken(ConnectionString, "DataType", ""); }
/// <summary> /// Used to create ModsimSeries from TimeSeriesDatabase /// </summary> public ModsimSeries(TimeSeriesDatabase db, Reclamation.TimeSeries.TimeSeriesDatabaseDataSet.SeriesCatalogRow sr) : base(db, sr) { m_defaultUnits = Units; m_xyFilename = ConnectionStringUtility.GetFileName(ConnectionString, db.DataSource); m_mdbFilename = Path.ChangeExtension(m_xyFilename, null) + "OUTPUT.mdb"; m_accdbFilename = Path.ChangeExtension(m_xyFilename, null) + "OUTPUT.accdb"; if (File.Exists(m_accdbFilename)) { m_databaseName = m_accdbFilename; } else { m_databaseName = m_mdbFilename; } if (File.Exists(m_xyFilename)) { StreamReader srr = File.OpenText(m_xyFilename); string line1 = srr.ReadLine(); string[] line1Parts = line1.Split(' '); m_xyFileVersion = new Version(line1Parts[1]); srr.Close(); } else { Logger.WriteLine("Error: File missing " + m_xyFilename); } ScenarioName = Path.GetFileNameWithoutExtension(m_xyFilename); ExternalDataSource = true; modsimName = ConnectionStringToken("ModsimName"); timeSeriesName = ConnectionStringToken("TimeSeriesName"); ReadOnly = true; }
public override Series CreateScenario(TimeSeriesDatabaseDataSet.ScenarioRow scenario) { //string s = ConfigurationManager.AppSettings["scenarioList"]; string fn = ConnectionStringUtility.GetFileName(scenario.Path, m_db.Server.DataSource); // TO DO..update scenarioNumber if needed if (m_scenarioNumber >= 0 && m_db != null) { int idx = Array.IndexOf(m_db.GetScenarios().GetNames(), scenario.Name); m_scenarioNumber = idx + 1; } else { var path = Path.GetDirectoryName(fn); fn = Path.Combine(path, scenario.Name + ".rdf"); Logger.WriteLine("Reading series from " + fn); if (!File.Exists(fn)) { Logger.WriteLine("Error: Can't create scenario '" + scenario.Name + "'"); return(new Series()); } } var rval = new RiverWareSeries(fn, m_objectName, m_slotName, m_scenarioNumber, m_isSnapShot); rval.Appearance.LegendText = scenario.Name + " " + Name; rval.ScenarioName = scenario.Name; return(rval); }
private void Init(TimeSeriesDatabase db) { fileName = ConnectionStringUtility.GetFileName(ConnectionString, db.DataSource); ScenarioName = Path.GetFileNameWithoutExtension(fileName); stationID = ConnectionStringUtility.GetToken(ConnectionString, "stationID", ""); varcode = ConnectionStringUtility.GetToken(ConnectionString, "varcode", ""); extra1 = ConnectionStringUtility.GetToken(ConnectionString, "extra1", ""); extra2 = ConnectionStringUtility.GetToken(ConnectionString, "extra2", ""); }
public override Series CreateScenario(TimeSeriesDatabaseDataSet.ScenarioRow scenario) { var s = new UrgwomSeries(ConnectionStringUtility.GetFileName(scenario.Path, m_db.DataSource), ConnectionStringUtility.GetToken(scenario.Path, "SheetName", ""), valueColumn); s.ScenarioName = scenario.Name; s.Name = ""; s.Appearance.LegendText = scenario.Name; return(s); }
public UrgwomSeries(TimeSeriesDatabase db, TimeSeriesDatabaseDataSet.SeriesCatalogRow sr) : base(db, sr) { TimeInterval = TimeSeries.TimeInterval.Daily; ExternalDataSource = true; ReadOnly = true; Provider = "UrgwomSeries"; ScenarioName = "ScenarioName"; xlsFilename = ConnectionStringUtility.GetFileName(ConnectionString, m_db.DataSource); sheetName = ConnectionStringToken("SheetName"); dateColumn = ConnectionStringToken("DateColumn"); valueColumn = ConnectionStringToken("ValueColumn"); }
/// <summary> /// Creates RiverWareSeries from TimeSeriesDatabase /// </summary> /// <param name="sdi"></param> /// <param name="db"></param> public RiverWareSeries(TimeSeriesDatabase db, TimeSeriesDatabaseDataSet.SeriesCatalogRow sr) : base(db, sr) { m_filename = ConnectionStringUtility.GetFileName(ConnectionString, m_db.DataSource); this.ExternalDataSource = true; m_objectName = ConnectionStringUtility.GetToken(ConnectionString, "ObjectName", ""); m_slotName = ConnectionStringUtility.GetToken(ConnectionString, "SlotName", ""); int.TryParse(ConnectionStringUtility.GetToken(ConnectionString, "ScenarioNumber", ""), out m_scenarioNumber); bool.TryParse(ConnectionStringUtility.GetToken(ConnectionString, "IsSnapShot", ""), out m_isSnapShot); InitTimeSeries(null, this.Units, this.TimeInterval, this.ReadOnly, false, true); ScenarioName = "Run " + m_scenarioNumber; Appearance.LegendText = Name; }
public override Series CreateScenario(TimeSeriesDatabaseDataSet.ScenarioRow scenario) { if (scenario.Name == ScenarioName) { return(this); } else { string fn = ConnectionStringUtility.GetFileName(scenario.Path, m_db.DataSource); Logger.WriteLine("Reading series from " + fn); var sr = m_db.GetNewSeriesRow(false); sr.ItemArray = SeriesCatalogRow.ItemArray; sr.ConnectionString = ConnectionStringUtility.Modify(sr.ConnectionString, "FileName", fn); Series s = new HydrossSeries(m_db, sr); s.ReadOnly = true; s.ScenarioName = scenario.Name; return(s); } }
private string GetScenarioFileName(TimeSeriesDatabaseDataSet.ScenarioRow scenario) { var rval = m_filename; var pathFileName = ConnectionStringUtility.GetFileName(scenario.Path, m_db.Server.DataSource); if (File.Exists(pathFileName)) // filename specified in path { rval = pathFileName; } else { // derive filename from ScenarioName var path = Path.GetDirectoryName(m_filename); var x = Path.Combine(path, scenario.Name + ".rdf"); if (File.Exists(x)) { rval = x; } } return(rval); }
private void Init(TimeSeriesDatabase db) { fileName = ConnectionStringUtility.GetFileName(ConnectionString, db.DataSource); ScenarioName = Path.GetFileNameWithoutExtension(fileName); }