예제 #1
0
파일: wxformulas.py 프로젝트: es5nhc/weewx
    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)

예제 #2
0
파일: wxformulas.py 프로젝트: teeks99/weewx
        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)


def hour_angle(t_utc, longitude, doy):
    """Solar hour angle at a given time in radians.