本文整理汇总了C#中TimeSeries.timeForItem方法的典型用法代码示例。如果您正苦于以下问题:C# TimeSeries.timeForItem方法的具体用法?C# TimeSeries.timeForItem怎么用?C# TimeSeries.timeForItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeSeries
的用法示例。
在下文中一共展示了TimeSeries.timeForItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FromTimeSeries
public static TimeSeriesComplexType FromTimeSeries(TimeSeries ts,string forcedTimeStamp)
{
TimeSeriesComplexType result = new TimeSeriesComplexType( );
string locationName = LocationName(ts.name);
result.header = new HeaderComplexType
{
type = timeSeriesType.mean,
locationId = locationName,
//stationName = locationName,
startDate = new DateTimeComplexType {DateTime = MergeDT(ts.Start,forcedTimeStamp)},
endDate = new DateTimeComplexType {DateTime = MergeDT(ts.End,forcedTimeStamp)},
missVal = ts.NullValue,
units = PIUnits(ts),
timeStep = PITimeStep(ts.timeStep),
parameterId = ParameterName(ts.name)
};
IList<EventComplexType> events = new List<EventComplexType>();
for (int i = 0; i < ts.count(); i++)
{
var fewsDT = new DateTimeComplexType {DateTime = MergeDT(ts.timeForItem(i),forcedTimeStamp)};
events.Add( new EventComplexType
{
date = fewsDT.date,
time = fewsDT.time,
flag = 2,
flagSpecified = true,
value = ts[i]
});
}
[email protected] = events.ToArray();
return result;
}
示例2: SimpleTimeSeries
public SimpleTimeSeries(TimeSeries source):base(source)
{
if (source == null)
{
Events = new TimeSeriesEvent[0];
return;
}
IList<TimeSeriesEvent> eventList = new List<TimeSeriesEvent>();
for (int i = 0; i < source.count(); i++)
eventList.Add(new TimeSeriesEvent
{
Date = source.timeForItem(i).ToString(CultureInfo.InvariantCulture),
Value = source[i]
});
Events = eventList.ToArray();
}