Get climatology values for a station or for all the available stations.
Note that aemet_daily_period()
and aemet_daily_period_all()
are shortcuts
of aemet_daily_clim()
.
Usage
aemet_daily_clim(
station = "all",
start = Sys.Date() - 7,
end = Sys.Date(),
verbose = FALSE,
return_sf = FALSE,
extract_metadata = FALSE
)
aemet_daily_period(
station,
start = as.integer(format(Sys.Date(), "%Y")),
end = start,
verbose = FALSE,
return_sf = FALSE,
extract_metadata = FALSE
)
aemet_daily_period_all(
start = as.integer(format(Sys.Date(), "%Y")),
end = start,
verbose = FALSE,
return_sf = FALSE,
extract_metadata = FALSE
)
Arguments
- station
Character string with station identifier code(s) (see
aemet_stations()
) or "all" for all the stations.- start, end
Character string with start and end date. See Details.
- verbose
Logical
TRUE/FALSE
. Provides information about the flow of information between the client and server.- return_sf
Logical
TRUE
orFALSE
. Should the function return ansf
spatial object? IfFALSE
(the default value) it returns atibble
. Note that you need to have the sf package installed.- extract_metadata
Logical
TRUE/FALSE
. OnTRUE
the output is atibble
with the description of the fields. See alsoget_metadata_aemet()
.
Details
start
and end
parameters should be:
For
aemet_daily_clim()
: ADate
object or a string with format: YYYY-MM-DD (2020-12-31) coercible withas.Date()
.For
aemet_daily_period()
andaemet_daily_period_all()
: A string representing the year(s) to be extracted: "2020", "2018".
API Key
You need to set your API Key globally using aemet_api_key()
.
See also
Other aemet_api_data:
aemet_extremes_clim()
,
aemet_forecast_daily()
,
aemet_last_obs()
,
aemet_monthly
,
aemet_normal
,
aemet_stations()
Examples
library(tibble)
obs <- aemet_daily_clim(c("9434", "3195"))
glimpse(obs)
#> Rows: 8
#> Columns: 25
#> $ fecha <date> 2024-04-10, 2024-04-11, 2024-04-12, 2024-04-13, 2024-04-1…
#> $ indicativo <chr> "9434", "9434", "9434", "9434", "3195", "3195", "3195", "3…
#> $ nombre <chr> "ZARAGOZA, AEROPUERTO", "ZARAGOZA, AEROPUERTO", "ZARAGOZA,…
#> $ provincia <chr> "ZARAGOZA", "ZARAGOZA", "ZARAGOZA", "ZARAGOZA", "MADRID", …
#> $ altitud <dbl> 249, 249, 249, 249, 667, 667, 667, 667
#> $ tmed <dbl> 13.4, 17.6, 17.6, 20.1, 13.8, 18.2, 18.0, 20.0
#> $ prec <dbl> 0, 0, 0, 0, 0, 0, 0, 0
#> $ tmin <dbl> 7.8, 11.0, 7.9, 10.1, 6.9, 9.9, 11.1, 12.8
#> $ horatmin <chr> "00:00", "Varias", "05:30", "05:30", "06:10", "05:20", "05…
#> $ tmax <dbl> 19.0, 24.2, 27.2, 30.1, 20.7, 26.5, 24.8, 27.1
#> $ horatmax <time> 15:40:00, 17:20:00, 17:20:00, 16:00:00, 16:30:00, 15:40:00…
#> $ dir <chr> "31", "31", "30", "24", "03", "11", "12", "04"
#> $ velmedia <dbl> 10.0, 4.2, 1.1, 1.1, 1.4, 2.5, 0.8, 1.7
#> $ racha <dbl> 21.1, 16.4, 4.2, 5.0, 8.9, 8.9, 5.0, 5.3
#> $ horaracha <time> 22:50:00, 00:20:00, 14:30:00, 19:40:00, 20:20:00, 13:40:00…
#> $ sol <dbl> 12.0, 12.2, 12.7, 12.7, NA, NA, NA, NA
#> $ presMax <dbl> 1001.5, 1000.4, 1001.6, 999.2, 952.3, 953.3, 954.0, 951.9
#> $ horaPresMax <chr> "00", "Varias", "09", "08", "Varias", "24", "09", "08"
#> $ presMin <dbl> 995.7, 997.3, 997.0, 993.4, 949.1, 948.2, 950.0, 947.3
#> $ horaPresMin <chr> "18", "17", "18", "18", "15", "16", "18", "Varias"
#> $ hrMedia <dbl> 41, 37, 42, 37, 47, 50, 41, 38
#> $ hrMax <dbl> 75, 62, 80, 72, 70, 85, 67, 71
#> $ horaHrMax <chr> "00:00", "23:59", "04:20", "Varias", "04:50", "06:10", "06…
#> $ hrMin <dbl> 29, 24, 20, 15, 30, 28, 25, 18
#> $ horaHrMin <chr> "Varias", "16:40", "17:00", "Varias", "14:20", "16:00", "1…
# Metadata
meta <- aemet_daily_clim(c("9434", "3195"), extract_metadata = TRUE)
glimpse(meta$campos)
#> Rows: 25
#> Columns: 5
#> $ id <chr> "fecha", "indicativo", "nombre", "provincia", "altitud", "…
#> $ descripcion <chr> "fecha del dia (AAAA-MM-DD)", "indicativo climatológico", …
#> $ tipo_datos <chr> "string", "string", "string", "string", "float", "float", …
#> $ requerido <lgl> TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, …
#> $ unidad <chr> NA, NA, NA, NA, "m", "°C", "mm (Ip = inferior a 0,1 mm) (A…