/// <summary> /// percents /// </summary> /// <returns></returns> public static double SunPercentageSd(int firstDay, int lastDay, bool isLeapYear) { double start = DaysOfYearConversions.ProjectFirstDay(firstDay, isLeapYear); double stop = DaysOfYearConversions.ProjectLastDay(lastDay, isLeapYear); double unalignedDays = Math.IEEERemainder(stop - start, 1.0) * 30.0; if (unalignedDays <= 0.0) { unalignedDays += 30.0; } return(Math.Max(5.699910e-09 * Math.Pow(unalignedDays, 7) - 3.555722e-07 * Math.Pow(unalignedDays, 6) + 7.900013e-06 * Math.Pow(unalignedDays, 5) - 1.357565e-04 * Math.Pow(unalignedDays, 4) + 2.675668e-03 * Math.Pow(unalignedDays, 3) - 4.403412e-03 * unalignedDays * unalignedDays - 1.269137e+00 * unalignedDays + 2.303582e+01, 0.0) / (Math.Truncate(stop - start) + 1)); }
/// <summary> /// percents /// </summary> /// <returns></returns> public static double RelativeHumiditySd(int firstDay, int lastDay, bool isLeapYear) { double start = DaysOfYearConversions.ProjectFirstDay(firstDay, isLeapYear); double stop = DaysOfYearConversions.ProjectLastDay(lastDay, isLeapYear); double unalignedDays = Math.IEEERemainder(stop - start, 1.0) * 30.0; if (unalignedDays <= 0.0) { unalignedDays += 30.0; } return(Math.Max(-0.000366274 * unalignedDays * unalignedDays * unalignedDays + 0.022035029 * unalignedDays * unalignedDays - 0.647813200 * unalignedDays + 9.184569663, 0.0) / (Math.Truncate(stop - start) + 1)); }
/// <summary> /// Degrees C /// </summary> /// <returns></returns> public static double NearSurfaceTemperatureSd(int firstDay, int lastDay, bool isLeapYear) { double start = DaysOfYearConversions.ProjectFirstDay(firstDay, isLeapYear); double stop = DaysOfYearConversions.ProjectLastDay(lastDay, isLeapYear); double unalignedDays = Math.IEEERemainder(stop - start, 1.0) * 30.0; if (unalignedDays <= 0.0) { unalignedDays += 30.0; } return(Math.Sqrt(Math.Exp(-0.0929367 * (double)unalignedDays + 2.788101) - 1) / (Math.Truncate(stop - start) + 1)); }
/// <summary> /// mm/month /// </summary> /// <returns></returns> public static double PrecipitationRateSd(int firstDay, int lastDay, bool isLeapYear) { double start = DaysOfYearConversions.ProjectFirstDay(firstDay, isLeapYear); double stop = DaysOfYearConversions.ProjectLastDay(lastDay, isLeapYear); double unalignedDays = Math.IEEERemainder(stop - start, 1.0) * 30.0; if (unalignedDays <= 0.0) { unalignedDays += 30.0; } return(Math.Sqrt(Math.Exp(Math.Sqrt(-2.61951724 * unalignedDays + 78.5855172)) - 1) / (Math.Truncate(stop - start) + 1)); }
/// <summary> /// meter/s /// </summary> /// <returns></returns> public static double WindSpeedSd(int firstDay, int lastDay, bool isLeapYear) { double start = DaysOfYearConversions.ProjectFirstDay(firstDay, isLeapYear); double stop = DaysOfYearConversions.ProjectLastDay(lastDay, isLeapYear); double unalignedDays = Math.IEEERemainder(stop - start, 1.0) * 30.0; if (unalignedDays <= 0.0) { unalignedDays += 30.0; } return(Math.Max(7.366328e-10 * Math.Pow(unalignedDays, 7) - 4.211287e-08 * Math.Pow(unalignedDays, 6) + 3.851063e-07 * Math.Pow(unalignedDays, 5) + 1.238918e-05 * Math.Pow(unalignedDays, 4) - 1.343913e-04 * Math.Pow(unalignedDays, 3) - 1.134482e-03 * unalignedDays * unalignedDays - 5.671852e-02 * unalignedDays + 1.619290e+00, 0.0) / (Math.Truncate(stop - start) + 1)); }