scrapeMeteo: Scrape meteorological data from <URL: meteo.enel.it>

Description Usage Arguments Value Note Author(s) Examples

View source: R/scrapeMeteo.R

Description

enel.it does not provide any API. Meteorological parameters, including temperature and irradiance, are scraped from its website. Therefore even slight changes to HTML code may break the code. A forged POST request is sent to dettaglio_ajax.php. The request includes a fake cookie, the code for the town and the date for the forecast to be looked up. The website provides 8 forecasts of 12 variables a day:

  1. "Te" (Air temperature) [^\circ C]

  2. "Mc" (Current weather conditions), one of

    • "Sun"

    • "Burning sun"

    • "Scattered clouds"

    • "Broken clouds"

    • "Broken clouds and rain"

    • "Broken clouds, rain and snow"

    • "Broken clouds and light snow"

    • "Overcast clouds"

    • "Overcast clouds and rain"

    • "Overcast clouds and rain"

    • "Overcast clouds and snow"

    • "Overcast clouds, snow and rain"

    • "Overcast clouds, thunderstorms"

    • "Overcast clouds and mist"

    • "Fog"

    • "Broken clouds, rain, chance of thunderstorms"

    • "Overcast clouds and heavy rain"

    • "Overcast clouds and heavy snow"

  3. "R" (Precipitation), one of

    • "No rain"

    • "Drizzle"

    • "Light rain"

    • "Moderate rain"

    • "Heavy rain"

    • "Very heavy rain"

    according to these classes of precipitation (mmH_2O):

    • <0.1

    • <2

    • <6

    • <10

    • <15

    • ≥q 15

  4. "Wd" (Wind direction), classes of 11.25^\circ each. One of

    • "N"

    • "NNE"

    • "NE"

    • "ENE"

    • "E"

    • "ESE"

    • "SE"

    • "SSE"

    • "S"

    • "SSW"

    • "SW"

    • "WSW"

    • "W"

    • "WNW"

    • "NW"

    • "NNW"

  5. "Ws" (Wind speed) [m/s]

  6. "Tw" (Wind-corrected air temperature (ie Windchill)) [^\circ C]

  7. "H" (Heat) [^\circ C]

  8. "Rh" (Relative humidity) [\%]

  9. "V" (Visibility) [m]

  10. "P" (Air pressure) [hPa]

  11. "Pt" (Pressure trend), one of

    • "-2"

    • "-1"

    • "0"

    • "1"

    • "2"

  12. "G" (Irradiance) [W/m^2]

Usage

1
2
3
4
scrapeMeteo(location, dates = list(Sys.Date()),
  webAddress = "http://meteo.enel.it", timeOfDayNum = 8,
  variableLabels = c(Te = "Te", Mc = "Mc", R = "R", Wd = "Wd", Ws = "Ws", Tw =
  "Tw", H = "H", Rh = "Rh", V = "V", P = "P", Pt = "Pt", G = "G"))

Arguments

location

integer code linked to a geographical location in Enel DB. Check meteo.enel.it to get the code for your town or city

dates

a list of forecast dates, defaults to a list of 1 element (today date).

webAddress

the http address where meteorological data is to be scraped from. Defaults to http://meteo.enel.it

timeOfDayNum

how many times a day forecasts are provided. Defaults to 8, i.e. every 3 hours.

variableLabels

a named vector of 12 variable names, defaults to the labels provided in Description section

Value

a data.frame of 3 columns: time, variable, value

Note

Photovoltaic panel efficiency and temperature estimation needs air temperature and irradiance variables.

Author(s)

Marco Bascietto marco@bascietto.name

Examples

1
2
3
4
5
6
7
## Not run: 
# Scrapes today and tomorrow meteorological data for 4 italian towns
places = c(Roma = 170094, Nepi = 170158, Bolzano = 172858, Siracusa = 172506)
scrapeDate <- Sys.Date()
lapply(places, function(place) {measures <- scrapeMeteo(place, dates = list(scrapeDate, scrapeDate + lubridate::days(1)))})

## End(Not run)

mbask/meteopv documentation built on May 21, 2019, 2:25 p.m.