-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from vtoupet/master
Add support for additional wind observations (OD1, OD2, OD3)
- Loading branch information
Showing
3 changed files
with
28 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from ..Speed import Speed | ||
from ..Direction import Direction | ||
from .BaseComponent import BaseComponent | ||
|
||
|
||
class WindObservationComponent(BaseComponent): | ||
''' handle OD1/OD2/OD3 Additional Wind observation types ''' | ||
WIND_OBSERVATION_TYPES = { | ||
'1': 'Average speed of prevailing wind', | ||
'2': 'Mean wind speed', | ||
'3': 'Maximum instantaneous wind speed', | ||
'4': 'Maximum gust speed', | ||
'5': 'Maximum mean wind speed', | ||
'6': 'Maximum 1 - minute mean wind speed', | ||
'9': 'Missing' | ||
} | ||
|
||
def loads(self, string): | ||
self.wind_observation = { | ||
'type': self.WIND_OBSERVATION_TYPES[string[0:1]], | ||
'hours': int(string[1:3]), | ||
'speed': Speed(float(string[3:7]) / 10.0, Speed.METERSPERSECOND, string[7:8]), | ||
'direction': Direction(string[8:11], Direction.RADIANS) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters