Obtain info and metadata for the available stations in the different services
get_stations_info_from(
service = c("aemet", "meteocat", "meteoclimatic", "meteogalicia", "ria"),
options
)
Character with the service name (in lower case).
List with the needed service options. See services_options
to have more info
about the different services and their options.
An sf (spatial) object with the stations metadata.
Depending on the service the metadata available can be different. Also, some services only offer
info for active stations (i.e. AEMET), not historical stations, so some mismatch can occur between
the stations returned by this function and the stations returned by get_meteo_from
for
historical dates.
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_stations_info_from)
can be used.
# \donttest{
if (identical(Sys.getenv("NOT_CRAN"), "true")) {
library(meteospain)
library(keyring)
# AEMET (we need a key)
# key_set('aemet')
api_options <- aemet_options(api_key = key_get('aemet'))
get_stations_info_from('aemet', api_options)
}
#> Simple feature collection with 291 features and 5 fields
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: -17.91528 ymin: 27.73583 xmax: 4.215556 ymax: 43.78611
#> Geodetic CRS: WGS 84
#> # A tibble: 291 × 6
#> service station_id station_name station_province altitude
#> * <chr> <chr> <chr> <chr> [m]
#> 1 aemet 0252D ARENYS DE MAR BARCELONA 74
#> 2 aemet 0076 BARCELONA AEROPUERTO BARCELONA 4
#> 3 aemet 0200E BARCELONA, FABRA BARCELONA 408
#> 4 aemet 0201D BARCELONA BARCELONA 6
#> 5 aemet 0149X MANRESA BARCELONA 291
#> 6 aemet 0229I SABADELL AEROPUERTO BARCELONA 146
#> 7 aemet 0255B SANTA SUSANNA BARCELONA 40
#> 8 aemet 0367 GIRONA AEROPUERTO GIRONA 143
#> 9 aemet 0370B GIRONA, ANTIC INSTITUT GIRONA 95
#> 10 aemet 0372C PORQUERES GIRONA 157
#> # ℹ 281 more rows
#> # ℹ 1 more variable: geometry <POINT [°]>
# }