meteospain 0.1.2 is available!

2023-03-23

meteospain R package bumped to 0.1.2

meteospain, the R package to access data of Spanish meteorology stations, reachs version 0.1.2. Now, meteospain allows for downloading “monthly” and “yearly” AEMET data (besides the already implemented “current_day” and “daily”):

 1library(meteospain)
 2library(ggplot2)
 3library(units)
 4## udunits database from /usr/share/udunits/udunits2.xml
 5library(purrr)
 6
 7leon_stations <- c("1549", "2661", "2630X")
 8
 9leon_1992 <- leon_stations |>
10  map(
11    .f = \(station) {
12      get_meteo_from(
13        'aemet',
14        aemet_options(
15          'monthly', start_date = as.Date('1992-01-01'),
16          api_key = Sys.getenv("aemet"),
17          stations = station
18        )
19      )
20    }
21  ) |>
22  list_rbind() |>
23  sf::st_as_sf()
24
25## ℹ © AEMET. Autorizado el uso de la información y su reproducción citando a
26##   AEMET como autora de la misma.
27## https://www.aemet.es/es/nota_legal
28
29
30leon_1992 |>
31  ggplot(aes(x = as.Date(timestamp), y = mean_temperature, colour = station_name)) +
32  geom_line() +
33  theme_minimal() +
34  scale_colour_viridis_d(name = "Stations", option = "F") +
35  scale_x_date(name = "Months", date_breaks = "2 months", date_labels = "%B")
AEMET monthly values for stations in León, 1992
AEMET monthly values for stations in León, 1992

Don’t forget to check the docs for a full guide into using meteospain.

Ecosystem Modelling Facility
Ecosystem Modelling Facility