本文整理汇总了C#中Series.Copy方法的典型用法代码示例。如果您正苦于以下问题:C# Series.Copy方法的具体用法?C# Series.Copy怎么用?C# Series.Copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Series
的用法示例。
在下文中一共展示了Series.Copy方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MonthlyToDailyConversion
public MonthlyToDailyConversion(Series observedDaily, Series monthly )
{
this.daily = observedDaily.Copy();
this.monthly = monthly;
MedianOnly = false;
FillMissingWithZero = true;
}
示例2: CipolettiWeir
public static Series CipolettiWeir(Series head, double length)
{
var s = new Series();
var h = head.Copy();
h.RemoveMissing(true);
s = Math.Pow(Math.Max(h, 0.0), 1.5) * length * 3.367;
return s;
}
示例3: GenericWeir
public static Series GenericWeir(Series head,double offset, double width_factor, double exponent)
{
double shift = Convert.ToDouble(head.Properties.Get("shift", "0"));
var s = new Series();
var h = head.Copy();
h.RemoveMissing(true);
h = h + offset + shift;
s = Math.Pow(Math.Max(h,0), exponent) * width_factor;
return s;
}
示例4: ConstantShift
public static Series ConstantShift(Series h)
{
double shift = Convert.ToDouble(h.Properties.Get("shift", "0"));
var rval = h.Copy();
rval.RemoveMissing();
rval = rval * 0.0;
rval = rval + shift;
return rval;
}
示例5: InterpolateWithStyle
public static Series InterpolateWithStyle(Series sReal, Series sEst, params string[] dates)
{
var dateArray = getDates(dates);
Series sOut = sEst.Copy();
for (int i = 0; i < dateArray.Count; i = i + 2)
{
DateTime t1 = dateArray[i];
DateTime t2 = dateArray[i + 1];
Series sOuti = InterpolateWithStyleMain(sReal, sOut, t1, t2);
sOut = Reclamation.TimeSeries.Math.Merge(sOuti, sOut);
double sum1 = sEst.Values.Sum();
double sum2 = sOut.Values.Sum();
Console.WriteLine("Date Range " + t1.ToShortDateString() + " - " + t2.ToShortDateString() + " Processed.");
Console.WriteLine("Flow Balance Check || Original Flow Sum:" + sum1 + " Interpolated Flow Sum: " + sum2);
}
// Label interpolated series
sOut.Name = sEst.Name + "_Interp";
sOut.Units = sEst.Units;
sOut.Provider = "Series";
return sOut;
}
示例6: Quality
public static Series Quality(Series s, double lowLimit, double highLimit)
{
Series rval = s.Copy();
for (int i = 0; i < rval.Count; i++)
{
Point pt = rval[i];
if (!pt.IsMissing)
{
//pt.Value += d;
rval[i] = pt;
}
}
///Here, we're going to take the bad data and make it good data
return rval;
}
示例7: RectangularContractedWeir
public static Series RectangularContractedWeir(Series head, double length)
{
var s = new Series();
var h = head.Copy();
h.RemoveMissing(true);
s = (h * -.2 + length) * 3.33 * Math.Pow(Math.Max(h, 0.0), 1.5);
return s;
}
示例8: VerifyWithMonthlyVolume
/// <summary>
/// verify if the monthly data agrees with estimated daily
/// adjust if we are not within 10%
/// adjust using simple conversion of monthly
/// </summary>
/// <param name="monthly"></param>
/// <param name="estimatedDaily">Series to be adjusted to match monthly</param>
private static void VerifyWithMonthlyVolume(Series monthly, Series estimatedDaily)
{
var est_af = estimatedDaily.Copy();
Math.Multiply(est_af, 1.98347);
var m_af = Math.MonthlySum(est_af);
var diff = (m_af - monthly) / m_af;
diff = Math.Abs(diff);
for (int i = 0; i < diff.Count; i++)
{
if (!monthly[i].IsMissing && diff[i].Value > .1) // 10% error
{ // proabaly zero value in exceedance lookup.
// use monthly value instead of estimated value.
DateTime t = monthly[i].DateTime;
double avgFlow = monthly[i].Value / 1.98347 / DateTime.DaysInMonth(t.Year, t.Month);
SetDailyValueForMonth(estimatedDaily, t.Year,t.Month, avgFlow,"monthly avg flow");
}
}
}
示例9: Compare
internal static Series Compare(Series series, double p, Func<double,double,double> f)
{
Series rval = series.Copy();
for (int i = 0; i < rval.Count; i++)
{
Point pt = rval[i];
var missing = new Point(pt.DateTime, Point.MissingValueFlag, PointFlag.Missing);
if (pt.IsMissing || Point.IsMissingValue(p))
{
pt = missing;
}
else
{
pt.Value = f(pt.Value,p);
}
rval[i] = pt;
}
return rval;
}
示例10: Subtract
/// <summary>
/// s - d
/// </summary>
/// <param name="s"></param>
/// <param name="d"></param>
/// <returns></returns>
internal static Series Subtract(Series s, double d)
{
Series rval = s.Copy();
for (int i = 0; i < rval.Count; i++)
{
Point pt = rval[i];
if (!pt.IsMissing)
{
pt.Value -= d;
rval[i] = pt;
}
}
return rval;
}
示例11: Shift
/// <summary>
/// Shift the series in time
/// for Daily series timeOffset represents days
/// for Monthly series timeOffset represntes months
/// </summary>
public static Series Shift(Series s, int timeOffset)
{
Series rval = s.Clone();
if (timeOffset == 0)
return s.Copy();
for (int i = 0; i < s.Count; i++)
{
Point pt = s[i];
pt.Flag = PointFlag.Edited;
if (s.TimeInterval == TimeInterval.Daily)
{
pt.DateTime = pt.DateTime.AddDays(timeOffset);
}
else if (s.TimeInterval == TimeInterval.Monthly)
{// maintain end of month or first of month
bool eom = pt.DateTime.EndOfMonth() == pt.DateTime;
bool fom = pt.DateTime.FirstOfMonth() == pt.DateTime;
pt.DateTime = pt.DateTime.AddMonths(timeOffset);
if (eom)
pt.DateTime = pt.DateTime.EndOfMonth();
if (fom)
pt.DateTime = pt.DateTime.FirstOfMonth();
}
else
{
throw new NotImplementedException("time offset not implemented for "+s.TimeInterval);
}
rval.Add(pt);
}
return rval;
}
示例12: RoutingWithLags
/// <summary>
/// Routes input series using lag coefficients
/// </summary>
/// <param name="s"></param>
/// <param name="lagCoefficients"></param>
public static Series RoutingWithLags(Series s, double[] lagCoefficients)
{
double[] result = new double[s.Count];
Series rval = s.Copy();
int sz = s.Count;
Math.Multiply(rval, 0);
Series.CopyAttributes(s, rval);
for (int i = 0; i < s.Count; i++)
{
double v = s[i].Value;
for (int j = 0; j < lagCoefficients.Length && i+j <sz; j++)
{
result[i + j] += v * lagCoefficients[j];
}
}
// put results back into Series format.
rval.Values = result;
return rval;
}
示例13: FillMissingWithZero
/// <summary>
/// Fills in missing data in the series with zeros.
/// adds rows if necessary
/// </summary>
/// <param name="series"></param>
/// <param name="t1"></param>
/// <param name="t2"></param>
public static Series FillMissingWithZero(Series s, DateTime t1, DateTime t2)
{
Series rval = s.Copy();
Logger.WriteLine("FillMissingWithZero("+rval.Name+")");
Logger.WriteLine("before fill s.Count=" + rval.Count);
if (rval.TimeInterval != TimeInterval.Daily && rval.TimeInterval != TimeInterval.Monthly
&& rval.TimeInterval != TimeInterval.Hourly)
{
Logger.WriteLine(rval.TimeInterval.ToString() + " not supported in FillMissingWithZero");
return rval;
}
if (t2 <= t1)
return rval;
DateTime t = t1;
while (t <=t2)
{
int idx = rval.IndexOf(t);
if (idx < 0)
{
rval.Add(t, 0);
}
else
{
var pt = rval[idx];
if (pt.IsMissing)
{
pt.Value = 0;
pt.Flag = PointFlag.Estimated;
rval[idx] = pt;
}
}
t = rval.IncremetDate(t);
}
Logger.WriteLine("after fill s.Count=" + rval.Count);
return rval;
}
示例14: Max
/// <summary>
/// computes the Max value
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
static Series Max(Series s, double value)
{
Series rval = s.Copy();
for (int i = 0; i < s.Count; i++)
{
Point pt = s[i];
if (pt.IsMissing)
{
continue;
}
pt.Value = System.Math.Max(pt.Value, value);
rval[i] = pt;
}
return rval;
}