1

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.

Blaiso
  • 165
  • 9
  • About "the inclination values don't look correct." I think you can help others help you by showing some of the values and saying specifically what looks incorrect to you. About debugging stuff like this, try a simpler case for which you can more easily determine what the output should be. E.g. solar noon, horizontal surface or inclination = latitude, something like that. – Robert Dodier Nov 23 '21 at 19:43
  • @B_K It is not recommended to use reanalysis data such as ERA5 for irradiance unless absolutely necessary. For Denmark, there are several free irradiance datasets available with significantly better accuracy. As a start, I would recommend looking into PVGIS, which can also do the transposition to a tilted plane for you. I could provide an example in Python using pvlib if it has interest. – Adam R. Jensen Mar 23 '22 at 01:11
  • Thanks for your input Adam. I haven't had chance to look into this much since this post but the python example would be really helpful. – Blaiso Mar 24 '22 at 05:58
  • Regarding the use of ERA5, the ECMWF does caution against using for a single site as the value represents the full grid, which in the case of the land data is 9km. To my mind though that is better than using a measured value say 50km away? It is really hard to find irradiation measuring sites. – Blaiso Mar 24 '22 at 06:00

1 Answers1

1

Let's compare your data with the extraterrestrial irradiance at this location:

## Extract all the variables as a time series 
z <- as.zooI(gef, complete = TRUE)
## Include the original values of irradiance
z$ssdr <- ssdr 
## Plot both time series together
xyplot(z[, c("Bo0", "ssdr")], superpose = TRUE)

G0 vs Bo0

As the figure clearly shows, these time series are not synchronised. During some hours of the day, the irradiance on the horizontal plane is larger than the extraterrestrial irradiance, and that is not possible. That is the cause of the NA values you get in the gef object.

Your ssdr time series is likely to use local time. If that is the case, you have to change it to mean solar time according to the longitude with the local2Solar function (read the help page of this function for additional information). You should check the last example of the help page of the calcG0 function. That example downloads data from an NREL station using local time and modifies the timestamp with local2solar.

PD. I do not understand why do you download data but you don't use it.

Oscar Perpiñán
  • 4,491
  • 17
  • 28