Learn R Programming

solaR (version 0.37)

A8_readSIAR: Meteorological data from the SIAR network.

Description

IMPORTANT: The SIAR webpage has changed again and the data cannot be accessed with a direct URL but using javascript code. Therefore, the function readSIAR no longer works. This help page is still here as a reference. The SIAR webpage is now http://eportal.magrama.gob.es/websiar.

Usage

readSIAR(prov, est, start, end, lat=0,
  format='%d/%m/%Y')

Arguments

prov
numeric, number of the spanish province according to the information of www.marm.es/siar (see details below).
est
numeric, number of the station according to the information of www.marm.es/siar (see details below).
start
character, first day of the time period.
end
character, last day of the time period.
lat
numeric, latitude (degrees) of the station.
format
character string with the format of the start and end dates. (Default: '%d/%m/%Y')

Value

  • Meteo object, with the information available at www.marm.es/siar.

    It should be noted that SIAR uses MJ/m² units for the irradiation data and readSIAR converts the values to Wh/m².

encoding

UTF-8

Details

The number codes of the stations and provinces are available at http:/solar.r-forge.r-project.org/data/SIAR.csv', a data frame with 8 columns: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Part of this information has been obtained with a "trial-and-error" procedure so could include mistakes.

The latitude, longitude and altitude information have been obtained in the context of a Master Project at the EOI (https://sites.google.com/a/learning.eoi.es/merme2010-estudioradiacionsolar/home) by Fernando Antoñanzas Torres, Federico Cañizares Jover, Rafael Morales Cabrera and Manuel Ojeda Fernández. This dataset is an improvement of the previous RedEstaciones (not available in this version).

References

http://eportal.magrama.gob.es/websiar/Inicio.aspx

See Also

readG0dm, readBD, fTemp, read.zoo

Examples

Run this code
#Aranjuez, Madrid
BD<-readSIAR(28,3,'01/01/2008','31/12/2008')

xyplot(TempMedia~G0|equal.count(VelViento),data=BD)

## Plot the stations in a map
library(sp)
library(maptools)

SIAR <- read.csv('http://solar.r-forge.r-project.org/data/SIAR.csv')
proj <- CRS('+proj=longlat +ellps=WGS84')
spSIAR <- SpatialPointsDataFrame(SIAR[, c(6, 7)], SIAR[, -c(6, 7)],
                                 proj4str=proj)


###download a shapefile with the administrative borders of Spain
old <- setwd(tempdir())
download.file('http://www.gadm.org/data/shp/ESP_adm.zip', 'ESP_adm.zip')
unzip('ESP_adm.zip')
mapaSHP <- readShapeLines('ESP_adm2.shp', proj4string=proj)
setwd(old)

p <- spplot(spSIAR['Comunidad'],
       col.regions=brewer.pal(n=12, 'Paired'),
       key.space='right', scales=list(draw=TRUE),
       type=c('p','g'))

p  + layer(sp.lines(mapaSHP))

Run the code above in your browser using DataLab