本文整理汇总了C#中Series.Lookup方法的典型用法代码示例。如果您正苦于以下问题:C# Series.Lookup方法的具体用法?C# Series.Lookup怎么用?C# Series.Lookup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Series
的用法示例。
在下文中一共展示了Series.Lookup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddToEmpty
public void AddToEmpty()
{
Series s1 = new Series();
Series s2 = new Series();
DateTime t = new DateTime(2006, 7, 11);
Series s3 = AddTwoSeriesWithDifferentLengths(s1, s2, ref t);
Assert.AreEqual(s3.Count, s1.Count);
t = new DateTime(2006, 7, 11);
for (int i = 0; i < 10; i++)
{
Console.WriteLine(t);
bool missing = true;
if (i > 5 && i < 8)
missing = false;
Assert.AreEqual(s3[i].IsMissing,missing);
if (!missing)
{
Assert.AreEqual(s1.Lookup(t) + s2.Lookup(t),3 );
}
t = t.AddDays(1);
}
}
示例2: RMSEGenerateMatchList
/// <summary>
/// This builds a series with the dates from the target series and values that represent the year wherein
/// the source series has the minimum moving 3-month RMSE
/// </summary>
/// <param name="SSmonthTot">Source monthly series</param>
/// <param name="TSmonthTot">Target monthly series</param>
/// <returns></returns>
private static Series RMSEGenerateMatchList(Series SSmonthTot, Series TSmonthTot)
{
// Series to keep track of the corresponding year with the minimum RMSe
Series TSrms = new Series();
// For loop to generate corresponding month-year from Source with minimum 3 month RMSe
for (int targetYear = TSmonthTot.MinDateTime.Year; targetYear <= TSmonthTot.MaxDateTime.Year; targetYear++)
{
for (int ithMonth = 1; ithMonth <= 12; ithMonth++)// i is the month for calculation evaluation
{
// only estimate data for dates which are in the TS
DateTime tTarg = new DateTime(targetYear, ithMonth, DateTime.DaysInMonth(targetYear, ithMonth));
if (tTarg >= TSmonthTot.MinDateTime && tTarg <= TSmonthTot.MaxDateTime)
{
var RMSList = new List<double>();
var RMSYear = new List<int>();
for (int sourceYear = SSmonthTot.MinDateTime.Year; sourceYear < SSmonthTot.MaxDateTime.Year; sourceYear++)
{
DateTime tSour = new DateTime(sourceYear, ithMonth, DateTime.DaysInMonth(sourceYear, ithMonth));
if (tSour < SSmonthTot.MinDateTime) // makes sure that empty dailies before the daily record starts are not used
{
sourceYear++;
tSour = new DateTime(sourceYear, ithMonth, DateTime.DaysInMonth(sourceYear, ithMonth));
}
// RMSe calculation
double mon1 = getRMS(SSmonthTot.Lookup(tSour.AddMonths(-1)), TSmonthTot.Lookup(tTarg.AddMonths(-1)));
double mon2 = getRMS(SSmonthTot.Lookup(tSour.AddMonths(0)), TSmonthTot.Lookup(tTarg.AddMonths(0)));
// Sets mon3 value for the last month since there is no value for t.AddMonths(1)
double mon3;
if (tTarg == TSmonthTot.MaxDateTime)
{ mon3 = 0.0; }
else
{ mon3 = getRMS(SSmonthTot.Lookup(tSour.AddMonths(1)), TSmonthTot.Lookup(tTarg.AddMonths(1))); }
double RMSi = System.Math.Sqrt((mon1 + mon2 + mon3) / 3);
RMSList.Add(RMSi);
RMSYear.Add(sourceYear);
}
var RMSmin = RMSList.Min();
var RMSminYear = RMSYear[RMSList.IndexOf(RMSmin)];
TSrms.Add(tTarg, Convert.ToDouble(RMSminYear));
}
}
}
return TSrms;
}