The InsightR package contains wrapper functions for interacting with the Insight API: http://docs.api.wdtinc.com/insight-api/en/latest/.
API authorization tokens may be obtained from here: http://wdtinc.com/skywise-home/insight-api/
Authenticate("your_app_id", "your_app_key")
lat <- 35 lon <- -97 start <- '2016-01-01' end <- '2016-01-31' gdd <- GrowingDegreeDays (lat, lon, start, end) gdd$response$status_code == 200 [1] TRUE summary(gdd$content$series[[3]]) Min. 1st Qu. Median Mean 3rd Qu. Max. 0.0000 0.0000 0.0000 0.4581 0.0000 5.2000
hp = HourlyPrecipitation(lat, lon, start, end) Warning message: In .call.api("hourly-precipitation", latitude, longitude, start, : Unprocessable Entity (WebDAV; RFC 4918) (HTTP 422). hp$response$status_code [1] 422 hp$content$message [1] "Your date/datetime query exceeded the maximum timespan of this resource." hp = HourlyPrecipitation(lat, lon, "2017-01-01", "2017-01-10") hp$response$status_code == 200 [1] TRUE summary(hp$content$series[[3]]) Min. 1st Qu. Median Mean 3rd Qu. Max. 0.00000 0.00000 0.00000 0.02745 0.00000 3.58000
cdd <- CoolingDegreeDays(lat, lon, "2016-01-01", "2016-12-31") summary(cdd$content$series[[3]]) Min. 1st Qu. Median Mean 3rd Qu. Max. 0.000 0.000 2.600 4.813 9.600 15.800
dp <- DailyPrecipitation(35.235762, -97.428966, "2017-05-01", "2017-06-13") x <- as.Date(dp$content$series[[1]], "%Y-%m-%d") y <- dp$content$series[[3]] sum(y) [1] 39.44 plot(x,y, xlab="date", ylab="precip in mm")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.