Git Product home page Git Product logo

nmea-parser's Introduction

Repository Description

Python based NMEA sentence parser for NMEA-Project. Using pynmea2 module.


Installation

Download the parsers folder using Releases section or clone the repository.

Then you just need to copy the parsers directory to your project directory. In that way you can access the parsers module.


Usage

This parser basically has 2 functions.

One of them is parse(sentence) and other one is get_result(). Main function is parse(sentence) and it takes a NMEA sentence as a parameter.

import parsers as parser

file = open("logs/nmea_sentences.log", "r")

for sentence in file.readlines():
    parser.parse(sentence)

You can read the data wherever you want. I used a log file for this example.

After you read the data, you can get the result by using get_result() function. This function returns a dictionary.

result = parser.get_result()

for key,item in result.items():
    print(f"{key} : {item}")

Main thing of this parser is that you parse the data using parse(sentence) function and that function automatically updates the result dictionary. So you can get the result by using get_result() function.


Parser Description

Main idea of this parser is very simple to implement thanks to pynmea2.

As you can see in main.py as well you can read sentences from a anywhere you want. Main idea is; extract specific data according to the type of sentence. In that way we dont need to try to parse all data that this sentence could have.

And we can do that very easily using pynmea2. I just needed to use little python trick to get the data from sentence type. Because pynmea2 is creating each sentence type as a class and I needed to acces the class attributes.

So I used getattr() function to get the attributes of the class.

nmea-parser's People

Contributors

alperencode avatar

Stargazers

 avatar  avatar

Watchers

 avatar

nmea-parser's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.