Skip to content
Map display of real-time lightning strike data from Earth Networks using Python and TCP Socket
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
screenshots
README.md
plotLightningStrikes.py

README.md

python-lightning-earthnetworks

This script maps real-time lightning strike locations in the continental United States using a TCP socket datafeed of lightning data from Earth Networks.

Animated-Lightning

WHAT

Earth Networks is a provider of global weather data and operates the Earth Networks Total Lightning Network (ENTLN), one of three lightning networks in the United States that provides real-time information about lightning strikes.

Earth Networks provides access to real-time lightning data from the ENTLN via a TCP socket connection, referred to as the ENTLN Data Feed. Note that access to this datafeed is restricted to paying subscribers.

In this script, it is shown how to (i) connect to the ENTLN Data Feed using Python, (ii) parse out lightning data from the JSON payloads received from the TCP socket, and (iii) plot lightning strike locations on a map of the continental United States.

HOW

The Python socket library is used to establish a TCP socket connection to the ENLTN data feed. First, a valid authentication message is sent to the connection. This authentication message includes a ParterID (UUID) provided by Earth Networks either on a trial or subscription basis. Additional data is included to properly configure the datafeed.

Next a while True: loop starts grabbing messages from the socket connection and parsing JSON data payloads. The data payloads include information about each lightning strike, including timestamp, latitude/longitude coordinates, peak current, etc, as shown in an example payload below.

Animated-Lightning

WHY

Once parsed from the socket connection, these data payloads can be used to upload datapoints to a database, trigger other actions, or plot lightning strike locations as in this script.

For example, this script could be used as a simple alerting tool to identify lightning strikes that occur near valuable assets (shown as blue dots in the map below).

Animated-Lightning

You can’t perform that action at this time.