1

I am currently trying to configure the rnoaa library to connect city, state data with a weather station, and therefore output ANNUAL weather data, namely temperature. I have included a hardcoded input for reference, but I intend on feeding in hundreds of geocoded cities eventually. This isn't the issue so much as it is retrieving data.

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)

I am calculating a MBR (rectangle) around the geographic area, in this case Birmingham, and then getting a list of stations. I'm then pulling out the station_id and then attempting to retrieve results with any type of parameters with no success. I'm looking to associate annual temperatures with each city.

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 
www
  • 38,575
  • 12
  • 48
  • 84
rws
  • 31
  • 6

1 Answers1

2

Looks like location ID is creating issue. Try without it ( as it is optional field )

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

and then with valid location ID

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

returns

$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"
Chirag
  • 1,478
  • 16
  • 20