/// <summary> /// Returns and empty timeseries_hourly table for storing blobs /// </summary> /// <param name="server"></param> /// <returns></returns> static DataTable GetBlobTable(Reclamation.Core.BasicDBServer server) { string sql = SqLiteEnsembleWriter.GetCreateTableSQL(TableName); server.RunSqlCommand(sql); //server.RunSqlCommand("DELETE from " + TableName); return(server.Table(TableName, "select * from " + TableName + " where 1=0")); }
//static string DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; public static void Write(string filename, Watershed watershed, bool compress = false, bool createPiscesDB = false) { using (SqLiteEnsembleWriter server = new SqLiteEnsembleWriter(filename)) { int index = server.MaxID(); byte[] uncompressed = null; Reclamation.TimeSeries.TimeSeriesDatabase db; foreach (Location loc in watershed.Locations) { foreach (Forecast f in loc.Forecasts) { index++; server.InsertEnsemble(index, f.IssueDate, watershed.Name, loc.Name, f.TimeStamps[0], f.Ensemble.GetLength(1), f.Ensemble.GetLength(0), compress, ConvertToBytes(f.Ensemble, compress, ref uncompressed)); } } } }