A comprehensive Python wrapper around OpenWeatherMap web APIs providing weather data, forecasts, air pollution, UV index, and agricultural information
—
Ultraviolet radiation index information including current UV levels, forecasts, and historical UV index data. Provides UV exposure risk assessment and helps with sun protection planning.
class UVIndexManager:
def uvindex_api_version(self) -> tuple:
"""
Get UV Index API version.
Returns:
Tuple representing the API version
"""
def uvindex_around_coords(self, lat: float, lon: float) -> UVIndex:
"""Get current UV index for coordinates."""class UVIndexManager:
def uvindex_forecast_around_coords(self, lat: float, lon: float) -> List[UVIndex]:
"""Get UV index forecast for next 8 days."""class UVIndexManager:
def uvindex_history_around_coords(self, lat: float, lon: float, start, end=None) -> List[UVIndex]:
"""Get historical UV index data."""from pyowm import OWM
owm = OWM('your-api-key')
uv_mgr = owm.uvindex_manager()
# Current UV index
uv_index = uv_mgr.uvindex_around_coords(40.7128, -74.0060)
print(f"Current UV Index: {uv_index.value}")
print(f"Exposure Risk: {uv_index.get_exposure_risk()}")
# UV forecast
uv_forecast = uv_mgr.uvindex_forecast_around_coords(40.7128, -74.0060)
for uv in uv_forecast[:3]:
print(f"{uv.reference_time('iso')}: UV={uv.value}, Risk={uv.get_exposure_risk()}")class UVIndex:
def __init__(self, reference_time: int, location: Location, value: float, reception_time: int): ...
def reference_time(self, timeformat: str = 'unix') -> Union[int, str, datetime]: ...
def reception_time(self, timeformat: str = 'unix') -> Union[int, str, datetime]: ...
def get_exposure_risk(self) -> str:
"""Returns exposure risk level: 'low', 'moderate', 'high', 'very high', 'extreme'"""
@property
def location(self) -> Location: ...
@property
def value(self) -> float: # UV intensity value (>= 0)
"""UV intensity value (>= 0)"""Install with Tessl CLI
npx tessl i tessl/pypi-pyowm