0
# Wind and Weather Sentences
1
2
Wind and weather sentences provide meteorological data including wind speed, direction, temperature, pressure, and humidity measurements.
3
4
## Wind Sentences
5
6
### MWV - Wind Speed and Angle
7
8
```python { .api }
9
class MWV(TalkerSentence, ValidStatusFix):
10
"""Wind Speed and Angle."""
11
12
wind_angle: str # Wind angle in degrees
13
reference: str # Reference ('R' = relative, 'T' = true)
14
wind_speed: str # Wind speed
15
wind_speed_units: str # Speed units ('N' = knots, 'M' = m/s, 'K' = km/h)
16
status: str # 'A' = valid, 'V' = invalid
17
18
@property
19
def is_valid(self) -> bool:
20
"""True if status is 'A'."""
21
```
22
23
### VWR - Relative Wind Speed and Angle
24
25
```python { .api }
26
class VWR(TalkerSentence):
27
"""Relative Wind Speed and Angle."""
28
29
deg_r: str # Wind direction relative to vessel
30
l_r: str # 'L' = left, 'R' = right
31
wind_speed_kn: str # Wind speed in knots
32
unit_knots: str # 'N' for knots
33
wind_speed_ms: str # Wind speed in m/s
34
unit_ms: str # 'M' for m/s
35
wind_speed_km: str # Wind speed in km/h
36
unit_km: str # 'K' for km/h
37
```
38
39
### MWD - Wind Direction
40
41
```python { .api }
42
class MWD(TalkerSentence):
43
"""Wind Direction."""
44
45
direction_true: str # True wind direction in degrees
46
true: str # 'T' for true
47
direction_magnetic: str # Magnetic wind direction in degrees
48
magnetic: str # 'M' for magnetic
49
wind_speed_knots: str # Wind speed in knots
50
knots: str # 'N' for knots
51
wind_speed_meters: str # Wind speed in m/s
52
meters: str # 'M' for m/s
53
```
54
55
## Temperature Sentences
56
57
### MTA - Air Temperature
58
59
```python { .api }
60
class MTA(TalkerSentence):
61
"""Air Temperature."""
62
63
temperature: str # Temperature value
64
units: str # 'C' for Celsius
65
```
66
67
### MTW - Water Temperature
68
69
```python { .api }
70
class MTW(TalkerSentence):
71
"""Water Temperature."""
72
73
temperature: str # Water temperature value
74
units: str # 'C' for Celsius
75
```
76
77
## Comprehensive Weather Data
78
79
### MDA - Meteorological Composite
80
81
```python { .api }
82
class MDA(TalkerSentence):
83
"""Meteorological Composite."""
84
85
b_pressure_inch: str # Barometric pressure in inches of mercury
86
inches: str # 'I' for inches
87
b_pressure_bar: str # Barometric pressure in bars
88
bars: str # 'B' for bars
89
air_temp: str # Air temperature
90
a_celsius: str # 'C' for Celsius
91
water_temp: str # Water temperature
92
w_celsius: str # 'C' for Celsius
93
rel_humidity: str # Relative humidity percentage
94
abs_humidity: str # Absolute humidity
95
dew_point: str # Dew point temperature
96
d_celsius: str # 'C' for Celsius
97
direction_true: str # True wind direction
98
true: str # 'T' for true
99
direction_magnetic: str # Magnetic wind direction
100
magnetic: str # 'M' for magnetic
101
wind_speed_knots: str # Wind speed in knots
102
knots: str # 'N' for knots
103
wind_speed_meters: str # Wind speed in m/s
104
meters: str # 'M' for m/s
105
```
106
107
## Usage Examples
108
109
```python
110
import pynmea2
111
112
# Parse wind speed and angle
113
msg = pynmea2.parse("$WIMWV,214,R,8.5,N,A*23")
114
print(f"Wind: {msg.wind_angle}° relative, {msg.wind_speed} {msg.wind_speed_units}") # 214° relative, 8.5 N
115
print(f"Valid: {msg.is_valid}") # True
116
117
# Parse relative wind
118
msg = pynmea2.parse("$WIMVR,045,R,8.5,N,4.4,M,15.8,K*59")
119
print(f"Relative wind: {msg.deg_r}° to {msg.l_r}") # 045° to R (right)
120
print(f"Speed: {msg.wind_speed_kn} knots, {msg.wind_speed_ms} m/s") # 8.5 knots, 4.4 m/s
121
122
# Parse comprehensive weather data
123
msg = pynmea2.parse("$WIMDA,30.15,I,1.02,B,23.5,C,18.2,C,65.5,,12.8,C,195,T,200,M,8.5,N,4.4,M*3D")
124
print(f"Pressure: {msg.b_pressure_inch} inches, {msg.b_pressure_bar} bars")
125
print(f"Air temp: {msg.air_temp}°C, Water temp: {msg.water_temp}°C")
126
print(f"Humidity: {msg.rel_humidity}%, Dew point: {msg.dew_point}°C")
127
print(f"Wind: {msg.direction_true}°T at {msg.wind_speed_knots} knots")
128
129
# Parse air temperature
130
msg = pynmea2.parse("$WIMTA,23.5,C*1F")
131
print(f"Air temperature: {msg.temperature}°{msg.units}") # 23.5°C
132
```