We are back with yet another weather API. This time, it’s the turn of the Visual Crossing Weather API. Visual Crossing Weather API specializes in historical weather data and is suitable for data scientists who want to research subject matters that relate to weather. That’s because one of the critical features of this API is that it returns the data in a format that is suitable for immediate storage and analysis through some of the standard data analysis tools.
Visual Crossing Weather API is integrated with Rakuten RapidAPI so you can log in you your Rakuten RapidAPI account and get started quickly.
What is a Weather Data API?
A Weather Data API allows developers to access important forecasts, alerts, observations and other weather data. Some trustworthy Weather Data APIs are the National Weather Service (NWS) API, Dark Sky API, and Visual Crossing Weather API.
In case you don’t have an account with Rakuten Rapid API, sign up now and get your universal API key to access the Visual Crossing Weather API and thousands of other APIs hosted on Rakuten RapidAPI.
Industries Most Impacted By Weather
Weather impacts almost all industries, either directly or indirectly. Hence weather is an essential part of the decision making process for businesses in planning their operations. On one hand, day to day business operations involving outdoor activities is more likely to be disrupted by the weather. But on the other hand, even indoor activities are under the influence of weather to some extent. Take the case of the retail industry. Seasonal changes and harsh climatic conditions have a direct impact on the stocking of merchandise and the footfall of customers.
So a weather-driven decision making is a smart way to get ahead of the competition. Whether you need to do this daily or once in a while, is your prerogative. However, for some industries, weather forecasting or assessment is a part of everyday operational processes, and any misadventure in this process can lead to loss of lives or property or both. Let’s look at some cases.
Most of us traveling on a commercial airplane know that there is a pilot and a first officer at the cockpit. However, we may not realize that a third pilot is sitting on the ground who charts out the pre-defined flight path as per the weather forecast during the time of the flight. This person is known as the dispatcher, and the role of a dispatcher is very critical. The dispatcher is responsible not only from the flight’s safety, she is also responsible for optimizing the travel time and fuel consumption of the flight path as per the weather pattern.
Like airlines, shipping companies also need continuous weather monitoring. Apart from checking routes and avoiding extreme weather conditions, they need to take into account the tidal patterns. Available in the form of a table with time intervals, a tide table contains low and high tide intervals during the day, which can be used by the ships to decide the best time to arrive or leave the port.
Event management companies are faced with weather challenges when they are hosting an outdoor event. Even otherwise, an adverse weather forecast can ruin their logistics operations. So considering the weather is very important for professional event management companies. Although it is not as critical to operations as in the case of airlines and shipping, it does have a significant impact on the overall experience. A lack of planning to counter weather variability can ruin the reputation of an event management company.
Weather Event Planner is a great app to assist event planners. Just by feeding the name of the location and the date of the event, the app can provide a comprehensive visual forecast.
Overview of Visual Crossing Weather API
Log on to your Rakuten RapidAPI account and access the API console of Visual Crossing Weather API.
The API has two endpoints, “GET Historical weather record” and “GET Weather forecast data”.
GET Historical weather data
As the name suggests, this endpoint is used for getting historical weather data.
The data can be obtained for a data range specified by ‘startDateTime’ and ‘endDateTime’ parameter. The location for which the historical data is requested is specified in ‘location’ parameter, and the ‘aggregateHours’ specifies the granularity of the data. It supports hourly or 24 hour aggregated data.
Finally, you can choose the unit system for displaying the weather measurements and specify that in the ‘unitGroup’ parameter.
GET Weather forecast data
This endpoint is used for getting the weather forecast for several days.
The parameters for this endpoint are similar to the “GET Historical weather record” and are self explanatory.
The Visual Crossing Weather API is available with several pricing options.
The BASIC subscription gives you 500 API calls per month, at no cost.
Go ahead and opt for the BASIC subscription and you are good to play around with the API endpoints in the next part of this tutorial.
Visual Crossing Weather API In Action
You will now test both the endpoints of this API to get a feel of the data returned in the API response.
Let’s first try the historical forecast. Select the “GET Historical weather record” endpoint and take a look at the default values.
In this case, we are trying to get the historical weather data for Washington DC between 1st Nov, 2019 to 3rd Nov, 2019 with a granularity of 24 hours. Trigger the endpoint and see the result.
The response that you get from the API is a bunch of values separated by commas. It is a bit difficult to decipher this data unless you save it as a CSV (Comma Separated Value) file. You can do this by copying the response text, pasting it in Notepad or any text pad application and use the “Save As” option to save the file with a .csv extension.
Now you can open that file as an MS Excel spreadsheet.
Is the data making sense now? Yes, it is.
You have got three rows of weather data for 1st , 2nd and 3rd November, for Washington DC. The top most row is the header that contains the column names of each weather parameter field.
Now, let’s try the “GET Weather forecast data” endpoint.
Triggering this endpoint will give us a prediction for the next 7 days aggregated in 24 hours.
If you want more granular data, then you can also set the ‘aggregateHours’ to a value of 1. With this you will get the next seven day prediction spread across hourly data.
Here is a snapshot of the resulting CSV file.
This is a lot of data and will take some time to fathom even for the best of the brains. However, the good part is that the CSV format is a well-accepted data storage format for most databases and data analysis tools. Although it is not ideal for storing big data, it is quite handy for storing small chunks of data for doing a quick analysis and processing jobs. Since a CSV file opens in MS Excel, you can quickly create charts and graphs from it.
It’s now left to your imagination to analyze this data further for the purpose of studying weather and climate patterns. Happy data crunching.
There is one final thing for you to take notice. Make sure to check out the dimension of the data that you get from the API. This is decided by ‘unitGroup’ parameter and by default,set to “us”. But you can also get the value in the “uk” or “metric” scale. For instance, if you need the temperature in Degree Celsius, then you have to set ‘unitGroup’ to a value of “uk”.
That’s all we have for the Visual Crossing Weather API.