/// <summary> /// Gets the queried series and generates simple text output /// </summary> /// <param name="query"></param> /// <returns></returns> private void WriteSeries(SeriesList list) { m_formatter.WriteSeriesHeader(list); int daysStored = 30; if (m_formatter.Interval == TimeInterval.Daily) daysStored = 3650; // 10 years if (m_formatter.Interval == TimeInterval.Monthly) daysStored = 36500; TimeRange timeRange = new TimeRange(start, end); foreach (TimeRange item in timeRange.Split(daysStored)) { var interval = m_formatter.Interval; var tbl = Read(list, item.StartDate, item.EndDate, interval,m_formatter.OrderByDate); m_formatter.PrintDataTable(list, tbl); } m_formatter.WriteSeriesTrailer(); }
/// <summary> /// Imports instant data from Hydromet into TimeSeriesDatabase /// </summary> /// <param name="db"></param> private static void ImportHydrometInstant(TimeSeriesDatabase db,DateTime start, DateTime end, string filter,string propertyFilter) { // TO DO.. the outer loop of Date ranges (t,t3) could // be generated as a separate task. Console.WriteLine("ImportHydrometInstant"); TimeRange timeRange = new TimeRange(start, end); foreach (TimeRange item in timeRange.Split(30)) { int block = 1; foreach (string query in GetBlockOfQueries(db, TimeInterval.Irregular, filter, propertyFilter)) { Console.WriteLine("Reading " + item.StartDate + " to " + item.EndDate); var table = HydrometDataUtility.DayFilesTable(HydrometHost.PN, query, item.StartDate, item.EndDate, 0); Console.WriteLine("Block " + block + " has " + table.Rows.Count + " rows "); Console.WriteLine(query); SaveTableToSeries(db, table, TimeInterval.Irregular); block++; } } Console.WriteLine("Finished importing 15-minute data"); }