TNS
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
NEW! Try Stackie AI
CI/CD / Databases

How to Build a Time Series App for Weather Forecasting

This tutorial will illustrate how to build a practical weather forecasting system for notoriously unpredictable London weather.
May 20th, 2025 10:00am by
Featued image for: How to Build a Time Series App for Weather Forecasting

Ever wondered what the weather will be like in London next month? Or perhaps you’re trying to predict your company’s sales for the upcoming quarter? Welcome to the fascinating world of time series forecasting, a data science technique that lets us peek into the future using historical patterns.

The Art of Predicting Tomorrow

Time series forecasting is at the intersection of statistics, data science and domain expertise. It’s the secret sauce behind numerous business operations, from inventory management to financial planning. This tutorial will illustrate how to build a practical weather forecasting system for notoriously unpredictable London weather.

The data store will be a time series database, which is highly suitable for time series forecasting due to its focus on time-stamped data.

They are designed to efficiently store and retrieve large volumes of data ordered by time, which is fundamental for analyzing historical trends and patterns.

Our Toolkit

Three powerful technologies won’t cost you a penny:

  • InfluxDB 3 Enterprise: A powerful time series database designed to handle the complexities of storing, processing and analyzing high-volume, high-velocity data for historic time series forecasting. You can use the free trial or the free-at-home license.
  • Prophet: Facebook Research’s robust open source forecasting library handles seasonality and anomaly detection with ease.
  • Open-Meteo API: A free, comprehensive weather data API with global coverage used to collect London’s weather data from the last six months.

Getting Started

1. Installing InfluxDB 3 Enterprise: Installation is easy; you can get started for free with just your email address. Run the following command in your terminal and follow the prompt for seamless installation.


2. Start InfluxDB 3 Enterprise with default settings that include a simple cluster and a Parquet file as the local object store.


3. Create an admin token for database operations using the following command:


4. Create a ‘.env’ file and store the admin token string securely along with following details:


5. Python and Prophet Setup

Finally, install the necessary libraries, such as Prophet, requests to handle web API requests from Open-Meteo’s API for London weather data, dotenv to store credentials in an environment file, and InfluxDB v3 Client Library to communicate easily with InfluxDB 3 Enterprise.

Step 1: Collecting Historical Weather Data

The journey begins with collecting London’s temperature data. Use the Open-Meteo API to grab six months of historical data and store it efficiently in InfluxDB. Create a Python script and name it main.py.


Our DBClient class handles the heavy lifting of batch writing to the local InfluxDB 3 Enterprise instance for optimal performance.

Step 2: Retrieving Weather Data

With the data safely stored, it can be retrieved using a straightforward SQL query. Create a Python script and name it influxdb_client.py.

Step 3: Crystal Ball Time – Forecasting With Prophet

Now, for the exciting part: using Prophet to generate predictions for London’s temperature over the next month. Create a Python script and name it forecasting.py.

The Forecasting Choice: Machine Learning vs. Statistical Methods

Forecasting is not new, especially for time series data. Popular approaches include statistical methods and machine learning models. The key differences between the two are:

Machine Learning Methods (like Prophet):

  • Excel at detecting complex, nonlinear patterns
  • Automatically handle seasonality and trend changes
  • Require minimal manual tweaking
  • Work better with larger data sets

Traditional Statistical Methods (like ARIMA):

  • Provide clearer interpretability
  • Perform well, even with limited data
  • Consume fewer computational resources
  • Often require more statistical expertise

The New Kid on the Block: Time Series LLMs

Large language models specifically trained for time series analysis are emerging as a fascinating frontier:

Advantages:

  • Can potentially forecast without explicit training (zero-shot learning)
  • May generalize well across different types of time series data

Limitations:

  • Still in early development stages
  • Computationally intensive
  • Often lack interpretability
  • May struggle with long-term accuracy

Real-Time vs. Batch Processing

Our example uses batch processing, analyzing fixed data sets to make predictions. This works perfectly for weather forecasting, which doesn’t require up-to-the-second updates. However, for applications like financial trading or IoT sensor monitoring that might require real-time forecasting, the Processing Engine in InfluxDB 3 Core/Enterprise is ideal.

Wrapping Up

Time series forecasting unlocks incredible possibilities across industries. With tools like Prophet and InfluxDB becoming increasingly accessible, you can start implementing sophisticated forecasting solutions with minimal overhead.

The landscape continues to evolve rapidly, with time series LLMs representing the cutting edge. Stay curious, keep experimenting and your forecasting skills will become increasingly valuable in our data-driven world.

Don’t hesitate to join our community discussion with your questions and insights.

Created with Sketch.
TNS owner Insight Partners is an investor in: Real.
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.