Choosing a Weather API
To determine the best API for the weather model, we’ll need to establish the goals and features we wish to have. So let’s start there.
Key Goals and Features
The previous iteration of the Midnight Sun vehicle collected the following information from the OpenWeather API endpoint:
Temperature
Wind Speed, Wind Direction
Weather, Weather Description
Air Pressure
Precipitation
Through additional research, it was found that a couple of other useful weather parameters for a solar car are as follows:
Humidity
Cloud Coverage
When picking an API to collect weather data, we’ll mainly compare the features using the baseline parameters above. Additional features will be seen as a bonus and will be taken into consideration along with factors like the number of API calls and forecast precision.
Note, the goal of the Weather model is to:
Obtain weather data along the race route on a day-to-day basis
Have predicted weather data for up to two to three days in advance
Be alerted to bad weather in advance
With all of that in mind, we’ll evaluate some common APIs.
If you do not wish to read through all of the APIs below, here is the TLDR;
I would choose Tomorrow.io as the main weather API. It provides the most precise forecasting at the expense of providing the least free API calls. The 500 calls/day should suffice in most conditions and if necessary, less precise forecasting can be made with the other suggested APIs.
OpenWeather API
The main appeal of OpenWeather API is that it possesses every data type we need and that the code is already set up. OpenWeather API has two main free models for providing their data. The “One Call by Call” (OCC) subscription and what I’ll call the “Basic” subscription, which is essentially the default free plan.
The Basic subscription provides the following features:
Current Weather Data
Access current weather data for a given point
5 Day/3 Hour Forecast
Get a 5-day forecast with 3 hour-steps
Using the Basic subscription, we will have access to 60 calls/minute and 1,000,000 calls/month
Alternatively, there is the OCC subscription plan. This plan has the following features:
Minute forecast for 1 hour
Hourly forecast for 48 hours
Daily forecast for 8 days
It can be seen that the OCC plan provides much more precise data, which would help with more accurate decision-making. However, the OCC plan has a different payment model compared to the Basic plan. Under the OCC subscription, we will have access to 1000 free calls/day and any additional call will require 0.0015 USD. However, the account can be set up to prevent any accidental API calls over 1000.
There is one other API provided by OpenWeather that may be useful. It is called the Road Risk API and boasts the following features:
Specify your route and get weather data and national alerts for the point of destination and along the route
Provides current and forecast data
Must contact info@openweathermap.org to get access,
Tomorrow.io
Tomorrow.io possesses all of the data outlined in our key features. The API provides plenty of industry-level statistics which will translate well to our needs.
The free plan contains the following functionality:
Key data points (Temperature, Wind, Air Pressure, Precipitation, etc.)
Humidity and Cloud Coverage statistics
Provides precise sub-hour interval (1min-30min) forecasts up to 6 hours in the future
Tomorrow.io provides 500 free calls/day. The premium features for Tomorrow.io contain more depth than OpenWeather API, however, both their free tiers have similar features. The main trade-off between Tomorrow.io and OpenWeather API would be that OpenWeather API provides a longer duration of precise forecasting (6h vs. 1h) at the expense of 500 API calls.
OpenMeteo API
The final candidate for weather API would be OpenMeteo API. OpenMeteo contains the following functionality:
Key data points (Temperature, Wind, Air Pressure, Precipitation, etc.)
Humidity and Cloud Coverage
Completely free/open-source
Forecast is only by hour
The benefits and drawbacks of OpenMeteo API are clear. We would sacrifice forecast precision as a tradeoff for having unlimited API calls.
Summary
With the three options presented above, it seems that the main tradeoff between all of the options is forecasting precision versus the number of API calls. As real-time data is crucial for decision-making, I would recommend using Tomorrow.io as the main weather API.
If the number of API calls becomes an issue, then OpenWeather or OpenMeteo could be used to provide less precise forecasts for upcoming race days.