-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 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,20 @@ | ||
import pathlib | ||
import time | ||
from collections import defaultdict | ||
from pyais import FileReaderStream | ||
from pyais.exceptions import UnknownMessageException | ||
|
||
file = pathlib.Path(__file__).parent.joinpath('../tests/nmea-sample') | ||
stats = defaultdict(lambda: 0) | ||
start = time.time() | ||
|
||
for i, msg in enumerate(FileReaderStream(file), 1): | ||
try: | ||
decoded = msg.decode() | ||
stats[decoded.msg_type] += 1 | ||
except UnknownMessageException: | ||
stats['errors'] += 1 | ||
|
||
|
||
print(stats) | ||
print(f'Decoded {i} NMEA AIS messages in {time.time() - start: .2f}s') |