public void UpdateTimeSeries(SimpleTimeSeries newTS) { var actual = FindTimeSeries(); actual.init(newTS.AsDate(newTS.StartDate), newTS.AsDate(newTS.EndDate), TimeStep.Daily); foreach (TimeSeriesEvent e in newTS.Events) { actual[newTS.AsDate(e.Date)] = e.Value; } }
public void ChangeInputTimeSeries(string variableName, SimpleTimeSeries newTimeSeries) { Log(String.Format("Updating time series for {0}", variableName)); VariableSummary summ = new VariableSummary( Enumerable.FirstOrDefault(Scenario.Network.FunctionManager.Variables, v => v.FullName == ("$" + variableName)), Scenario); summ.UpdateTimeSeries(newTimeSeries); }
public VariableSummary(AbstractFunctionVariable v, RiverSystemScenario scenario) { Scenario = scenario; Variable = v; Name = v.Name; FullName = v.FullName; ID = v.id; VariableType = v.GetType().Name; if (v is BilinearVariable) { VeneerSupported = false; } else if (v is ContextVariable) { VeneerSupported = false; } else if (v is ModelledVariable) { VeneerSupported = false; } else if (v is PatternVariable) { VeneerSupported = false; } else if (v is LinearVariable) { VeneerSupported = true; PiecewiseFunctionData = new SimplePiecewise(v as LinearVariable); PiecewiseFunction = String.Format("/variables/{0}/Piecewise", FullName.Replace("$", "")); } else if (v is TimeSeriesVariable) { VeneerSupported = true; var tsV = (TimeSeriesVariable)v; VeneerDebugInfo += kvp("DisplayName", tsV.DisplayName) + kvp("ResultUnit", tsV.ResultUnit.Name); TimeSeriesData = new SimpleTimeSeries(FindTimeSeries()); TimeSeries = String.Format("/variables/{0}/TimeSeries", FullName.Replace("$", "")); } }