1

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

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 
4

1 回答 1

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"
于 2016-04-18T02:58:46.063 回答