How can I download weather history data as a CSV file?

Historical information such as precipitation, wind speed, temperature, snowfall, and temperature can be vital information for organizations in order to create plans and maximize output. For example, if rain is typically expected in certain cities at certain times of the year, you’ll be better equipped for exigencies such as a storm during an outdoor event. 

While accessing climate data online may be helpful for some use cases, many wish to have their own widget optimized for their needs. This is where a weather data CSV comes in handy. The information collected in these datasets will make sure that you’re familiar with what week typically has in store and can prepare accordingly.

In this article, we will show you how to gather historical weather data as a standard file that can be imported into thousands of data analysis and storage applications such as business intelligence systems, visualization tools, statistical analysis packages, and databases.

If you would like to retrieve forecast data, see the companion article.

How to download weather data

6 Easy Steps to Get Your Weather History Data CSV File

The estimated time to complete this exercise is less than 5 minutes.

Step 1 – Sign-up/Sign-in

Start by visiting the Visual Crossing signup page and creating an account, or simply sign in to your existing account if you have already created one. Visual Crossing offers many different subscriptions, including a free option. Visit the visualcrossing.com web page to get started and follow the appropriate links to access your account.

This image has an empty alt attribute

Step 2 – Open the Query Builder

The Visual Crossing Query Builder is designed for both simple users as well as advanced API users to either retrieve data or build a URL query string that can be used to access our RESTful API service and retrieve data dynamically through virtually any scripting language, ETL, Excel, PowerBI or other data tools. In this exercise we will focus on retrieving a CSV (comma separated values) dataset for you to directly send to your device as a standalone file.

Let’s start by choosing the ‘Query Builder’ link from the home page we started with above. Here is a shortcut: Visual Crossing Weather Data Query Builder

This image has an empty alt attribute

When you visit the query builder page for the first time, the system will request that you provide a starting location for your query.

This image has an empty alt attribute

To get started you can provide the Query Builder with the area you wish to find data for. This can be as simple as a Zip Code (60633), A latitude/longitude pair in DD format and comma separated, city name with either state or country (Chicago, IL) for completeness or a full street address of any global location. This value that you enter will be converted to a specific point on the globe so that the system can find the weather data for that exact location.

NOTE: Visual Crossing does not snap your location to a single nearest National Weather Service station; it instead will use more than one weather station to interpolate more exact conditions for your detailed, custom location. The more accurate the location you give, the more accurate your result will be.

Once entered, hit the search icon to move to the next step.

Step 3 – Building the Weather Query

After entering our location we can now see our Query Builder, and it has already started a query for you. Here is a quick anatomy of the page for your reference:

This image has an empty alt attribute

We will not cover the entire feature usage of the Query Builder in this tutorial, but we will refer to these different sections. The simple steps we will take are: 1) provide location (done!), 2) provide historical time window & finally 3) download the data, which has a few options for us.

Step 4 – Choose a Historical Time Period

The first thing to understand is that Visual Crossing’s Query Builder uses the Timeline Weather API. This powerful API allows us to choose any dates we wish even if they go from the past into the future.

In this exercise we will only include dates in the past as we are looking to get our data in In this exercise, we will only include past dates as we are looking to get our data in CSV format. In the image above, you can click on the title of the Time Period section, which currently shows “Next 15 days”. This default query is for a forecast. When we click on this section, we can see all of our time period options:

By choosing “Date range”, we are telling the Query Builder that we want to select our own dates for this query. We do this next by choosing our start and end dates:

In our example, we are choosing dates from January 1st, 2015 -> December 22nd, 2021. While using the Date Chooser, you can use the arrows to change months or click on the Month-Year title to change by years and months.

We now have finished the Location and Time Period for our query.

Step 5 – Preview Results & Download

Every time we make a change to the query sections, the Data Preview Window automatically updates with a sample of our data. By default, our view is “Grid”, and our Data Result Section is set to “daily” to show us daily results for our time period on a formatted grid:

Please note that the Results Preview Window is just a view of many possible data sets that Please note that the Results Preview Window is just a view of many possible data sets that this query can retrieve. The actual query retrieves more data for different sections, including daily or hourly data, station info, query information, and Current Weather, Events, and Alerts.

If you are retrieving results in JSON, you can get all of these in the same result. However, for a simple table format, we have to choose the one we want, and we will do that by downloading the data. This tutorial focuses on the most common Weather Data section as either daily or hourly granularity.

The Viewer Mode buttons can show you more than just the Grid we see above. You can view the JSON results in raw form, Charts of summary data, a copy/paste URL query string that you can paste into a browser, or a script for dynamic queries.

Back to our task at hand…. Let’s retrieve the data file.

Start by clicking on the “Download” button on the right side of the Query Builder.

Step 6 – Download Options

As we can see in the image below, after clicking the “Download” button, Query Builder asks As we can see in the image below, after clicking the button, Query Builder asks us for the format type, and we choose the ‘Daily’ dataset that we want to output. We can easily choose to get hourly data here instead for 24x greater results by hour of day.

NOTE: If you are a JSON user, you can get all of these sets in a single result set, but remember that JSON is not easily read in a table format or importable into Excel. This is for users that are set up to parse JSON results through a script or application.

Now we can click our “Submit” button, and you will have your data results automatically downloaded via your browser as a file.

If you automatically downloaded the file to your system via the browser, you will see it in the file section of your browser. For more secure systems, you will need to click the blue button to complete the process.

NOTE: If later you want to retrieve this exact file again, you can visit the “My Datasets” link from the main Query Builder page.

You can now open your CSV file in Notepad, Excel or any other system that supports this format and begin your weather analysis!

Additional Thoughts

There many, many settings for you to explore in Query Builder and here a few common requests that our users have:

Schedule

During this step, certain license levels can choose to schedule a daily refresh of this dataset. As with all datasets, the scheduled runs will appear in “My Datasets” section for later retrieval. Scheduled sets also have a permalink to the latest version of the dataset in your archive.

Cost

In Query Builder, you will see the “Metered” cost for the data you are about to fetch. The metered cost is currently $.0001 per result row of weather data. Limiting columns or other features do not affect the cost. Also, a single 15-day forecast counts as 1 row of result data.

NOTE: Please use caution when making changes and re-downloads in Query Builder. You are charged every time a unique data set request is submitted. Any slight changes and re-download are billed in full. Only file datasets found in “My Datasets” are free to re-access.

Element Choice: If you select “Weather Elements” you can choose a specific set of weather elements to bring back in your dataset:

Units of Measure:

DepDepending on your usage and your geographic location, you may prefer to have your results in a different data unit, which is easily selectable from the Query Builder:

Additional Data

If you would like to learn more about using Visual Crossing Weather options such as weather forecasts, multiple location import, and use within other analysis tools, please see our other tutorials.