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,
progress = TRUE
)
aemet_daily_period(
station,
start = as.integer(format(Sys.Date(), "%Y")),
end = start,
verbose = FALSE,
return_sf = FALSE,
extract_metadata = FALSE,
progress = TRUE
)
aemet_daily_period_all(
start = as.integer(format(Sys.Date(), "%Y")),
end = start,
verbose = FALSE,
return_sf = FALSE,
extract_metadata = FALSE,
progress = TRUE
)
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()
.- progress
Logical, display a
cli::cli_progress_bar()
object. Ifverbose = TRUE
won't be displayed.
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_alert_zones()
,
aemet_alerts()
,
aemet_beaches()
,
aemet_extremes_clim()
,
aemet_forecast_beaches()
,
aemet_forecast_daily()
,
aemet_forecast_fires()
,
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-11-20, 2024-11-21, 2024-11-22, 2024-11-23, 2024-11-2…
#> $ 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> 14.2, 14.6, 9.5, 8.3, 12.6, 10.8, 12.4, 11.2
#> $ prec <dbl> 0.0, 1.4, 0.0, 0.0, 0.0, 0.0, 0.4, 0.0
#> $ tmin <dbl> 10.0, 10.3, 5.3, 3.8, 8.6, 8.5, 9.6, 8.0
#> $ horatmin <time> 02:20:00, 01:10:00, 23:50:00, 03:50:00, 07:20:00, 06:10:00…
#> $ tmax <dbl> 18.4, 18.9, 13.7, 12.8, 16.5, 13.2, 15.3, 14.3
#> $ horatmax <time> 13:00:00, 12:50:00, 00:00:00, 14:50:00, 14:40:00, 15:00:00…
#> $ dir <chr> "30", "28", "31", "12", "28", "26", "25", "05"
#> $ velmedia <dbl> 4.4, 12.5, 6.1, 3.1, 2.2, 3.3, 1.7, 1.1
#> $ racha <dbl> 11.1, 22.2, 15.6, 8.6, 10.3, 12.5, 11.1, 4.2
#> $ horaracha <time> 13:10:00, 13:20:00, 13:30:00, 12:30:00, 10:20:00, 13:00:00…
#> $ sol <dbl> 6.0, 2.6, 7.6, 4.9, NA, NA, NA, NA
#> $ presMax <dbl> 986.8, 985.1, 993.6, 995.2, 942.9, 941.4, 944.1, 945.8
#> $ horaPresMax <chr> "09", "00", "22", "10", "11", "00", "23", "10"
#> $ presMin <dbl> 984.9, 975.9, 977.2, 992.8, 940.7, 935.1, 934.9, 943.4
#> $ horaPresMin <chr> "14", "Varias", "00", "16", "04", "24", "01", "01"
#> $ hrMedia <dbl> 62, 52, 62, 78, 65, 82, 72, 87
#> $ hrMax <dbl> 87, 89, 96, 92, 95, 93, 91, 95
#> $ horaHrMax <chr> "00:00", "23:59", "00:30", "23:59", "03:50", "Varias", "06…
#> $ hrMin <dbl> 47, 44, 47, 64, 47, 65, 47, 61
#> $ horaHrMin <time> 12:50:00, 13:00:00, 15:20:00, 11:40:00, 14:50:00, 00:10:0…
# 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…