database 我在哪里可以找到历史原始天气数据?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3200984/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 07:46:36  来源:igfitidea点击:

Where can I find historical raw weather data?

databasedatasourceweatherweather-api

提问by Recursion

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.

我在哪里可以找到我正在做的专注于美国和加拿大的项目的历史原始天气数据。我主要需要温度,但其他细节会很好。我很难找到这些数据。我真的不想刮天气网站。

采纳答案by Gilbert Le Blanc

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.

美国国家气候数据中心最受欢迎产品

回答by sAlexander

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

我发现自己也在问同样的问题,并将与未来的 Google 员工分享我的经验。

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:

我想要原始数据,还有很多……API 不行。我需要直接前往源头。所有这些数据的最佳来源似乎是 NCEP 或 NCDC NOMADS 服务器:

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

http://nomads.ncdc.noaa.gov/dods/<- 适用于历史数据
http://nomads.ncep.noaa.gov/dods/<- 适用于近期数据

(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!)

(注意:一位评论者表示您现在必须使用 https 而不是 http。我还没有测试过,但如果您遇到问题,请尝试!)

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.

为了了解数据量,他们的数据可以追溯到 1979 年!如果您正在寻找加拿大和美国,北美区域再分析数据集可能是您的最佳答案。

Using the data

使用数据

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

我是 python 的大用户,pydapNetCDF似乎都是很好的工具。没有特别的原因,我开始玩 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:

要举例说明如何从游牧民族网站获取特定位置的所有温度数据,请在 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.

上面的代码片段将为您提供 1979 年 1 月整个月的时间序列(每三个小时)数据!如果您需要多个地点或所有月份,则可以轻松修改上述代码以适应。

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.

我不高兴停在那里。我希望将这些数据保存在 SQL 数据库中,以便我可以轻松地将其切片。完成所有这些工作的一个很好的选择是 python 预测模块。

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):

我的目标是能够从Rapid Refresh 模型中获取最新预测(如果您想要有关当前天气的准确信息,这是您的最佳选择):

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:

然后在 good 'ole USA 的地图上绘制数据:

heat map of usa temperatures with data from sql

来自 sql 数据的美国温度热图

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

绘图的数据直接来自 SQL,可以轻松修改查询以获取所需的任何类型的数据。

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

如果以上示例还不够,请查看文档,您可以在其中找到更多示例。

回答by Lance Fisher

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

wunderground.com 有一个很好的 API。每天拨打 500 次免费。

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

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