Skip to contents

Get monthly/annual climatology values for a station or all the stations. aemet_monthly_period() and aemet_monthly_period_all() allows requests that span several years.

Usage

aemet_monthly_clim(
  station = NULL,
  year = as.integer(format(Sys.Date(), "%Y")),
  verbose = FALSE,
  return_sf = FALSE,
  extract_metadata = FALSE
)

aemet_monthly_period(
  station = NULL,
  start = as.integer(format(Sys.Date(), "%Y")),
  end = start,
  verbose = FALSE,
  return_sf = FALSE,
  extract_metadata = FALSE
)

aemet_monthly_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())

year

Numeric value as date (format: YYYY).

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.

extract_metadata

Logical TRUE/FALSE. On TRUE the output is a tibble with the description of the fields. See also get_metadata_aemet().

start

Numeric value as start year (format: YYYY).

end

Numeric value as end year (format: YYYY).

Value

A tibble or a sf object

API Key

You need to set your API Key globally using aemet_api_key().

Examples


library(tibble)
obs <- aemet_monthly_clim(station = c("9434", "3195"), year = 2000)
glimpse(obs)
#> Rows: 26
#> Columns: 45
#> $ fecha      <chr> "2000-10", "2000-11", "2000-12", "2000-13", "2000-1", "2000…
#> $ indicativo <chr> "9434", "9434", "9434", "9434", "9434", "9434", "9434", "94…
#> $ p_max      <chr> "45.4(21)", "16.2(05)", "4.8(22)", "45.4(21/oct)", "8.0(15)…
#> $ n_cub      <dbl> 6, 6, 7, 49, 8, 0, 4, 8, 6, 2, 1, 1, 0, 3, 9, 18, 63, 5, 1,…
#> $ hr         <dbl> 67, 73, 78, 62, 77, 60, 58, 61, 61, 57, 48, 53, 53, 59, 77,…
#> $ n_gra      <dbl> 0, 1, 0, 3, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,…
#> $ n_fog      <dbl> 0, 2, 4, 14, 6, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 1, 6, 3, 0, 0…
#> $ inso       <dbl> 5.6, 5.2, 3.6, 7.7, 5.4, 7.7, 7.8, 6.2, 8.7, 11.3, 11.2, 10…
#> $ q_max      <chr> "996.9(17)", "995.3(11)", "1000.7(11)", "1004.9(04/feb)", "…
#> $ nw_55      <dbl> 4, 5, 3, NA, 5, 9, 8, 7, NA, NA, 5, 8, 3, 1, 2, 2, 16, 0, 0…
#> $ q_mar      <dbl> 1016.9, 1014.3, 1015.0, 1016.9, 1026.0, 1027.1, 1020.3, 100…
#> $ q_med      <dbl> 986.6, 983.4, 983.9, 986.6, 994.1, 996.0, 989.5, 977.8, 984…
#> $ tm_min     <dbl> 11.2, 6.0, 5.1, 10.1, -0.1, 4.8, 6.0, 8.4, 13.2, 16.0, 17.7…
#> $ ta_max     <chr> "27.6(04)", "21.0(27)", "21.6(07)", "38.2(20/ago)", "16.3(3…
#> $ ts_min     <dbl> 14.9, 10.0, 10.6, 21.5, 6.2, 10.7, 11.0, 14.9, 18.8, 20.3, …
#> $ nt_30      <dbl> 0, 0, 0, 76, 0, 0, 0, 0, 5, 19, 19, 21, 12, 0, 0, 0, 65, 0,…
#> $ nv_0050    <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ n_des      <dbl> 3, 1, 1, 88, 12, 8, 8, 1, 1, 18, 14, 12, 9, 3, 3, 2, 113, 1…
#> $ w_racha    <chr> "31/19.2(06)", "27/18.6(06)", "30/25.8(30)", NA, "32/22.2(2…
#> $ np_100     <dbl> 4, 3, 0, 12, 0, 0, 0, 1, 3, 1, 0, 0, 0, 0, 4, 7, 21, 1, 0, …
#> $ n_nub      <dbl> 22, 23, 23, 229, 11, 21, 19, 21, 24, 10, 16, 18, 21, 25, 18…
#> $ p_sol      <dbl> 51, 53, 39, 62, 56, 72, 65, 46, 59, 75, 76, 76, 75, 61, 44,…
#> $ nw_91      <dbl> 0, 0, 1, NA, 0, 0, 0, 0, NA, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ ts_20      <dbl> 17.8, 10.6, 9.0, 18.8, 4.9, 11.8, 14.9, 16.7, 23.5, 27.7, 3…
#> $ np_001     <dbl> 10, 14, 14, 88, 3, 0, 7, 10, 13, 6, 4, 4, 3, 5, 16, 18, 98,…
#> $ ta_min     <chr> "6.2(18)", "0.3(10)", "-0.8(17)", "-5.8(12/ene)", "-5.8(12)…
#> $ e          <dbl> 116, 91, 90, 116, 65, 79, 83, 99, 143, 164, 153, 172, 139, …
#> $ np_300     <dbl> 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ nv_1000    <dbl> 0, 0, 1, 7, 5, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 4, 2, 0, 0,…
#> $ evap       <dbl> 2111, 1042, 783, 25222, 861, 1638, 2062, 1730, 2116, 2955, …
#> $ p_mes      <dbl> 104.5, 61.5, 22.6, 375.1, 14.9, 0.0, 11.1, 49.1, 67.5, 34.9…
#> $ n_llu      <dbl> 12, 14, 17, 103, 3, 0, 7, 14, 11, 8, 4, 6, 7, 5, 16, 19, 97…
#> $ n_tor      <dbl> 0, 1, 0, 23, 0, 0, 0, 1, 8, 4, 1, 5, 3, 0, 0, 0, 11, 0, 0, …
#> $ ts_10      <dbl> 17.7, 10.6, 8.7, 19.5, 5.0, 12.7, 15.7, 17.5, 24.8, 29.2, 3…
#> $ w_med      <dbl> 15, 15, 14, 16, 15, 16, 18, 17, 13, 21, 19, 18, 14, 8, 8, 8…
#> $ nt_00      <dbl> 0, 0, 2, 23, 16, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 14, 13, 0…
#> $ ti_max     <dbl> 14.5, 10.0, 7.5, 1.0, 1.0, 13.4, 12.1, 11.7, 21.5, 16.5, 22…
#> $ n_nie      <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0,…
#> $ tm_mes     <dbl> 15.8, 10.2, 9.1, 15.8, 4.3, 10.8, 12.0, 13.7, 19.5, 23.0, 2…
#> $ tm_max     <dbl> 20.4, 14.4, 13.1, 21.5, 8.7, 16.9, 17.9, 18.9, 25.7, 29.8, …
#> $ nv_0100    <dbl> 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ ts_50      <dbl> 18.4, 11.5, 9.8, 17.9, 5.6, 10.6, 13.6, 15.2, 20.8, 26.1, 2…
#> $ q_min      <chr> "966.6(11)", "964.3(06)", "961.8(27)", "959.5(02/abr)", "97…
#> $ np_010     <dbl> 7, 9, 8, 54, 2, 0, 4, 6, 8, 5, 3, 1, 1, 4, 11, 14, 66, 3, 1…
#> $ w_rec      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 180, 20…