Exemplo n.º 1
0
        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]
                    });
            }

            result.@event = events.ToArray();
            return result;
        }
 public static DateTime DateTimeFromPI(DateTimeComplexType pi)
 {
     return pi.DateTime; // Merge(pi.date, pi.time);
 }
Exemplo n.º 3
0
 public static DateTime DateTimeFromPI(DateTimeComplexType pi)
 {
     return(pi.DateTime); // Merge(pi.date, pi.time);
 }