site_adapt: Site Adaptation of Solar Irradiance Modeled Series with...

Description Usage Arguments Value References Examples

View source: R/site_adapt.R

Description

Site Adaptation of Solar Irradiance Modeled Series with Coincident Ground Measurements

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
site_adapt(
  Target,
  latitude_target,
  z_target,
  Calibration,
  latitude_calibrat,
  z_calibrat,
  timezone,
  GHI_threshold,
  DNI_threshold
)

Arguments

Target

Dataframe object with solar radiation series to be adapted including time (with same time zone as subset_calibrating_period), the solar irradiance modeled series to be site adapted, along with their clear sky index and solar elevation (degrees)

latitude_target

Site latitude of solar radiation series to be adapted (degrees, +N)

z_target

Site elevation above sea level of solar radiation series to be adapted (m)

Calibration

Dataframe object with solar radiation series for calibrating including time (with same time zone as subset_target_period), solar irradiance modeled and measured series, along with modeled clear sky index and solar elevation (degrees)

latitude_calibrat

Site latitude of solar radiation series for calibrating (degrees, +N)

z_calibrat

Site elevation above sea level of solar radiation series for calibrating (m)

timezone

Time zone specification of the calibration_period and target_period datasets

GHI_threshold

Upper limit of GHI series (same units that Target). For automatic calulation from observed data, set it to -99

DNI_threshold

Upper limit of DNI series (same units that Target). For automatic calulation from observed data, set it to -99

Value

Dataframe object including time and site adapted solar irradiance series

References

Fernández-Peruchena, C.M.; Polo, J.; Martín, L.; Mazorra, L. Site-Adaptation of Modeled Solar Radiation Data: The SiteAdapt Procedure. Remote Sens. 2020, 12, 2127.

Examples

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# A site located in the the Namib Desert of Namibia (Gobabeb, GOB) is selected

# - latitude:   23.5614 S
# - Longitude:  15.0420 E
# - Elevation:  407.0 m asl

 # Load calibration and modeled datasets
   data(calibration_2016) # Measured from BSRN
   data(target_2013_2016) # Provided by CAMS-RAD service

target_2013_2016$time = as.POSIXct(
paste(target_2013_2016$Year, "-",
target_2013_2016$Month, "-",
target_2013_2016$Day, " ",
target_2013_2016$Hour, ":",
target_2013_2016$Minute, sep=""),
tz ="UTC")



 # Apply the site adaptation procedure
   site_adapted_series = site_adapt(
   Target = target_2013_2016,
   latitude_target = -23.5614, # Latitude of target site
   z_target = 407.0, # Elevation of target site
   Calibration = calibration_2016,
   latitude_calibrat = -23.5614, # Same location of target period
   z_calibrat = 407.0, # Same location of target period
   timezone = "UTC",
   GHI_threshold = -99, # The threshold is calculated from observed data
   DNI_threshold = -99) # The threshold is calculated from observed data


# Load measured data for evaluating the site adaptation performance:
   data(observed_2013_2016)

# Merge datasets

site_adapted_series$time = as.POSIXct(
paste(site_adapted_series$Year, "-",
site_adapted_series$Month, "-",
site_adapted_series$Day, " ",
site_adapted_series$Hour, ":",
site_adapted_series$Minute, sep=""),
tz ="UTC")

observed_2013_2016$time = as.POSIXct(
paste(observed_2013_2016$Year, "-",
observed_2013_2016$Month, "-",
observed_2013_2016$Day, " ",
observed_2013_2016$Hour, ":",
observed_2013_2016$Minute, sep=""),
tz ="UTC")


meas_model = merge(observed_2013_2016[,6:9],
target_2013_2016[,c(6:9,11)],
by = "time", all = FALSE )

meas_model_adapt = merge(meas_model,
site_adapted_series[,6:10],
by = "time", all = FALSE )


# Display scatterplots
library(RColorBrewer)
pal <- rev(brewer.pal(11,"Spectral"))
pal=pal[2:11]

library(ggplot2)
scatter_DNI.obs = ggplot() +
geom_hex(data=meas_model_adapt,aes(x=DNI.obs, y = DNI.mod),bins = 125, alpha = 1) +
scale_fill_gradientn(colours = pal)+ theme_light() +
xlab(expression(paste("Measured DNI (W / ", m^2, " )", sep=""))) +
 ylab(expression(paste("Modeled DNI (W / ", m^2, " )", sep=""))) +
 theme(legend.position = "none") +
 xlim(100, 1120) + ylim(100,1120) +
geom_abline(intercept = 0, slope = 1, color="purple", linetype="solid", size=1.5, alpha = 0.5)

plot_DNI_adapt = ggplot() +
geom_hex(data=meas_model_adapt,aes(x=DNI.obs, y = DNI_adapted),bins = 125, alpha = 1) +
 scale_fill_gradientn(colours = pal)+ theme_light() +
 xlab(expression(paste("Measured DNI (W / ", m^2, " )", sep=""))) +
 ylab(expression(paste("Adapted DNI (W / ", m^2, " )", sep=""))) +
 theme(legend.position = "none") + xlim(100, 1120) + ylim(100,1120) +
 geom_abline(intercept = 0, slope = 1, color="purple", linetype="solid", size=1.5, alpha = 0.5)

library(ggpubr)
ggarrange(scatter_DNI.obs, plot_DNI_adapt)

scatter_GHI.obs = ggplot() +
geom_hex(data=meas_model_adapt,aes(x=GHI.obs, y = GHI.mod),bins = 125, alpha = 1) +
 scale_fill_gradientn(colours = pal)+ theme_light() +
 xlab(expression(paste("Measured GHI (W / ", m^2, " )", sep=""))) +
 ylab(expression(paste("Modeled GHI (W / ", m^2, " )", sep=""))) +
 theme(legend.position = "none") + xlim(100, 1180) + ylim(100,1180) +
 geom_abline(intercept = 0, slope = 1, color="purple", linetype="solid", size=1.5, alpha = 0.5)

plot_GHI_adapt = ggplot() +
geom_hex(data=meas_model_adapt,aes(x=GHI.obs, y = GHI_adapted),bins = 125, alpha = 1) +
 scale_fill_gradientn(colours = pal) + theme_light() +
 xlab(expression(paste("Measured GHI (W / ", m^2, " )", sep=""))) +
 ylab(expression(paste("Adapted GHI (W / ", m^2, " )", sep=""))) +
 theme(legend.position = "none") + xlim(100, 1180) + ylim(100,1180) +
 geom_abline(intercept = 0, slope = 1, color="purple", linetype="solid", size=1.5, alpha = 0.5)
ggarrange(scatter_GHI.obs, plot_GHI_adapt)

scatter_DHI.obs = ggplot() +
geom_hex(data=meas_model_adapt,aes(x=DHI.obs, y = DHI.mod),bins = 125, alpha = 1) +
 scale_fill_gradientn(colours = pal)+ theme_light() +
 xlab(expression(paste("Measured DHI (W / ", m^2, " )", sep=""))) +
 ylab(expression(paste("Modeled DHI (W / ", m^2, " )", sep=""))) +
 theme(legend.position = "none") + xlim(25, 700) + ylim(25, 700) +
 geom_abline(intercept = 0, slope = 1, color="purple", linetype="solid", size=1.5, alpha = 0.5)

plot_DHI_adapt = ggplot() +
geom_hex(data=meas_model_adapt,aes(x=DHI.obs, y = DHI_adapted),bins = 125, alpha = 1) +
 scale_fill_gradientn(colours = pal)+ theme_light() +
 xlab(expression(paste("Measured DHI (W / ", m^2, " )", sep=""))) +
 ylab(expression(paste("Adapted DHI (W / ", m^2, " )", sep=""))) +
 theme(legend.position = "none") + xlim(25, 700) + ylim(25, 700) +
 geom_abline(intercept = 0, slope = 1, color="purple", linetype="solid", size=1.5, alpha = 0.5)
ggarrange(scatter_DHI.obs, plot_DHI_adapt)




 # Display ECDF plots
plot_ECDF_DNI = ggplot(data=meas_model_adapt[which(meas_model_adapt$Elev > 0),])+
 stat_ecdf(aes(DNI.obs), col="firebrick", lwd = 0.75) +
 stat_ecdf(aes(DNI.mod), col="dodgerblue", lwd = 0.75) +
 stat_ecdf(aes(DNI_adapted), col="purple", lwd = 0.75) +
 theme_light() + xlab(expression(paste("DNI (W / ", m^2, " )", sep="")))+ ylab("ECDF ( - )")+
 annotate("text", x = 50, y = 0.9, label = "Measured", col="firebrick1", size = 4)+
 annotate("text", x = 50, y = 0.8, label = "Modeled", col="dodgerblue", size = 4)+
 annotate("text", x = 50, y = 0.7, label = "Adapted", col="purple", size = 4)
plot_ECDF_DNI

plot_ECDF_GHI = ggplot(data=meas_model_adapt[which(meas_model_adapt$Elev > 0),])+
 stat_ecdf(aes(GHI.obs), col="firebrick", lwd = 0.75) +
 stat_ecdf(aes(GHI.mod), col="dodgerblue", lwd = 0.75) +
 stat_ecdf(aes(GHI_adapted), col="purple", lwd = 0.75) +
 theme_light() + xlab(expression(paste("GHI (W / ", m^2, " )", sep="")))+ ylab("ECDF ( - )")+
 annotate("text", x = 50, y = 0.9, label = "Measured", col="firebrick1", size = 4)+
 annotate("text", x = 50, y = 0.8, label = "Modeled", col="dodgerblue", size = 4)+
 annotate("text", x = 50, y = 0.7, label = "Adapted", col="purple", size = 4)
plot_ECDF_GHI

plot_ECDF_DHI = ggplot(data=meas_model_adapt[which(meas_model_adapt$Elev > 0),])+
 stat_ecdf(aes(DHI.obs), col="firebrick", lwd = 0.75) +
 stat_ecdf(aes(DHI.mod), col="dodgerblue", lwd = 0.75) +
 stat_ecdf(aes(DHI_adapted), col="purple", lwd = 0.75) +
 theme_light() + xlab(expression(paste("DHI (W / ", m^2, " )", sep="")))+ylab("ECDF ( - )")+
 annotate("text", x = 25, y = 0.9, label = "Measured", col="firebrick1", size = 4)+
 annotate("text", x = 25, y = 0.8, label = "Modeled", col="dodgerblue", size = 4)+
 annotate("text", x = 25, y = 0.7, label = "Adapted", col="purple", size = 4)
plot_ECDF_DHI




# Statistical indicators
library(hydroGOF)
pbias(meas_model_adapt$GHI.mod,meas_model_adapt$GHI.obs)
pbias(meas_model_adapt$GHI_adapted,meas_model_adapt$GHI.obs)

pbias(meas_model_adapt$DNI.mod,meas_model_adapt$DNI.obs)
pbias(meas_model_adapt$DNI_adapted,meas_model_adapt$DNI.obs)

pbias(meas_model_adapt$DHI.mod,meas_model_adapt$DHI.obs)
pbias(meas_model_adapt$DHI_adapted,meas_model_adapt$DHI.obs)

rmse(meas_model_adapt$GHI.mod,meas_model_adapt$GHI.obs)
rmse(meas_model_adapt$GHI_adapted,meas_model_adapt$GHI.obs)

rmse(meas_model_adapt$DNI.mod,meas_model_adapt$DNI.obs)
rmse(meas_model_adapt$DNI_adapted,meas_model_adapt$DNI.obs)

rmse(meas_model_adapt$DHI.mod,meas_model_adapt$DHI.obs)
rmse(meas_model_adapt$DHI_adapted,meas_model_adapt$DHI.obs)

SiteAdapt documentation built on Jan. 13, 2021, 9:48 a.m.