PyEW, a Python interface to Earthworm

242 views
Skip to first unread message

Francisco H.

unread,
Jul 6, 2018, 1:43:22 AM7/6/18
to Earthworm Community Forum
Hello Everyone,

I just wanted to let you know I created a little python extension that allows you to quickly and easily create modules for earthworm. The extension allows you to easily connect to any earthworm memory ring directly and extract messages. It offers multiple advantages:
  1. It was created with Cython and the libew which means it has the speed of the C language with the ease of use of python (Compiles to C). 
  2. The library provides the PyEW.EWModule() class which already takes care of heartbeats and listening to stop messages from startstop, input and output management.
  3. In the case of tracebuf's the PyEW library transforms it into a python dictionary (and traces as a numpy arrays) that can be passed to any other python library or custom function.
  4. The class also takes care of any messages input and output (can support text and byte input/output). 
  5. You can easily connect to multiple rings and have multiple inputs and outputs.
  6. Already packaged with several examples which can be modified to suit your needs.
  7. Python provides extensible libraries that can help you prototype modules quickly.
Several of my GPS related modules have been moved to PyEW, such as the gsof2ew and bnc2ew:
  • The Bnc2Ring (previously bnc2ew) can actually just read of any GPS NMEA TCP input string which many GPS have, but the BKG's BNC Precise Point Position NMEA output takes a step further and is precise to sub-meter levels. 
  • The Gsof2Ring (previously gsof2ew) actually takes from UNAVCO's solution to gsof and expands it to send directly to EW.
Another example covers sending trace data to a main MongoDB server (Ring2Mongo), from there many (Mongo2Ring) listeners can be set so that many EW are set to the same data. Since MongoDB can scale sideways it might be useful for high volume applications, perhaps? One advantage of having wave data in a MongoDB is the fact that you can send this data to any program (Ring2Plot) for plotting (all you have to do is set up a watch iterator). I have created one such example: the EarthWorm Real Time Trace Viewer or EWRTTV. A live demo can be seen here: ewrttv.fran89.com for PR Stations. The code is in the examples.

The last example is a simple ring to ring, however being python it can be ring2multiring or multiring2ring. Although the program is a scaffold and does not have filtering capabilities, it could be set up quite easily. 

I await your comments and recommendations, Please fork it from github and modify it, use pull request if you find a bug and wish to fix it upstream.


If you have any question or concern please don't hesitate to contact me. 

Cheers,
Francisco

Stefan Lisowski

unread,
Jul 9, 2018, 12:39:23 PM7/9/18
to earthwo...@googlegroups.com
Very cool! Thanks for sharing Francisco.

On 7/6/2018 1:43 AM, Francisco H. wrote:
> Hello Everyone,
>
> I just wanted to let you know I created a little python extension that
> allows you to quickly and easily create modules for earthworm. The
> extension allows you to easily connect to any earthworm memory ring
> directly and extract messages. It offers multiple advantages:
>
> 1. It was created with Cython and the libew which means it has the
> speed of the C language with the ease of use of python (Compiles to C).
> 2. The library provides the PyEW.EWModule() class which already takes
> care of heartbeats and listening to stop messages from startstop,
> input and output management.
> 3. In the case of tracebuf's the PyEW library transforms it into a
> python dictionary (and traces as a numpy arrays) that can be passed
> to any other python library or custom function.
> 4. The class also takes care of any messages input and output (can
> support text and byte input/output).
> 5. You can easily connect to multiple rings and have multiple inputs
> and outputs.
> 6. Already packaged with several examples which can be modified to suit
> your needs.
> 7. Python provides extensible libraries that can help you prototype
> modules quickly.
>
> Several of my GPS related modules have been moved to PyEW, such as the
> gsof2ew and bnc2ew:
>
> * The Bnc2Ring (previously bnc2ew) can actually just read of any GPS
> NMEA TCP input string which many GPS have, but the BKG's BNC Precise
> Point Position NMEA output takes a step further and is precise to
> sub-meter levels.
> * The Gsof2Ring (previously gsof2ew) actually takes from UNAVCO's
> solution to gsof
> <http://kb.unavco.org/kb/article/trimble-netr9-receiver-gsof-messages-806.html> and
> expands it to send directly to EW.
>
> Another example covers sending trace data to a main MongoDB server
> (Ring2Mongo), from there many (Mongo2Ring) listeners can be set so that
> many EW are set to the same data. Since MongoDB can scale sideways it
> might be useful for high volume applications, perhaps? One advantage of
> having wave data in a MongoDB is the fact that you can send this data to
> any program (Ring2Plot) for plotting (all you have to do is set up a
> watch iterator). I have created one such example: the EarthWorm Real
> Time Trace Viewer or EWRTTV. A live demo can be seen here:
> ewrttv.fran89.com <http://ewrttv.fran89.com> for PR Stations. The code
> is in the examples.
>
> The last example is a simple ring to ring, however being python it can
> be ring2multiring or multiring2ring. Although the program is a scaffold
> and does not have filtering capabilities, it could be set up quite easily.
>
> I await your comments and recommendations, Please fork it from github
> and modify it, use pull request if you find a bug and wish to fix it
> upstream.
>
> I have published it here: https://github.com/Boritech-Solutions/PyEW
>
> If you have any question or concern please don't hesitate to contact me.
>
> Cheers,
> Francisco
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Earthworm Community Forum" group.
>
> To post to this group, send an email to earthwo...@googlegroups.com
>
> To unsubscribe from this group, send an email to
> earthworm_for...@googlegroups.com
>
> For more options, visit this group at
> http://groups.google.com/group/earthworm_forum?hl=en
>
> ---
> You received this message because you are subscribed to the Google
> Groups "Earthworm Community Forum" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to earthworm_for...@googlegroups.com
> <mailto:earthworm_for...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages