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: 5
#> Columns: 20
#> $ fecha       <date> 2022-08-10, 2022-08-10, 2022-08-11, 2022-08-12, 2022-08-13
#> $ indicativo  <chr> "9434", "3195", "3195", "3195", "3195"
#> $ nombre      <chr> "ZARAGOZA, AEROPUERTO", "MADRID, RETIRO", "MADRID, RETIRO…
#> $ provincia   <chr> "ZARAGOZA", "MADRID", "MADRID", "MADRID", "MADRID"
#> $ altitud     <dbl> 249, 667, 667, 667, 667
#> $ tmed        <dbl> 30.6, 30.8, 30.4, 30.0, 24.2
#> $ tmin        <dbl> 22.7, 25.0, 24.2, 23.2, 20.6
#> $ horatmin    <time> 05:20:00, 05:40:00, 05:50:00, 05:30:00, 23:59:00
#> $ tmax        <dbl> 38.5, 36.6, 36.6, 36.7, 27.8
#> $ horatmax    <time> 14:40:00, 14:30:00, 14:20:00, 14:00:00, 09:20:00
#> $ dir         <chr> "09", "17", "12", "24", "19"
#> $ velmedia    <dbl> 2.5, 2.2, 1.7, 2.2, 2.2
#> $ racha       <dbl> 9.2, 11.1, 8.9, 9.7, 13.9
#> $ horaracha   <time> 21:10:00, 21:30:00, 00:10:00, 14:50:00, 09:50:00
#> $ sol         <dbl> 11.2, NA, NA, NA, NA
#> $ presMax     <dbl> 988.0, 941.7, 940.5, 940.8, 941.4
#> $ horaPresMax <chr> "07", "07", "08", "09", "13"
#> $ presMin     <dbl> 982.1, 936.2, 937.4, 937.5, 937.1
#> $ horaPresMin <chr> "18", "19", "18", "18", "02"
#> $ prec        <dbl> NA, 0, 0, 0, 0