我想将9公里网格ECMWF太阳表面向下照射的总辐射量与在丹麦的一个地点测量的倾斜辐射量进行比较。然而,结果并不是很好,我发现很难理解非常复杂但相当复杂的solaR包。
library(dplyr)
library(solaR)从ECMWF ERA-5陆地模型https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-land?tab=overview下载的2018年前117小时的太阳表面向下辐射(ssrd)和2m环境温度(t2m) (键入为从ecmwfr下载不是微不足道的)。
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)2018年前5天从solarheatdata.eu网站获得的测量值
## 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),]为solaR函数准备数据。Vra的纬度为57.4,面板的角度为35度。
## 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)输出包含G列的数据帧,该列是斜面上的全局照射。然而,将其与测量结果进行绘制会得到截然不同的结果。
## 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'))我知道ECMWF的数据是针对9公里网格的,然而,从根本上讲,倾斜值看起来并不正确。这也是我的理解,我可以使用不同的模型,但是,对于calcgef函数,我看不到这些。
发布于 2021-11-23 19:26:52
让我们将您的数据与此位置的外星人照度进行比较:
## 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)

如图所示,这些时间序列是不同步的。在一天中的某些时候,水平面上的辐照度大于地外的辐照度,这是不可能的。这就是您在gef对象中获得NA值的原因。
您的ssdr时间序列可能使用本地时间。如果是这种情况,您必须使用local2Solar函数根据经度将其更改为平均太阳时间(有关更多信息,请阅读此函数的帮助页面)。您应该查看calcG0函数的帮助页面的最后一个示例。该示例使用本地时间从NREL站点下载数据,并使用local2solar修改时间戳。
警局。我不明白为什么你要下载数据,但你不使用它。
https://stackoverflow.com/questions/69873240
复制相似问题