/// <summary>
        ///     Builds a PrecipitationData object from a DataRow
        /// </summary>
        /// <param name="row">A DataRow object that represents a PrecipitationData</param>
        /// <returns>Returns a PrecipitationData object</returns>
        private static PrecipitationData FromRow(DataRow row)
        {
            var pd = new PrecipitationData
            {
                Station             = row[0].ToString(),
                DateString          = row[5].ToString(),
                PrecipitationString = row[6].ToString()
            };

            return(pd);
        }
Ejemplo n.º 2
0
        private void Start(DateTime date)
        {
            AppLog.Log("Processing for date: {0}", date.ToShortDateString());

            var data = PrecipitationData.ReadForMonthDay("data.xlsx", date.Month, date.Day);

            AppLog.Log("Found {0} entries in data file for {1} {2}", data.Count, date.GetMonthName(), date.Day);
            var engine  = new PredictionEngine(data);
            var removed = data.Count - engine.Data.Count;

            AppLog.Log("Data Cleanup removed {0} duplicate date entries.", removed);
            var res = new ResultData {
                EstimatedPrecipitation = engine.GetPrediction()
            };

            Console.WriteLine(res.ToString());
        }