public static SoundSpeed Average(SoundSpeed monthlySoundSpeeds, List<TimePeriod> timePeriods) { var result = new SoundSpeed(); foreach (var timePeriod in timePeriods) { var months = Globals.AppSettings.NAVOConfiguration.MonthsInTimePeriod(timePeriod); var accumulator = new SoundSpeedFieldAverager { TimePeriod = timePeriod }; foreach (var month in months) accumulator.Add(monthlySoundSpeeds[month]); result.SoundSpeedFields.Add(accumulator.Average); } return result; }
public static SoundSpeedField Average(SoundSpeed monthlySoundSpeeds, TimePeriod timePeriod) { var months = Globals.AppSettings.NAVOConfiguration.MonthsInTimePeriod(timePeriod).ToList(); var accumulator = new SoundSpeedFieldAverager { TimePeriod = timePeriod }; foreach (var month in months) accumulator.Add(monthlySoundSpeeds[month]); return accumulator.Average; }