Predicting volcanic eruptions with Shapelets
4 minutes
The Case: Predicting volcanic eruptions using earthquake data
The accurate forecasting of energy prices is crucial for the orientation of the energy market and can guide policymakers and market participants, such as businesses and individuals.
With this use case, we present a data app about the recent volcanic eruptions occurred in the island of La Palma (Spain), which have caused the declaration of a catastrophic area of more than 400 hectares which produce 20 million kilograms of bananas every year and the destruction of 320 homes.
We want to highlight the relationship between earthquakes and volcanic eruptions and importance of seismic monitoring to anticipate volcanic activity as much as possible.
Intro
In the data app, the user is allowed to select a date range and can see the location of all earthquakes happened in the island of La Palma between the two dates selected. Additionally, the user can run predictions using a trained model that relies on several features extracted from earthquake data in order to predict volcanic eruptions.
For this, the user can select an earthquake from an updated list containing all earthquakes happened in the island since records are available and will obtain a prediction on the probability of a volcanic eruption after that earthquake. All the data used in this data app is provided by the Spanish National Geographic Institute (www.ign.es)
1. The Challenge
The main challenge solved with this data app is the retrieval of earthquake information from a public data source. Through its website, the Spanish National Geographic Institute (www.ign.es) provides detailed data about all earthquakes with historical records which have happened across the country.
In this case, the data is stored in a server and is accessible through HTTP requests in which the details of the request (latitude and longitude ranges, and a range of dates) are sent to a server and the response is a TXT file containing the data for all the earthquakes found. Additionally, a machine learning model stored as a pickle file can be loaded and predictions can be run with it directly from the data app, using the data retrieved from a specific earthquake selected by the user.
Methodology
In order to build this data app, the following steps are covered:
- Building a custom function (get_earthquakes_IGN) that, given a map area (i.e. longitude and latitude ranges), a starting date and an end date, performs an HTTP request in order to download a list of all earthquakes from the servers of the Spanish National Geographic Institute. The coordinates are constant, corresponding to the island of La Palma, and the dates are such that they are set automatically to the oldest possible date and today’s date, so that all earthquake records available are downloaded..
- The function get_earthquakes_IGN relies on another function (encode_multipart_formdata) which helps build the right HTTP request, incorporating all the needed information about geographic coordinates and date range.
- All earthquakes returned by get_earthquakes_IGN are converted into options for a selector. In this selector the user can select an earthquake and then, when the probability of volcanic eruption is requested by the user, the function compute_probability will be executed, downloading the data file of the chosen earthquake, building the features, normalizing them, feeding them into the model, and finally returning the desired probability.
Synthesized Resolution
Results
Even though this data app is just a simple example of data retrieval, data visualization and model inference, we can highlight the following results:
How does Shapelets help solve this challenge?
In this use case, Shapelets facilitates building a data app that can retrieve earthquake data from a public database using HTTP requests. It also allows to easily build powerful geographical visualizations with the retrieved data. Finally, it allows to use trained models to run inferences on them with the retrieved data, obtaining predictions with a simple click.
Closure
With this use case, we have learnt about earthquakes, volcanic eruptions and the relationship between them. We have built an app that can help the user retrieve data from a third-party provider, in this case the Spanish National Geographic Institute, visualize this data in geographic maps and use it to make predictions. Similar tasks can be performed using other types of data: meteorological, geological or astronomic data in order to visualize and analyse it, build models, and share the predictions of those models seamlessly with your team.