83

Where can I find historical raw weather data for a project I am doing with focus on the USA and Canada. I need temperatures mainly, but other details would be nice. I am having a very hard time finding this data. I really dont want to have to scrape a weather site.

AndriuZ
  • 589
  • 5
  • 21
Recursion
  • 2,667
  • 6
  • 35
  • 49

3 Answers3

60

I found myself asking this same question, and will share my experience for future Googlers.

Data sources

I wanted raw data, and lots of it... an API wouldn't do. I needed to head directly to the source. The best source for all of that data seemed to be either the NCEP or NCDC NOMADS servers:

http://nomads.ncdc.noaa.gov/dods/ <- good for historical data
http://nomads.ncep.noaa.gov/dods/ <- good for recent data

(Note: A commenter indicated that you must now use https rather than http. I haven't tested it yet, but if you're having issues, try that!)

To give an idea of the amount of data, their data goes all the way back to 1979! If you're looking for Canada and the US, the North American Regional Reanalysis dataset is probably your best answer.

Using the data

I'm a big python user, and either pydap or NetCDF seemed like good tools to use. For no particular reason, I started playing around with pydap.

To give an example of how to get all of the temperature data for a particular location from the nomads website, try the following in python:

from pydap.client import open_url

# setup the connection
url = 'http://nomads.ncdc.noaa.gov/dods/NCEP_NARR_DAILY/197901/197901/narr-a_221_197901dd_hh00_000'
modelconn = open_url(url)
tmp2m = modelconn['tmp2m']

# grab the data
lat_index = 200    # you could tie this to tmp2m.lat[:]
lon_index = 200    # you could tie this to tmp2m.lon[:]
print tmp2m.array[:,lat_index,lon_index] 

The above snippet will get you a time series (every three hours) of data for the entire month of January, 1979! If you needed multiple locations or all of the months, the above code would easily be modified to accommodate.

To super-data... and beyond!

I wasn't happy stopping there. I wanted this data in a SQL database so that I could easily slice and dice it. A great option for doing all of this is the python forecasting module.

Disclosure: I put together the code behind the module. The code is all open source -- you can modify it to better meet your needs (maybe you're forecasting for Mars?) or pull out little snippets for your project.

My goal was to be able to grab the latest forecast from the Rapid Refresh model (your best bet if you want accurate info on current weather):

from forecasting import Model

rap = Model('rap')
rap.connect(database='weather', user='chef')
fields = ['tmp2m']
rap.transfer(fields)

and then to plot the data on a map of the good 'ole USA:

heat map of usa temperatures with data from sql

The data for the plot came directly from SQL and could easily modify the query to get out any type of data desired.

If the above example isn't enough, check out the documentation, where you can find more examples.

jarrettyeo
  • 1,857
  • 1
  • 21
  • 32
sAlexander
  • 651
  • 2
  • 8
  • 7
  • 1
    I need weather data for all of 2015, which your link for historical data doesn't have - it stops at 201410. Do you have any ideas for me? – rjurney Sep 01 '16 at 21:09
  • All the data coming from the first snippet of code is returning a missing value of 9.999E20. No matter what year I choose or what latitude and longitude index I choose. Any ideas? – Matias Grioni Jan 05 '17 at 01:52
  • Just a quick tip: seems they are only supporting https now; e.g. use url = 'https://nomads.ncdc.noaa.gov/dods/NCEP_NARR_DAILY/197901/197901/narr-a_221_197901dd_hh00_000' – Junier Feb 10 '17 at 19:24
  • 2
    `share my experience for future Googlers` – inspectorG4dget Mar 02 '17 at 16:24
  • 3
    The above link is not accesible – Anagha Sep 12 '17 at 13:33
  • I am probably a little late to this conversation, but can anyone help me get daily rainfall data for a state (say Indiana) for at least the last 10 years. – Amit Makashir Oct 04 '18 at 04:29
  • There's an API that you can use to access historical data. Pretty cool it gives you average temps, precipitation per month/year for a location. https://www.ncdc.noaa.gov/cdo-web/webservices/v2#gettingStarted – Andrew Schultz Feb 13 '19 at 14:24
28

At the United States National Severe Storms Laboratory Historical Weather Data Archive (note: this has since been retired).

Also, the United States National Climatic Data Center Geodata Portal.

The United States National Climatic Data Center Climate Data Online.

The United States National Climatic Data Center Most Popular Products.

sAlexander
  • 651
  • 2
  • 8
  • 7
Gilbert Le Blanc
  • 45,374
  • 5
  • 61
  • 107
1

wunderground.com has a good API. It is free for 500 calls per day.

http://www.wunderground.com/weather/api/

Lance Fisher
  • 25,328
  • 20
  • 91
  • 121
  • This is good for international weather. – philshem Feb 10 '14 at 16:05
  • 47
    Historical data NOT included! – iTurki Sep 17 '15 at 23:31
  • 1
    @Rob I'm not affiliated with wunderground.com Down vote the answer if it's not helpful. – Lance Fisher Sep 15 '16 at 19:17
  • 4
    Actually @iturki I apologize, the other poster is wrong, weather underground dose have the only historical projection API I could find!! – Rob Sep 15 '16 at 19:47
  • Weather underground isn't reliable for weather data. They allow weather station data that is *highly* questionable. Near me there are two weather stations on their site that have a 25F difference in temperature. The two are within half a kilometer of one another. – wilsotc Dec 28 '16 at 07:53
  • Here's why weatherunderground is a terrible source of weather data: https://photos.google.com/photo/AF1QipPKk9x8Orup_8Bx4YH26JtgX4tL4_04EkUIemPY . The Lake Butler Florida weather station is showing 27F while every station around it is reporting 80F. Weather underground doesn't care about accuracy. Any idiot that goes to Canada and installs a weather station can report it's location in Florida and host the data on their website. – wilsotc Jan 01 '17 at 19:24
  • 1
    @wilsotc 27C is 80F. Any idiot from Canada would have known that :). I bet the units were just set wrong. Also, you could have also just discovered a station that included [wind chill](https://en.wikipedia.org/wiki/Wind_chill) in their report. Certainly, can't say for sure, but 25F is well within the range of chill factors. It would be interesting to find out. But yes, I agree, WU should fix/report these discrepancies. – ignorance Feb 20 '18 at 23:30
  • 1
    We've actually been using wunderground.... Unfortunately however, they just changed their terms of use in that you can only use the API if you yourself are hosting a Weather Station... which is why I am researching an alternative. +1 for wunderground as it worked fine for our needs for many years. – Anthony Griggs Apr 02 '19 at 18:01