Open-Meteo

Share this post
Historical weather for machine learning
openmeteo.substack.com

Historical weather for machine learning

Get weather data for the past days, weeks or months

open-meteo
Jul 5
2
4
Share this post
Historical weather for machine learning
openmeteo.substack.com

Tl;dr You can now get past data with free Open-Meteo APIs. No API key required.

Weather forecasts from numerical models can never be compared directly to ground station measurements.

If you compare your home weather station with forecast, you will always notice differences. The temperature is off by a couple of degrees, wind is coming from a different angle or the precipitation sum of the past days could be less than half.

High resolution weather models are using 1x1 kilometer “grid-cells” to calculate weather based on current conditions and mathematical equations. Both of them have limited accuracy and a 1x1 kilo-meter grid-cells is still relatively large.

Although not “hyper-local”, weather models perform fairly well at predicting changes in large scale patterns like high and low pressure systems. Temperature forecasts for the next 3 days are usually within a couple of °C accuracy.

Forecast: 21°C, Measurement: 23.1°C (No accuracy is expected from this device!)

To bridge the gap to your personal weather station, simple statistics or machine learning can be used to optimise the “last mile”. A simple multivariate regression or a random forest algorithm are a good start.

The approach is simple:

  1. Compare measurements from the past weeks with weather models

  2. Calculate statistics

  3. Combine forecast and statistics to get an improved forecast

The improved forecast fits quite well and eliminates most simple errors like temperature always 2° too high.

In practice getting all the pieces together is a challenging task.

  • Your weather station might not have an easy way to get past measurements

  • Measurements could have outliers and inconsistencies

  • Past weather forecasts are not easily accessible

  • Combining everything with a programming language like Python is a steep learning curve

With Open-Meteo, getting the past weather forecast bit, is now a lot easier!

Starting now, all our weather forecast APIs store the past forecasts as well. Simply by setting the `&past_days=14` parameter in the URL, you can get historical weather forecasts.

Below you find an example of 2 weeks past weather data for Berlin and a forecast for the next 7 days. The red line marks the current day.

2 weeks history and 1 week forecast for Berlin, Germany

The Open-Meteo API documentation gives you a head start in configuring your own free weather forecast API with historical data. Just look for the button “Past days” and set it to “2 weeks”.

In the background, Open-Meteo combines multiple runs of a weather model into one continuous time-series. How this works is explained in the article below.

open-meteo
How to store weather forecast data for fast time-series APIs
In this post, I am explaining how Open-Meteo APIs store numerical weather-model data for fast access. I will briefly explain: Basics of geographical grids What weather-model runs are Show different storage approaches for gridded data How efficient weather forecast APIs can be designed…
Read more
9 days ago · 2 likes · 1 comment · open-meteo

There are plenty of possibilities with past weather data. You could build your own dashboard with rain of the past days or forecast your photovoltaic energy production.

Don’t miss to get future updates. There are plenty of new features planned like a weather archive that reaches centuries back or a seasonal forecast for the next months.

Thanks for reading open-meteo! Subscribe for free to receive new posts and support my work.

4
Share this post
Historical weather for machine learning
openmeteo.substack.com
4 Comments

Create your profile

0 subscriptions will be displayed on your profile (edit)

Skip for now

Only paid subscribers can comment on this post

Already a paid subscriber? Sign in

Check your email

For your security, we need to re-authenticate you.

Click the link we sent to , or click here to sign in.

Tory
Jul 15

Does the API include what the historical record temp was on any given day?

Expand full comment
ReplyCollapse
1 reply by open-meteo
Sam
Jul 6

Do you store the historical data also in ring data-structures like you describe in https://openmeteo.substack.com/p/how-to-store-weather-forecast-data ?

Expand full comment
ReplyCollapse
1 reply by open-meteo
2 more comments…
TopNewCommunity

No posts

Ready for more?

© 2022 Open-Meteo
Privacy ∙ Terms ∙ Collection notice
Publish on Substack Get the app
Substack is the home for great writing