return 6 elif ws_kts < 34: return 7 elif ws_kts < 41: return 8 elif ws_kts < 48: return 9 elif ws_kts < 56: return 10 elif ws_kts < 64: return 11 return 12 weewx.units.conversionDict['mile_per_hour']['beaufort'] = lambda x: beaufort( mph_to_knot(x)) weewx.units.conversionDict['knot']['beaufort'] = beaufort weewx.units.conversionDict['km_per_hour']['beaufort'] = lambda x: beaufort( kph_to_knot(x)) weewx.units.conversionDict['meter_per_second'][ 'beaufort'] = lambda x: beaufort(mps_to_knot(x)) weewx.units.default_unit_format_dict['beaufort'] = "%d" def equation_of_time(doy): """Equation of time in minutes. Plus means sun leads local time. Example (1 October): >>> print("%.4f" % equation_of_time(274)) 0.1889 """
elif ws_kts < 28: return 6 elif ws_kts < 34: return 7 elif ws_kts < 41: return 8 elif ws_kts < 48: return 9 elif ws_kts < 56: return 10 elif ws_kts < 64: return 11 return 12 weewx.units.conversionDict['mile_per_hour']['beaufort'] = lambda x : beaufort(mph_to_knot(x)) weewx.units.conversionDict['knot']['beaufort'] = beaufort weewx.units.conversionDict['km_per_hour']['beaufort'] = lambda x: beaufort(kph_to_knot(x)) weewx.units.conversionDict['meter_per_second']['beaufort'] = lambda x : beaufort(mps_to_knot(x)) weewx.units.default_unit_format_dict['beaufort'] = "%d" def equation_of_time(doy): """Equation of time in minutes. Plus means sun leads local time. Example (1 October): >>> print("%.4f" % equation_of_time(274)) 0.1889 """ b = 2 * math.pi * (doy - 81) / 364.0 return 0.1645 * math.sin(2 * b) - 0.1255 * math.cos(b) - 0.025 * math.sin(b)