Пример #1
0
def wind_shear(shear: str, unit_alt: str = "ft", unit_wind: str = "kt") -> str:
    """
    Format wind shear string into a spoken word string
    """
    unit_alt = SPOKEN_UNITS.get(unit_alt, unit_alt)
    unit_wind = SPOKEN_UNITS.get(unit_wind, unit_wind)
    return (translate.taf.wind_shear(shear, unit_alt, unit_wind, spoken=True)
            or "Wind shear unknown")
Пример #2
0
def temperature(header: str, temp: Number, unit: str = "C") -> str:
    """Format temperature details into a spoken word string"""
    if not (temp and temp.value):
        return header + " unknown"
    unit = SPOKEN_UNITS.get(unit, unit)
    use_s = "" if temp.spoken in ("one", "minus one") else "s"
    return " ".join((header, temp.spoken, "degree" + use_s, unit))
Пример #3
0
def wind(
    direction: Number,
    speed: Number,
    gust: Number,
    vardir: [Number] = None,
    unit: str = "kt",
) -> str:
    """
    Format wind details into a spoken word string
    """
    unit = SPOKEN_UNITS.get(unit, unit)
    val = translate.base.wind(
        direction, speed, gust, vardir, unit, cardinals=False, spoken=True
    )
    return "Winds " + (val or "unknown")