public static IEnumerable <TimeSeries> GetTimeSeries(IRange DateTimes, IRange Values, string Apart, string Bpart, string Cpart, string Dpart, string Epart, string Fpart) { var l = new List <TimeSeries>(); var c = Values.ColumnCount; for (int i = 0; i < c; i++) { var ts = new TimeSeries(); ts.Times = RangeToDateTimes(DateTimes); ts.Values = RangeToTimeSeriesValues(Values, i); if (CheckTimeSeriesType(ts.Times) == RecordType.RegularTimeSeries) { ts.Path = new DssPath(Apart, Bpart, Cpart, "", "", "r" + (i + 1).ToString() + Fpart, RecordType.RegularTimeSeries, "type", "units"); ts.Path.Epart = TimeWindow.GetInterval(ts); } else { ts.Path = new DssPath(Apart, Bpart, Cpart, "", "IR-Year", "r" + (i + 1).ToString() + Fpart, RecordType.IrregularTimeSeries, "type", "units"); } l.Add(ts); } return(l); }
private void GetPath(TimeSeries ts, string worksheet, int column, PathLayout pathLayout) { ts.Path = new DssPath(); if (pathLayout == PathLayout.StandardPath) { ts.Path.Apart = CellToString(workbook.Worksheets[worksheet].Cells[0, column]); ts.Path.Bpart = CellToString(workbook.Worksheets[worksheet].Cells[1, column]); ts.Path.Cpart = CellToString(workbook.Worksheets[worksheet].Cells[2, column]); ts.Path.Fpart = CellToString(workbook.Worksheets[worksheet].Cells[5, column]); } else if (pathLayout == PathLayout.PathWithoutDPart) { ts.Path.Apart = CellToString(workbook.Worksheets[worksheet].Cells[0, column]); ts.Path.Bpart = CellToString(workbook.Worksheets[worksheet].Cells[1, column]); ts.Path.Cpart = CellToString(workbook.Worksheets[worksheet].Cells[2, column]); ts.Path.Fpart = CellToString(workbook.Worksheets[worksheet].Cells[4, column]); } if (IsRegular(ts.Times.ToList())) { ts.Path.Epart = TimeWindow.GetInterval(ts); } else { ts.Path.Epart = "IR-Year"; } }
public void TimeIntervalMethodTest() { DssPath path = new DssPath("/MISSISSIPPI/ST. LOUIS/FLOW//1Day/OBS/"); using (DssReader r = new DssReader(TestUtility.BasePath + "sample7.dss")) { var s = TimeWindow.GetInterval(r.GetTimeSeries(path)); Debug.WriteLine(s); } }
private void ImportRegularTimeSeries(string destination, string worksheet) { string fileName = destination; File.Delete(fileName); TimeSeries ts = GetTimeSeries(worksheet); ts.Path = new DssPath("excel", "import", "plugin", "", "", "regularTimeSeries" + RandomString(3)); ts.Path.Epart = TimeWindow.GetInterval(ts); using (DssWriter w = new DssWriter(fileName)) { w.Write(ts); } }
private DssPath GetRandomTimeSeriesPath(TimeSeries ts, string worksheet) { if (IsRegular(ts.Times.ToList())) { var temp = ts; temp.Path = new DssPath("import", Path.GetFileNameWithoutExtension(workbook.FullName), worksheet, "", "", "regularTimeSeries" + ExcelTools.RandomString(3)); temp.Path.Epart = TimeWindow.GetInterval(temp); return(temp.Path); } else { return(new DssPath("import", Path.GetFileNameWithoutExtension(workbook.FullName), worksheet, "", "IR-Year", "irregularTimeSeries" + ExcelTools.RandomString(3))); } }