Skip to contents

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
)

aemet_daily_period(
  station,
  start = 2020,
  end = 2020,
  verbose = FALSE,
  return_sf = FALSE
)

aemet_daily_period_all(
  start = 2020,
  end = 2020,
  verbose = FALSE,
  return_sf = 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 or FALSE. Should the function return an sf spatial object? If FALSE (the default value) it returns a tibble. Note that you need to have the sf package installed.

Value

A tibble or a sf object

Details

start and end parameters should be:

  • For aemet_daily_clim(): A Date object or a string with format: YYYY-MM-DD (2020-12-31) coercible with as.Date().

  • For aemet_daily_period() and aemet_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().

Examples


library(tibble)
obs <- aemet_daily_clim(c("9434", "3195"))
glimpse(obs)
#> Rows: 8
#> Columns: 20
#> $ fecha       <date> 2023-03-22, 2023-03-23, 2023-03-24, 2023-03-25, 2023-03-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> 15.8, 19.8, 18.8, 14.6, 15.1, 14.8, 14.4, 14.6
#> $ prec        <dbl> 0, 0, 0, 0, 0, 0, 0, 0
#> $ tmin        <dbl> 7.3, 11.2, 13.4, 7.5, 8.6, 8.3, 9.9, 8.4
#> $ horatmin    <time> 06:00:00, 05:50:00, 23:59:00, 05:20:00, 06:50:00, 06:30:00…
#> $ tmax        <dbl> 24.2, 28.4, 24.1, 21.7, 21.6, 21.2, 19.0, 20.7
#> $ horatmax    <time> 14:40:00, 14:20:00, 15:50:00, 15:50:00, 15:20:00, 13:40:00…
#> $ dir         <dbl> 12, 25, 27, 12, 24, 25, 27, 25
#> $ velmedia    <dbl> 2.8, 2.2, 4.2, 2.2, 2.2, 2.5, 1.9, 1.9
#> $ racha       <dbl> 7.2, 10.8, 13.3, 7.2, 8.3, 10.6, 7.5, 10.3
#> $ horaracha   <time> 16:00:00, 12:10:00, 08:10:00, 14:00:00, 15:40:00, 16:00:00…
#> $ sol         <dbl> 9.5, 10.1, 5.0, 7.3, NA, NA, NA, NA
#> $ presMax     <dbl> 986.8, 984.5, 991.2, 993.3, 940.5, 939.6, 945.0, 946.4
#> $ horaPresMax <chr> "08", "09", "24", "09", "10", "Varias", "23", "10"
#> $ presMin     <dbl> 982.0, 979.9, 983.2, 986.9, 937.5, 937.4, 939.0, 942.3
#> $ horaPresMin <chr> "17", "16", "Varias", "Varias", "16", "15", "00", "17"