DEPRECATED. Download data from the Catalan automatic weather station network (XEMA from Servei Meteorològic de Catalunya)

downloadSMCstationlist(api, date = NULL)
downloadSMCcurrentday(api, daily = TRUE,
                      station_id=NULL, date = Sys.Date(), verbose=TRUE)
downloadSMChistorical(api, date, station_id=NULL, export = FALSE, 
                      exportDir = getwd(), exportFormat = "meteoland/txt",
                      metadataFile = "MP.txt", verbose=TRUE)



String with the SMC API key (the procedure to apply for an api key is explained in ).


Boolean flag. Are data to be returned at a daily or hourly scale?


An object of class Date. By default the current day in the case of downloadSMCcurrentday(). In the case of downloadSMCstationlist() a date for which operational stations are queried. In the case of downloadSMChistorical, the function returns the whole month the first date selected is in (implementation in package meteospain).


A string vector containing station ids (the list of stations for which climatic series are available is given by downloadSMCstationlist()). If NULL, all available stations are queried. Otherwise, only the data corresponding to the specified stations will be returned.


If export = FALSE the downloaded data is stored in memory. Otherwise the result is written on the disk (using the format specified in exportFormat).


Output directory for downloaded meteorology.


Format of meteorological data. Current accepted formats are "castanea" and "meteoland".


The name of the file that will store the meta data describing all written files.


Boolean flag to print process information.


API key needs to be requested from SMC (


Function downloadSMCstationlist returns a SpatialPointsDataFrame-class object containing the list of SMC operational weather stations for the date given.

Function downloadSMCcurrentday downloads recent weather (the last 24h or the weather for a given date) from all currently available stations and returns data frame if daily_meteoland = FALSE or a SpatialPointsDataFrame-class object with observations aggregated at the daily scale otherwise.

Function downloadSMChistorical downloads historical daily weather corresponding to a given time period from a set (or all currently available) stations. Results are returned (or exported) after formatting data as a SpatialPointsMeteorology-class if variable_code = NULL, or as a data frame otherwise.


Since ver. 1.0.1, weather data download functions included in meteoland make internal calls to functions in package meteospain. For an enhanced flexibility, users are recommended to call functions in meteospain themselves, and then to use function reshapemeteospain to generate data suitable for meteoland.


Servei Meteorològic de Catalunya (SMC) should be acknowledged as author of information when accessing weather data with these functions.


Antoine Cabon, CTFC

Miquel De Cáceres Ainsa, CREAF