BiasCorrectQ.Utils.IsDataMonthly C# (CSharp) Method

IsDataMonthly() static private method

static private IsDataMonthly ( List data ) : bool
data List
return bool
        internal static bool IsDataMonthly(List<Point> data)
        {
            /* pretty primitive check, if someone has a better method feel free
             * to modify this */
            var d1 = data[0].Date;
            var d2 = data[1].Date;
            if (d2 == d1.AddMonths(1))
            {
            return true;
            }
            return false;
        }

Usage Example

Example #1
0
 private static List <Point> DataToMonthly(List <Point> data)
 {
     /* if data is monthly return data, if data is daily process
      * data, otherwise print error message and get out of here */
     if (Utils.IsDataMonthly(data))
     {
         return(data);
     }
     else if (Utils.IsDataDaily(data))
     {
         return(DailyToMonthly(data));
     }
     else
     {
         Console.WriteLine("error: only monthly or daily inputs supported");
         return(new List <Point> {
         });
     }
 }