R rnoaa年度业绩 - 未找到数据

时间:2016-04-17 20:57:55

标签: r database statistics rnoaa

我目前正在尝试配置rnoaa库以将城市,州数据与气象站连接,从而输出年度天气数据,即温度。我已经包含了一个硬编码的输入作为参考,但我打算最终在数百个地理编码的城市进食。这不是问题,而是检索数据。

require(rnoaa)
require(ggmap)

city<-geocode("birmingham, alabama", output = "all")
bounds<-city$results[[1]]$geometry$bounds

se<-bounds$southwest$lat
sw<-bounds$southwest$lng
ne<-bounds$northeast$lat
nw<-bounds$northeast$lng

stations<-ncdc_stations(extent = c(se, sw, ne, nw),token = noaakey)

我正在计算地理区域周围的MBR(矩形),在这种情况下是伯明翰,然后得到一个站点列表。然后我拉出station_id,然后尝试使用任何类型的参数检索结果,但没有成功。我希望将年度气温与每个城市联系起来。

test  <- ncdc(datasetid = "ANNUAL", locationid = topStation[1], 
datatypeid = "DSNW",startdate = "2000-01-01", enddate = "2010-01-01", 
limit = 1000, token = noaakey)

Warning message:
Sorry, no data found 

1 个答案:

答案 0 :(得分:2)

看起来位置ID正在创建问题。尝试没有它(因为它是可选字段)

ncdc_locs(datasetid = "ANNUAL",datatypeid = "DSNW",startdate = "2000-01-01", enddate = "2010-01-01", limit = 1000,token =  <your token key>)

然后使用有效的位置ID

ncdc_locs(datasetid = "ANNUAL",datatypeid = "DSNW",startdate = "2000-01-01", enddate = "2010-01-01", limit = 1000,locationid='CITY:US000001',token =  <your token>)

返回

$meta
NULL

$data
     mindate    maxdate                name datacoverage            id
1 1872-01-01 2016-04-16 Washington D.C., US            1 CITY:US000001

attr(,"class")
[1] "ncdc_locs"