BiasCorrectQ.Utils.GetWYAnnualData C# (CSharp) Method

GetWYAnnualData() private static method

private static GetWYAnnualData ( List flow ) : List>.Dictionary
flow List
return List>.Dictionary
        private static Dictionary<int, List<double>> GetWYAnnualData(List<Point> flow)
        {
            int startWY = flow[0].Date.Year + 1;
            int endWY = flow[flow.Count - 1].Date.Year;

            var rval = new Dictionary<int, List<double>> { };
            for (int i = 0; i < (endWY - startWY + 1); i++)
            {
            rval.Add(startWY + i, new List<double> { });
            }

            // add data for the water year
            foreach (Point pt in flow)
            {
            int month = pt.Date.Month;
            int year = pt.Date.Year;

            double value = pt.Value * DateTime.DaysInMonth(year, month);

            if (month > 9)
            {
                rval[pt.Date.Year + 1].Add(value);
            }
            else
            {
                rval[pt.Date.Year].Add(value);
            }
            }
            return rval;
        }