get_meteo_from {meteospain}R Documentation

Get meteorological stations data

Description

Connect and retrieve data from AEMET, SMC and other Spanish meteorological stations services.

Usage

get_meteo_from(
  service = c("aemet", "meteocat", "meteoclimatic", "meteogalicia", "ria"),
  options
)

Arguments

service

Character with the service name (in lower case).

options

List with the needed service options. See services_options to have more info about the different services and their options.

Details

Depending on the service and the temporal resolution selected, the variables present can change, but all services have at least temperature values.

Value

An sf (spatial) object with the stations meteorological data.

API limits

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.

Cache

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.

Examples


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)
}



[Package meteospain version 0.1.4 Index]