本文整理汇总了C#中TimeSeries.InstantAsDateTime方法的典型用法代码示例。如果您正苦于以下问题:C# TimeSeries.InstantAsDateTime方法的具体用法?C# TimeSeries.InstantAsDateTime怎么用?C# TimeSeries.InstantAsDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeSeries
的用法示例。
在下文中一共展示了TimeSeries.InstantAsDateTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddTimeSeries
public bool AddTimeSeries(TimeSeries tsToAdd)
{
if (tsToAdd != null)
{
int row, col, index;
for (row = 0; row < tsToAdd.NumberOfInstants; row++)
{
index = AddInstant(tsToAdd.InstantAsDateTime(row));
for (col = 0; col < tsToAdd.NumberOfDataColumns; col++)
this[col, index] = (double)tsToAdd[col, row];
}
}
return true;
}
示例2: Main
//.........这里部分代码省略.........
// nItems = nd.Data[0].Data.Count;
// else if (nItems != nd.Data[0].Data.Count)
// {
// Console.WriteLine("[ERROR]");
// throw new Exception("ARBVS server returned a different number of items than the previous node");
// }
// Console.WriteLine("[OK]");
// //Console.WriteLine("");
// //Console.WriteLine("The data returned was:");
// //foreach (MeteoAgriNode node in nodes)
// //{
// // Console.WriteLine("NODE : {0}", node.NodeId);
// // foreach (MeteoAgriData data in node.Data)
// // Console.WriteLine(string.Format(" type:'{0}' d:'{1}' s:'{2}' t:'{3}' value:'{4}'",
// // data.Type, data.D, data.S, data.T, data.Value));
// // Console.WriteLine("------------");
// //}
//}
}
string fields, data;
//if (nItems > 0)
//{
//DateTime start = DateTime.Now;
//bool start_defined = false;
if (save_db)
{
Console.Write("Writing info on database...");
for (int i = 0; i < ts.NumberOfInstants; i++)
{
fields = "Instant";
data = ts.InstantAsDateTime(i).ToString(dateFormat);
//if (dr.NodesList[0].Data[0].Data[i].D == "-1")
//{
// start = DateTime.ParseExact(dr.NodesList[0].Data[0].Data[i].T, "yyyyMMddTHH:mm:ss", null);
// data = start.ToString(dateFormat);
// start_defined = true;
//}
//else
//{
// if (!start_defined)
// throw new Exception("The start instant was not found in the imported data.");
// start = start.AddSeconds(double.Parse(dr.NodesList[0].Data[0].Data[i].T));
// data = start.ToString(dateFormat);
//}
int column_index = -1;
foreach (NodeData nd in dr.NodesList)
{
column_index++;
fields += ", " + nd.DBColumn;
data += ", " + (ts[column_index, i] as string);
}
query = string.Format("INSERT INTO {0} ({1}) VALUES ({2})", dr.TableName, fields, data);
//if (db.ExecuteCommand(query) != 1)
db.ExecuteCommand(query);
}
Console.WriteLine("[OK][{0} items inserted]", ts.NumberOfInstants.ToString());
//}
}
if (save_ts)