MyNixOS website logo
Description

Access to Spanish Meteorological Stations Services.

Access to different Spanish meteorological stations data services and APIs (AEMET, SMC, MG, Meteoclimatic...).

meteospain

R-CMD-check

meteospain aims to offer access to different Spanish meteorological stations data in an uniform way.

Installation

meteospain is in CRAN, and can be installed as any other package:

install.packages('meteospain')

Also, meteospain is in active development. You can install the development version from GitHub with:

# install.packages("remotes")
remotes::install_github("emf-creaf/meteospain")

Services

The following meteorological stations services are available:

  • AEMET, the Spanish State Meteorological Agency.
  • MeteoCat, the Catalan Meteorology Service.
  • MeteoGalicia, the Galician Meteorological Service.
  • RIA, the Andalucian Agroclimatic Information Network.
  • Meteoclimatic, the Spanish non-professional meteorological stations network.

Examples

Access to the services is done with the get_meteo_from function, providing the name of the service and the options. Each service has a dedicated *service*_options() function to guide through the specifics of each service:

library(meteospain)

mg_options <- meteogalicia_options(resolution = 'current_day')
get_meteo_from('meteogalicia', mg_options)
#> ℹ A información divulgada a través deste servidor ofrécese gratuitamente aos
#>   cidadáns para que poida ser
#> utilizada libremente por eles, co único compromiso de mencionar expresamente a
#> MeteoGalicia e á
#> Consellería de Medio Ambiente, Territorio e Vivenda da Xunta de Galicia como
#> fonte da mesma cada vez
#> que as utilice para os usos distintos do particular e privado.
#> https://www.meteogalicia.gal/web/informacion/notaIndex.action
#> Simple feature collection with 3720 features and 14 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: -9.178318 ymin: 41.8982 xmax: -6.765224 ymax: 43.734
#> Geodetic CRS:  WGS 84
#> # A tibble: 3,720 × 15
#>    timestamp           service station_id station_name station_province altitude
#>    <dttm>              <chr>   <chr>      <chr>        <chr>                 [m]
#>  1 2023-10-22 14:00:00 meteog… 10045      Mabegondo    A Coruña               94
#>  2 2023-10-22 14:00:00 meteog… 10046      Marco da Cu… A Coruña              651
#>  3 2023-10-22 14:00:00 meteog… 10047      Pedro Murias Lugo                   51
#>  4 2023-10-22 14:00:00 meteog… 10048      O Invernade… Ourense              1026
#>  5 2023-10-22 14:00:00 meteog… 10049      Corrubedo    A Coruña               30
#>  6 2023-10-22 14:00:00 meteog… 10050      CIS Ferrol   A Coruña               37
#>  7 2023-10-22 14:00:00 meteog… 10052      Muralla      A Coruña              661
#>  8 2023-10-22 14:00:00 meteog… 10053      Campus Lugo  Lugo                  400
#>  9 2023-10-22 14:00:00 meteog… 10055      Guitiriz-Mi… Lugo                  684
#> 10 2023-10-22 14:00:00 meteog… 10056      Marroxo      Lugo                  645
#> # ℹ 3,710 more rows
#> # ℹ 9 more variables: temperature [°C], min_temperature [°C],
#> #   max_temperature [°C], relative_humidity [%], precipitation [L/m^2],
#> #   wind_direction [°], wind_speed [m/s], insolation [h], geometry <POINT [°]>

Stations info can be accessed with get_stations_info_from function:

get_stations_info_from('meteogalicia', mg_options)
#> Simple feature collection with 156 features and 5 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: -9.178318 ymin: 41.8982 xmax: -6.765224 ymax: 43.7383
#> Geodetic CRS:  WGS 84
#> # A tibble: 156 × 6
#>    service      station_id station_name             station_province altitude
#>  * <chr>        <chr>      <chr>                    <chr>                 [m]
#>  1 meteogalicia 10157      Coruña-Torre de Hércules A Coruña               21
#>  2 meteogalicia 14000      Coruña-Dique             A Coruña                5
#>  3 meteogalicia 10045      Mabegondo                A Coruña               94
#>  4 meteogalicia 14003      Punta Langosteira        A Coruña                5
#>  5 meteogalicia 10144      Arzúa                    A Coruña              362
#>  6 meteogalicia 19005      Guísamo                  A Coruña              175
#>  7 meteogalicia 19012      Cespón                   A Coruña               59
#>  8 meteogalicia 10095      Sergude                  A Coruña              231
#>  9 meteogalicia 10800      Camariñas                A Coruña                5
#> 10 meteogalicia 19001      Rus                      A Coruña              134
#> # ℹ 146 more rows
#> # ℹ 1 more variable: geometry <POINT [°]>

Returned objects are spatial objects (using the sf R package), so results can be plotted directly:

library(sf)
#> Linking to GEOS 3.12.0, GDAL 3.7.2, PROJ 9.2.1; sf_use_s2() is TRUE
mg_options <- meteogalicia_options(resolution = 'daily', start_date = as.Date('2021-04-25'))
plot(get_meteo_from('meteogalicia', mg_options))
#> ℹ A información divulgada a través deste servidor ofrécese gratuitamente aos
#>   cidadáns para que poida ser
#> utilizada libremente por eles, co único compromiso de mencionar expresamente a
#> MeteoGalicia e á
#> Consellería de Medio Ambiente, Territorio e Vivenda da Xunta de Galicia como
#> fonte da mesma cada vez
#> que as utilice para os usos distintos do particular e privado.
#> https://www.meteogalicia.gal/web/informacion/notaIndex.action
#> Warning: plotting the first 9 out of 16 attributes; use max.plot = 16 to plot
#> all

plot(get_stations_info_from('meteogalicia', mg_options))

API keys

Some services, like AEMET or Meteocat, require an API key to access the data. meteospaindoesn’t provide any key for those services, see ?services_options for information about this.

Once a key has been obtained, we can get the meteo:

get_meteo_from('aemet', aemet_options(api_key = keyring::key_get("aemet")))
#> ℹ © AEMET. Autorizado el uso de la información y su reproducción citando a
#>   AEMET como autora de la misma.
#> https://www.aemet.es/es/nota_legal
#> Simple feature collection with 18048 features and 14 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: -18.115 ymin: 27.66667 xmax: 4.323889 ymax: 43.78621
#> Geodetic CRS:  WGS 84
#> # A tibble: 18,048 × 15
#>    timestamp           service station_id station_name station_province altitude
#>    <dttm>              <chr>   <chr>      <chr>        <chr>                 [m]
#>  1 2023-10-22 14:00:00 aemet   0016A      REUS/AEROPU… <NA>                   71
#>  2 2023-10-22 14:00:00 aemet   0034X      VALLS        <NA>                  233
#>  3 2023-10-22 14:00:00 aemet   0042Y      TARRAGONA  … <NA>                   55
#>  4 2023-10-22 14:00:00 aemet   0061X      PONTONS      <NA>                  632
#>  5 2023-10-22 14:00:00 aemet   0066X      VILAFRANCA … <NA>                  177
#>  6 2023-10-22 14:00:00 aemet   0073X      SITGES-VALL… <NA>                   58
#>  7 2023-10-22 14:00:00 aemet   0076       BARCELONA/A… <NA>                    4
#>  8 2023-10-22 14:00:00 aemet   0106X      BALSARENY    <NA>                  361
#>  9 2023-10-22 14:00:00 aemet   0114X      PRATS DE LL… <NA>                  700
#> 10 2023-10-22 14:00:00 aemet   0120X      MOIÀ         <NA>                  742
#> # ℹ 18,038 more rows
#> # ℹ 9 more variables: temperature [°C], min_temperature [°C],
#> #   max_temperature [°C], relative_humidity [%], precipitation [L/m^2],
#> #   wind_direction [°], wind_speed [m/s], insolation [h], geometry <POINT [°]>
Metadata

Version

0.1.4

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows