This is a package that simplifies downloading a few climate indices.
This package is not in CRAN right now. Just install using devtools and github
devtools::install_github('mbertolacci/climatedata')
This package helps you download a few climate indices for use in data analysis. At present, indices for the Indian Ocean Dipole, the Southern Oscillation Index, and the Southern Annular Mode are supported.
There are three functions for download data, load_iod
, load_soi
and load_sam
. Common to each of these is an argument named filename
(defaults described for each call), wherein the downloaded data will be cached so that subsequent calls to this function do not require internet connectivity. This behaviour can be disabled by setting filename = NULL
.
To download this index, call
iod_data <- climatedata::load_iod()
This will also create a file in the working directory, 'iod.rds', caching this data, so subsequent calls do not go to the server (see Overview for more details). Data for this formerly came from JAMSTEC, but their website is currently having difficulties. If that is fixed, the JAMSTEC data will be accessible using climatedata::load_iod(source = 'jamstec')
. Note that the JAMSTEC and NOAA values may differ due to differing methodologies; please read the documentation for the respective sources and pick the best for your use.
To download this index, call
soi_data <- climatedata::load_soi()
This will also create a file in the working directory, 'soi.rds', caching this data, so subsequent calls do not go to the server (see Overview for more details).
To download this index, call
sam_data <- climatedata::load_sam(data_source = 'marshall')
for the Marshall index, and
sam_data <- climatedata::load_sam(data_source = 'hadslp2')
for the HadSLP2 source, where the latter is calculated as per Gong and Wang (1999).
Given a data set, say soi_data
above, you can retrieve rows matching dates by running the get_for_dates
function. An example usage is
dates <- as.POSIXct(c('2018-01-01', '2010-05-20'))
soi_for_dates <- climatedata::get_for_dates(soi_data, dates)
If you want to get the data for the month prior to the dates, you can run
soi_for_dates <- climatedata::get_for_dates(soi_data, dates, lag = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.