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> 2022-11-23, 2022-11-24, 2022-11-25, 2022-11-26, 2022-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> 12.2, 8.8, 10.8, 10.3, 14.2, 11.8, 9.6, 7.8
#> $ prec        <dbl> 0.2, 0.8, 0.0, 0.0, 0.1, 6.3, 0.0, 0.0
#> $ tmin        <dbl> 8.1, 6.1, 7.5, 5.1, 11.7, 9.9, 5.9, 3.8
#> $ horatmin    <chr> "23:50", "04:30", "05:30", "23:40", "23:59", "Varias", "23…
#> $ tmax        <dbl> 16.2, 11.5, 14.2, 15.5, 16.7, 13.7, 13.3, 11.9
#> $ horatmax    <chr> "14:30", "13:20", "Varias", "14:50", "15:00", "14:20", "12…
#> $ dir         <chr> "29", "11", "31", "29", "24", "24", "31", "05"
#> $ velmedia    <dbl> 3.3, 2.2, 5.8, 2.5, 3.9, 1.7, 1.4, 1.1
#> $ racha       <dbl> 10.0, 6.1, 14.7, 10.3, 13.6, 6.7, 9.7, 3.6
#> $ horaracha   <time> 11:50:00, 13:20:00, 13:10:00, 00:20:00, 09:10:00, 18:50:00…
#> $ sol         <dbl> 3.0, 0.0, 3.4, 6.8, NA, NA, NA, NA
#> $ presMax     <dbl> 987.9, 989.1, 999.0, 1000.0, 941.6, 942.6, 952.3, 952.6
#> $ horaPresMax <chr> "24", "09", "22", "09", "24", "09", "23", "10"
#> $ presMin     <dbl> 975.6, 985.6, 988.6, 996.6, 934.6, 939.4, 941.9, 949.9
#> $ horaPresMin <chr> "05", "17", "00", "15", "05", "16", "00", "Varias"