With the latest update, the Open-Meteo API now supports the retrieval of weather data for multiple locations at once. You can specify a list of latitude and longitude coordinates - you can fetch data for up to 1000 locations in a single go!
What's New?
You can now specify a list list of latitude and longitude coordinates in each API call. The API call is still as simple as possible:
The output format maintains its familiar JSON structure but presents data encapsulated in an array, as opposed to a single result. This update effectively replicates the process of making multiple API calls in a loop, so if you've been fetching data for multiple locations in your application, transitioning should be a seamless experience.
Updated API Documentation
The interactive Open-Meteo API documentation has already been updated to select multiple locations at once. While it showcases how the API can be utilized, keep in mind that you can dynamically construct an API call with your list of coordinates.
There's also an alternative selection mode that allows you to supply a list of coordinates. This is particularly handy when you need weather data for a list of events at specific coordinates and dates. This new selection mode streamlines the process considerably.
Internally, this translates into an API URL with all the coordinates and time-steps, returning all data in one go. Feel free to give it a try yourself by accessing the URL.
Under the Hood: Greater Efficiency
Behind the scenes, our API has been fine-tuned to prefetch data more efficiently, ensuring that you get the information you need as swiftly as possible. The scattered data on multiple disks can now be more efficiently read in parallel.
This, in combination with fewer requests required for multiple locations, translates to a significantly faster download time for data for multiple locations. This can be noticeable if integrated into an app, showing a list of locations or if you need data for thousands of locations.
Multiple Locations and API Rate Limiting
Our free, non-commercial API offers of 10,000 daily calls, which suffices for most standard use cases related to weather forecast data. However, the specifics of the API limit are more complex.
When it comes to historical weather data, a single API call can get data spanning 80 years for various weather variables. Now, consider multiplying this by querying data for 1,000 locations simultaneously, and you're dealing with a potential data volume that could reach multiple gigabytes. Surprisingly, the API is capable of handling such extensive requests in one go because it processes the data incrementally in smaller segments. Nevertheless, in practice, our rate limiter steps in promptly to prevent misuse and ensure the stability of the free API.
API calls that surpass either 14 days of data and/or 10 weather variables carry a higher weight than a standard API call. The number of locations is now a factor in this calculation. Calculating an API call's weight is relatively straightforward:
weight = nLocations * (nDays / 14) * (nVariables / 10)
Note: nVariables represents the sum of hourly, daily, and current weather variables, and it can be multiplied by the number of weather models and ensemble members.
For instance, let's consider an example involving 20 years of temperature data for 10 locations:
nLocations = 10
nVariables = 1
nDays = 10 * 365 = 3650
weight = 10 * (3650 / 14) * (1 / 10) = 260.7
In this case, the API call is weighted as 260.7 API calls, not just 1. This adjustment makes sense when you consider that the resulting CSV file contains a substantial amount of data (20.8MB).
In addition to the daily limit of 10,000 API calls, there are additional restrictions, including 5,000 API calls per hour and 600 per minute, to maintain the stability of the free API.
We are happy to provide access to researchers from public institutions who may struggle to obtain large quantities of weather data for their analysis. The automated rate limits are in place to prevent misuse. However, it's important to note that commercial customers using our paid API plans are not affected by these automated rate limits.
What's Next?
In addition to multi-location support, our API will soon introduce FlatBuffers as a binary encoding format to enhance data retrieval speed. This upcoming feature will empower data scientists to obtain long-time series weather data more easily and assist app developers in reducing parsing time in their applications. So, stay tuned for more exciting developments!
Great info!
How are models treatened in the formula. Do we have to multiply them like locations?
🚀🚀🚀