I wanted to compare the global irradiation from the 9km grid ECMWF solar surface down irradiation with measured inclined irradiation at a site in Denmark. However, the results are not very good and I have found a lot of difficulty understanding the very comprahensive but rather complex solaR package.
library(dplyr)
library(solaR)
Solar Surface Down Radiation (ssrd) and 2m ambient temperature (t2m) downloaded from ECMWF ERA-5 land model https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-land?tab=overview for the first 117 hours of 2018 (typed out as downloading from ecmwfr is not trivial).
ssdr <- c(0,0,0,0,0,0,0,0,0,0,5.5,15.7,22.3,58.5,59.7,34.3,6.9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,14.1,66.9,116.9,130.2,109.7,61.9,9.3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2.8,7.5,
12.6,13.2,17.7,11.8,2.2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5.2,22.1,40.4,41.3,30.5,
17.7,5.4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,31.7,49.8,77.8,51.8,35.6,7.8,0,0,0,0)
t2m <- c(278.6,278.6,278.5,278.4,278.3,278.1,277.9,277.8,278,278.2,278.4,278.5,278.7,278.8,
278.6,278.4,278.1,278,278,277.8,277.7,277.7,278,278.1,278.2,278.1,278.1,278.1,278,
277.9,277.8,278,278.2,278.3,278.6,278.9,279.1,279,278.6,278,277.7,277.3,276.9,276.5,
276.4,276.5,276.4,276.3,276.4,276.5,276.5,276.6,276.4,276.1,275.6,275.4,275,275.1,
275,275.1,275.1,275.4,275.6,275.6,275.7,275.8,275.9,276,276,276,276.1,276.3,276.6,
276.6,276.6,276.6,276.6,276.7,276.7,276.8,276.7,276.5,276.5,276.6,276.5,276.4,276.4,
276.4,276.2,276.1,275.9,275.4,275.4,275.2,275,275.2,274.9,274.7,274.6,274.3,274.5,
274.4,274.4,274.7,274.6,275,275.5,275.9,276.4,276.1,275.8,275.4,275.2,275.1,275,
275.4,275.2)
Measured obtained from solarheatdata.eu website for the first 5 days of 2018
## site ID of VRA solar plant on solarheatdata.eu
site <- "45"
## start and end data of data request
start_date <- "01-01-2018"
end_date <- "05-01-2018"
##request data from solarheatdata.eu website
sh_raw <- read.csv(file = paste0('http://solarheatdata.eu/modules/sol/histdata.asp?anlaeg=', site, "&fromdate=", start_date,"&todate=",end_date ,"&results=hours&csv=1"),
header = FALSE, sep = ';')
## give header correct names
names(sh_raw) <- c('date', 'solar_heat_MWh', 'solar_heat_production_Whm2', 'solar_radiation_Whm2')
## trim data to match ssdr and t2m
sh_raw <- sh_raw[1:NROW(ssdr),]
Prep data for solaR functions. Latitude of Vra is 57.4 and angle of the panels is 35 degrees.
## lubridate used to create date variables
library(lubridate)
## create data frame of date, G0 and Ta for solaR
sh_dat <- sh_raw %>%
transmute(date = dmy_hm(str_sub(date, 0, -7)),
G0 = ssdr,
Ta = t2m-273.15)
##calculate bdI Meteo object
bdi_df = dfI2Meteo(sh_dat, lat = 57.4, time.col = 'date')
## obtain the global, diffuse and direct irradiation and irradiance on the generator plane (which is 35 degrees)
gef <- calcGef(lat = 57.4, modeRad = 'bdI', dataRad = bdi_df, beta = 35)
Output data frame containing column G which is Global Irradiation on inclined plane. However, plotting this with measured gives wildly different results.
## output data frame for each hour
output_df <- data.frame(gef@GefI)
##add measured irradiation from site as a column for comparison
output_df$site_Wm2 <- sh_raw$solar_radiation_Whm2
output_df$date <- ymd_hms(row.names(output_df))
## time_dygraph very handy for plotting and visualising time series ## remotes::install_github("skgrange/threadr")
library(threadr)
threadr::time_dygraph(output_df, variable = c('G', 'site_Wm2'))
I understand the ECMWF data is for a 9km grid, however, fundamentally the inclination values don't look correct. It is also my understanding I can use different models, however, for the calcgef function I can't see these.