I am really new to R and I am trying to use rnoaa to extract information.
I have a set of two dates:
- September 3rd-30th 2013
- December 3rd-31st 2013
and I need to extract daily weather values for Ann Arbor MI, New Haven CT and Los Angeles, CA. I have the station ID for each of these three cities and they are: USC00200230, US090004, US060013, respectively.
Can someone help me extract the values for Daily Min Temp, Max Temp, Humidity, Precipitation, and Sunshine?
So far I have just been able to access the data base:
library(rnoaa) #get rnoaa from your R library to run
library(devtools)
options(noaakey= "mykey")
I am aware that to obtain information I have to enter something in the following format:
noaa(datasetid='NORMAL_DLY', stationid='putinstationidhere', datacategoryid="TEMP")
I am just not knowledgeable of the schema of this data base as I have always used the online version and I am very new to coding in R. The documentation on this is also very sparse so I am hoping someone here knows how to use rnoaa well.
Here is my attempt at what you are asking for.
The station ids have to have the datasetid as a prefix with a colon, so
GHCND:USC00200230
instead ofUSC00200230
You can't pass datacategoryid to the
ncdc
function. See the docs for the API hereFor example, get precipitation data:
Another example, get min temperature
If you leave out the
datatypeid
you get data for all data types.