or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

agro.mdair-pollution.mdalerts.mdgeocoding.mdindex.mdstations.mdtiles.mduv-index.mdweather.md

uv-index.mddocs/

0

# UV Index API

1

2

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.

3

4

## Capabilities

5

6

### Current UV Index

7

8

```python { .api }

9

class UVIndexManager:

10

def uvindex_api_version(self) -> tuple:

11

"""

12

Get UV Index API version.

13

14

Returns:

15

Tuple representing the API version

16

"""

17

18

def uvindex_around_coords(self, lat: float, lon: float) -> UVIndex:

19

"""Get current UV index for coordinates."""

20

```

21

22

### UV Index Forecasts

23

24

```python { .api }

25

class UVIndexManager:

26

def uvindex_forecast_around_coords(self, lat: float, lon: float) -> List[UVIndex]:

27

"""Get UV index forecast for next 8 days."""

28

```

29

30

### Historical UV Data

31

32

```python { .api }

33

class UVIndexManager:

34

def uvindex_history_around_coords(self, lat: float, lon: float, start, end=None) -> List[UVIndex]:

35

"""Get historical UV index data."""

36

```

37

38

## Usage Examples

39

40

```python

41

from pyowm import OWM

42

43

owm = OWM('your-api-key')

44

uv_mgr = owm.uvindex_manager()

45

46

# Current UV index

47

uv_index = uv_mgr.uvindex_around_coords(40.7128, -74.0060)

48

print(f"Current UV Index: {uv_index.value}")

49

print(f"Exposure Risk: {uv_index.get_exposure_risk()}")

50

51

# UV forecast

52

uv_forecast = uv_mgr.uvindex_forecast_around_coords(40.7128, -74.0060)

53

for uv in uv_forecast[:3]:

54

print(f"{uv.reference_time('iso')}: UV={uv.value}, Risk={uv.get_exposure_risk()}")

55

```

56

57

## Data Types

58

59

```python { .api }

60

class UVIndex:

61

def __init__(self, reference_time: int, location: Location, value: float, reception_time: int): ...

62

63

def reference_time(self, timeformat: str = 'unix') -> Union[int, str, datetime]: ...

64

def reception_time(self, timeformat: str = 'unix') -> Union[int, str, datetime]: ...

65

def get_exposure_risk(self) -> str:

66

"""Returns exposure risk level: 'low', 'moderate', 'high', 'very high', 'extreme'"""

67

68

@property

69

def location(self) -> Location: ...

70

@property

71

def value(self) -> float: # UV intensity value (>= 0)

72

"""UV intensity value (>= 0)"""

73

```

74

75

## UV Index Scale

76

77

- **0-2 (Low)**: Low risk, no protection needed

78

- **3-5 (Moderate)**: Moderate risk, some protection recommended

79

- **6-7 (High)**: High risk, protection essential

80

- **8-10 (Very High)**: Very high risk, extra protection needed

81

- **11+ (Extreme)**: Extreme risk, avoid sun exposure