CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-pyowm

A comprehensive Python wrapper around OpenWeatherMap web APIs providing weather data, forecasts, air pollution, UV index, and agricultural information

Pending
Overview
Eval results
Files

uv-index.mddocs/

UV Index API

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.

Capabilities

Current UV Index

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."""

UV Index Forecasts

class UVIndexManager:
    def uvindex_forecast_around_coords(self, lat: float, lon: float) -> List[UVIndex]:
        """Get UV index forecast for next 8 days."""

Historical UV Data

class UVIndexManager:
    def uvindex_history_around_coords(self, lat: float, lon: float, start, end=None) -> List[UVIndex]:
        """Get historical UV index data."""

Usage Examples

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()}")

Data Types

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)"""

UV Index Scale

  • 0-2 (Low): Low risk, no protection needed
  • 3-5 (Moderate): Moderate risk, some protection recommended
  • 6-7 (High): High risk, protection essential
  • 8-10 (Very High): Very high risk, extra protection needed
  • 11+ (Extreme): Extreme risk, avoid sun exposure

Install with Tessl CLI

npx tessl i tessl/pypi-pyowm

docs

agro.md

air-pollution.md

alerts.md

geocoding.md

index.md

stations.md

tiles.md

uv-index.md

weather.md

tile.json