get_meteo_from | R Documentation |
Connect and retrieve data from AEMET, SMC and other Spanish meteorological stations services.
get_meteo_from(
service = c("aemet", "meteocat", "meteoclimatic", "meteogalicia", "ria"),
options
)
service |
Character with the service name (in lower case). |
options |
List with the needed service options. See |
Depending on the service and the temporal resolution selected, the variables present can change, but all services have at least temperature values.
An sf (spatial) object with the stations meteorological data.
Some APIs have limits in terms of the data that can be retrieved with one call. For example, AEMET
only serves daily data for 31 days in one query. See vignette('api_limits', package = 'meteospain')
for a detailed explanations of those limits and the ways to retrieve longer periods.
In order to avoid unnecessary API calls, results of this function are cached in memory with
memoise
. This means that subsequent calls from get_meteo_from
with the same
arguments will be faster as they will not call the meteorological service API. This cache has a maximum
size of 1024 MB and persist 24 hours in the same R session after loading the package.
To forgot the cache, memoise::forget(get_meteo_from)
can be used.
if (identical(Sys.getenv("NOT_CRAN"), "true")) {
library(meteospain)
library(keyring)
# AEMET (we need a key)
# key_set('aemet')
options_for_aemet <- aemet_options(
'daily',
start_date = as.Date('2012-01-01'),
end_date = as.Date('2012-02-01'),
api_key = key_get('aemet')
)
get_meteo_from('aemet', options_for_aemet)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.