Description Usage Arguments Value Note Author(s) Examples
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:
"Te" (Air temperature) [^\circ C]
"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"
"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
"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"
"Ws" (Wind speed) [m/s]
"Tw" (Wind-corrected air temperature (ie Windchill)) [^\circ C]
"H" (Heat) [^\circ C]
"Rh" (Relative humidity) [\%]
"V" (Visibility) [m]
"P" (Air pressure) [hPa]
"Pt" (Pressure trend), one of
"-2"
"-1"
"0"
"1"
"2"
"G" (Irradiance) [W/m^2]
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"))
|
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 |
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 |
a data.frame
of 3 columns: time
, variable
, value
Photovoltaic panel efficiency and temperature estimation needs air temperature and irradiance variables.
Marco Bascietto marco@bascietto.name
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.