LightningChart PythonSeismic Data Visualization Array Exercise in Python

TutorialSeismic Array in Wittewierum, Netherlands exercise using LightningChart Python.

Written by a human | Updated on April 23rd, 2025

Seismic Data Visualization Array Exercise in Python

This project focuses on analyzing seismic data collected from a network of sensors in Wittewierum, Netherlands. The dataset provides valuable insights into the region’s microseismicity, which is critical for understanding natural and induced seismic activities. These sensors, installed at a shallow depth of approximately 1 meter, were primarily designed to monitor microseismic events. The shallow installation allows for data collection of local seismic activity, although it also makes the sensors susceptible to recording surface-level activities.

LightningChart Python

Feature-image---lcpy-social-media

LightningChart Python is an excellent tool for visualizing large-scale seismic data due to its high performance and customizable features. This project enabled the creation of detailed and interactive waveform graphs crucial for analyzing seismic events over time.

Features and Chart Types

LightningChart Python provides various features that enhance data visualization:

  • High Performance: Can render millions of data points with minimal latency.
  • Customization: Offers extensive customization options for axes, series, and chart appearance.
  • Real-time Data Updates: Supports dynamic updates to visualizations, making it ideal for real-time monitoring.

Performance Characteristics

LightningChart Python is optimized for performance, ensuring smooth and responsive visualizations even with large datasets. This makes it suitable for real-time seismic monitoring applications, where timely data representation is critical.

Setting Up Python Environment

This article serves as an overview of the project. For detailed visualizations and code examples, it is highly recommended to refer to the accompanying Jupyter Notebook file: seismicAnalysis_Netherlands.ipynb. The notebook contains all the code, comments, and outputs necessary to understand this project’s data processing and visualization techniques fully. The array setup and shallow sensor depth further contributes to the complexity.

To set up the Python environment for this project, you need to install Python and the necessary libraries. This includes installing LightningChart Python and Pandas. Here you can also find the entire GitHub project. Here’s a quick setup guide:

  1. Install Python: Download and install the latest version of Python from the official website.
  2. Install Libraries: Use pip to install the required libraries:
pip install numpy pandas obspy lightningchart

3. Set up your development environment by creating a new project directory and installing the required libraries. Ensure that LightningChart Python is properly licensed and configured.

Overview of libraries used

  • LightningChart Python: For creating high-performance charts. (documentation)
  • Numpy: For numerical operations (documentation)
  • ObsPy: For accessing and processing seismic data (documentation)
  • Pandas: Essential for data manipulation and analysis. (documentation)

Loading and Processing Data

The seismic data is collected from sensors installed at a depth of 1 meter in Wittewierum, Netherlands. These high-gain sensors were operational from July 12, 2016, to August 29, 2016, with some outages. The dataset includes three components (HHE, HHN, and HHZ) from each station, recording continuous seismic activity.

Map of Sensor Locations

seismic-data-visualization-map-of-sensor-locations

Satellite image with Sensor Locations

seismic-data-visualization-Satellite image-with-Sensor-Locations

These images help visualize the geographic distribution of the sensors.

How to load the data

Using ObsPy, you can access and download the seismic data:

from obspy.clients.fdsn import Client
from obspy import UTCDateTime

client = Client("GFZ")

starttime = UTCDateTime("2016-07-12T00:00:00")
endtime = UTCDateTime("2016-07-12T23:59:59")
station = "WAR1"

st = client.get_waveforms(network="1C", station=station, location="--", channel="HHZ", starttime=starttime, endtime=endtime)

Handling and Preprocessing Data

The data we are mainly preprocessing is the time value, so it would be displayed properly on the charts created by LightningChart Python

# Get the time values in seconds from the start of the trace
x_values_seconds = st[0].times().tolist()

# Convert the start time to milliseconds
start_time = st[0].stats.starttime.timestamp * 1000

# If the time is in UTC+3, subtract 3 hours (10800 seconds) to adjust the time values
offset_seconds = 3 * 3600
x_values = [start_time + (sec - offset_seconds) * 1000 for sec in x_values_seconds]

Other notable preprocessing steps include converting raw waveform data into velocity, displacement, and acceleration values, ensuring accurate and meaningful visualizations. This involves numerical differentiation and integration techniques applied to the waveform data.

Visualizing Data with LightningChart Python

Creating the waveform graphs. Here’s an example of a visualization from the Jupyter Notebook file seismicAnalysis_Netherlands.ipynb where we generate waveform graphs to visualize seismic activity over time. This involves plotting raw waveform data for each sensor component.

# Initialize the client to fetch data from GFZ
client = Client("GFZ")

# Define the start and end time for the data retrieval
# We are using the previously used start and end times
starttime = starttime
endtime = endtime
station = "WAR1"

# Fetch waveforms for all three components (Z, E, N) from the specified station and time range
st = client.get_waveforms(network="1C", station=station, location="--", channel="HH?", starttime=starttime, endtime=endtime)
st.merge(method=1)

# Separate the components into individual traces
tr_z = st.select(channel="HHZ")[0]
tr_e = st.select(channel="HHE")[0]
tr_n = st.select(channel="HHN")[0]

# Calculate time values for the traces and adjust for UTC+3
times_seconds = tr_z.times().tolist()  # Get the times in seconds
start_time_ms = tr_z.stats.starttime.timestamp * 1000  # Convert start time to milliseconds
offset_seconds = 3 * 3600  # Offset for UTC+3 in seconds
times = [start_time_ms + (sec - offset_seconds) * 1000 for sec in times_seconds]  # Adjust times

# Get data values for each component
data_z = tr_z.data.tolist()
data_e = tr_e.data.tolist()
data_n = tr_n.data.tolist()

# Create a chart with dark theme
chart = lc.ChartXY(
    theme=lc.Themes.Dark,
    title='Seismic Waveform for All WAR1 Components'
)

# Remove the default x-axis and set up a custom one
chart.get_default_x_axis().dispose()
chart.get_default_y_axis().set_title("Raw count")

x_axis = chart.add_x_axis(axis_type='linear-highPrecision')
x_axis.set_tick_strategy('DateTime')  # Set the x-axis to display date-time values
x_axis.set_scroll_strategy('progressive')
x_axis.set_title("Time")

# Add waveform series for each component to the chart
waveform_series_z = chart.add_line_series().append_samples(x_values=times, y_values=data_z).set_name('HHZ').set_line_thickness(2)
waveform_series_e = chart.add_line_series().append_samples(x_values=times, y_values=data_e).set_name('HHE').set_line_thickness(2)
waveform_series_n = chart.add_line_series().append_samples(x_values=times, y_values=data_n).set_name('HHN').set_line_thickness(2)

# Open the chart
chart.open()
seismic-data-visualization-waveform-graph

Streaming and Updating Data in Real-Time

Although not implemented in this project, LightningChart Python allows for real-time data streaming and updating, which is beneficial for continuous monitoring applications.

Displacement and Acceleration Visualizations

In addition to waveform and velocity visualizations, displacement and acceleration charts were created. These visualizations typically show lower values due to the sensors’ focus on detecting microseismic events. Microseismicity involves small-scale seismic events with minor ground movements, leading to lower values in these physical units.

Dashboard Visualization

This visualization is also from the Jupyter Notebook file seismicAnalysis_Netherlands.ipynb where we combined the aforementioned data from the WAR1 sensor into one dashboard.

seismic-data-visualization-dashboard

This dashboard showcases seismic data collected from station WAR1, visualizing various physical units:

  • Top-Left – Seismic Waveform Data: Displays the raw seismic data captured over time. High amplitude events around the middle and towards the end of the time frame suggest notable ground movement incidents.
  • Top-Right – Velocity Data: Shows the rate of change of displacement, indicating how quickly the ground movement is changing. Data indicates gradual changes in ground movement speed, with peak velocities corresponding to the waveform spikes.
  • Bottom-Left – Displacement Data: This represents the total ground movement from the original position. Accumulated ground movement is consistent with the waveform’s high-amplitude sections.
  • Bottom-Right – Acceleration Data: Illustrates the rate of change of velocity, showing how the speed of the ground movement varies. Sudden changes in velocity suggest quick, significant ground movements during seismic events.

The visualizations display significant peaks in the seismic waveform, velocity, displacement, and acceleration data, but the numerical values on the y-axis appear relatively small. This discrepancy can be attributed to the following factors:

Microseismicity Focus: The sensors are designed to detect small-scale seismic events, hence the amplitude values are inherently low despite appearing large in visual representation.

High Sensitivity: The Trillium 120 s broadband sensors used are highly sensitive, capable of capturing minute ground movements which result in low numerical values but noticeable peaks. This indicates that while the peaks are prominent visually, they correspond to small yet significant ground movements as detected by highly sensitive equipment.

    Additional Context

    The sensors used in this project were installed at a depth of 1 meter and designed to monitor microseismic events. While beneficial for data collection, this shallow installation also made the sensors prone to picking up surface activities like we have mentioned in the beginning.

    The Netherlands experiences natural and induced seismic activities, with natural tectonic movements in the southeast and induced seismicity due to gas extraction in the northeast, where this temporary array of sensors was also installed. Additionally, we do not know from the source whether the ground around the sensors was being stimulated, so we cannot be 100% sure of the cause of the recorded ground movements.

    Challenges Encountered

    Accessing the complete 49 days’ worth of data was time-consuming, and data retrieval through ObsPy proved inefficient. Due to time constraints, smaller chunks of data were used to manage the analysis.

    Conclusion

    This project demonstrated the process of accessing, processing, and visualizing seismic data using LightningChart Python. The workflow included data acquisition from ObsPy, preprocessing, and creating detailed visualizations.

    Benefits of Using LightningChart Python

    LightningChart Python proved to be an effective tool for handling large-scale seismic data visualizations, offering high performance and customization options crucial for seismic data analysis.

    Roy Liu

    Roy Liu

    Data Science Python Developer

    LinkedIn icon
    divider-light

    Continue learning with LightningChart

    High-Performance WPF Charts : The Truth

    What about manufacturers’ claims about Fastest rendering charts? There are a lot of false marketing terms used in the industry, so we are going to tell the truth, based on facts that anyone can reproduce and verify.

    No Results Found

    The page you requested could not be found. Try refining your search, or use the navigation above to locate the post.