public static void CreatePiscesTree(string fileName, PiscesFolder root, TimeSeriesDatabase db) { mi = new Model(); s_db = db; sdi = db.NextSDI(); studyFolderID = sdi; int parentID = root.ID; seriesCatalog = new TimeSeriesDatabaseDataSet.SeriesCatalogDataTable(); if (File.Exists(fileName)) { XYFileReader.Read(mi, fileName); m_xyFilename = Path.GetFileNameWithoutExtension(fileName); } else { throw new FileNotFoundException("Modsim xy file is not found " + fileName); } string mdbJetName = Path.Combine(Path.GetDirectoryName(fileName), m_xyFilename + "OUTPUT.mdb"); string mdbAceName = Path.Combine(Path.GetDirectoryName(fileName), m_xyFilename + "OUTPUT.accdb"); if (File.Exists(mdbAceName)) { m_databaseName = mdbAceName; } else { m_databaseName = mdbJetName; } if (File.Exists(m_databaseName)) { m_db = new AccessDB(m_databaseName); dir = Path.GetDirectoryName(Path.GetFullPath(m_databaseName)); //AddNewRow(sdi,parentID,true, "", mi.name, ""); AddNewRow(sdi, parentID, true, "", Path.GetFileNameWithoutExtension(fileName), ""); ReservoirsTree(); DemandsTree(); RiverLinksTree(); TotalsTree(); } else { throw new FileNotFoundException(" MODSIM output not found " + m_databaseName); } //DataTableOutput.Write(seriesCatalog, @"C:\temp\a.csv",false); db.Server.SaveTable(seriesCatalog); db.RefreshFolder(root); }
public static void CreatePiscesTree(string fileName, PiscesFolder root, TimeSeriesDatabase db) { mi = new Model(); s_db = db; sdi = db.NextSDI(); studyFolderID = sdi; int parentID = root.ID; seriesCatalog = new TimeSeriesDatabaseDataSet.SeriesCatalogDataTable(); if (File.Exists(fileName)) { XYFileReader.Read(mi, fileName); m_xyFilename = Path.GetFileNameWithoutExtension(fileName); } else { throw new FileNotFoundException("Modsim xy file is not found " + fileName); } string mdbJetName = Path.Combine(Path.GetDirectoryName(fileName), m_xyFilename + "OUTPUT.mdb"); string mdbAceName = Path.Combine(Path.GetDirectoryName(fileName), m_xyFilename + "OUTPUT.accdb"); if (File.Exists(mdbAceName)) { m_databaseName = mdbAceName; } else m_databaseName = mdbJetName; if (File.Exists(m_databaseName)) { m_db = new AccessDB(m_databaseName); dir = Path.GetDirectoryName(Path.GetFullPath(m_databaseName)); //AddNewRow(sdi,parentID,true, "", mi.name, ""); AddNewRow(sdi, parentID, true, "", Path.GetFileNameWithoutExtension(fileName), ""); ReservoirsTree(); DemandsTree(); RiverLinksTree(); TotalsTree(); } else { throw new FileNotFoundException(" MODSIM output not found " + m_databaseName); } //DataTableOutput.Write(seriesCatalog, @"C:\temp\a.csv",false); db.Server.SaveTable(seriesCatalog); db.RefreshFolder(root); }
/// <summary> /// Converts from modsim Series Type to Karls TimeSeries.SeriesType /// </summary> internal static Reclamation.TimeSeries.TimeInterval GetSeriesType(Csu.Modsim.ModsimModel.Model mi) { Reclamation.TimeSeries.TimeInterval type = Reclamation.TimeSeries.TimeInterval.Monthly; // this is not exactly right. This could be specific for each series. if (mi.timeStep.TSType == Csu.Modsim.ModsimModel.ModsimTimeStepType.Daily) { type = Reclamation.TimeSeries.TimeInterval.Daily; } else if (mi.timeStep.TSType == Csu.Modsim.ModsimModel.ModsimTimeStepType.Monthly) { type = Reclamation.TimeSeries.TimeInterval.Monthly; } else if (mi.timeStep.TSType == Csu.Modsim.ModsimModel.ModsimTimeStepType.Weekly) { type = Reclamation.TimeSeries.TimeInterval.Weekly; } return(type); }