Description Usage Arguments Details Value Author(s) References Examples
View source: R/ClearSkyQuantileRegression.R
This function will estimate the fractional solar transmission per year and month and for moving averages with window sizes of 3, 5, and 7 months. Based on the deviation of the monthly estimates from the site average and the goodness of fit the appropriate window is selected. For this window the resulting fractional solar transmission is used to calculate the ClearSky Shortwave radiation. The methodology is described in Renner et al., (2019) ESS. The function may take some time since different window length are computed.
1 2 3 4 5 |
Date |
a vector of Dates in the format of data.table::as.IDate |
Time |
a vector of Times in the format of data.table::as.ITime |
IncomingShortwave |
a vector of subdaily (hourly or half-hourly) observations of solar radiation |
IncomingShortwavePotential |
a vector of potential solar radiation (if not supplied it will be computed) |
tau |
numeric the quatile for which the regression is being performed Defaults to 0.85 based on many BSRN stations, but this may vary (cloud type, frequency and aerosols) |
lat |
Latitude of the site in degrees |
lon |
Longitude of the site in degrees |
hourshift |
numeric A shift in hours to align the potential solar radiation with the observed radiation. Here 0.25 is used as default for half-hourly aggregated data (a shift will induce hyseresis and an intercept term in quantile regression) |
timeZone |
numeric, if local time is used then 0 otherwise the time must be adapted |
cosineResponsePower |
numeric defaults to 1.2, may be lower at high latitude sites, see Long and Ackerman (2000) JGR |
pdev |
numeric allowable fractional deviation of the monthly estimate from the site average estimate (here 0.25) |
mc.cores |
Numeric setting the number of parallel child processes to calculate the regressions for each month, |
briefoutput |
logical defaults to TRUE, otherwise all statistics are reported |
This function may also compute the potential solar radiation when this is not given, this requires lat, long, time with timezone and possible shift.
To speed up the calculations the parallel package is used. This will not work under Windows, unless mc.cores = 1.
a data.table with average fluxes for year and months, the fractional transmission estimate (ftau), its corresponding Window length and quantile and the monthly mean ClearSky incoming solar radiation
Maik Renner, mrenner [at] bgc-jena.mpg.de
Renner, M., M. Wild, M. Schwarz, and A. Kleidon. "Estimating Shortwave Clear-Sky Fluxes from Hourly Global Radiation Records by Quantile Regression." Earth and Space Science, 2019. https://doi.org/10.1029/2019EA000686
1 2 3 4 5 6 7 8 9 10 | data(LIN2003)
# apply regression per month and with different windows
# Check available cores to parallize the task with setting mc.cores larger than 1
detectCores()
(rqmw = LIN2003[ , calc_ClearSky_QuantileRegression_MonthlyTimeWindow(Date,Time,IncomingShortwave, tau = 0.85, lat = 52.21, lon = 14.122, hourshift = 0.5,timeZone = 0, mc.cores = 1)])
plot(IncomingShortwavePotential ~ month, data = rqmw, type = "l", col = 4, ylab = "Shortwave Radiation (W/m2)", ylim = c(0,500))
lines(IncomingShortwaveClearSky ~ month, data = rqmw, type = "l", col =2)
lines(IncomingShortwave ~ month, data = rqmw, type = "b")
legend("topright", c("Potential", "Clear Sky flux", "Observed at surface"), col = c(4,2,1), lty = 1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.