Detect and impute outliers with respect to a maximum level of radiation (Ct)

clearsky_outliers(x, Ct, date, threshold = 1e-04, quiet = FALSE)

Arguments

x

Numeric vector, time series of solar radiation.

Ct

Numeric vector, time series of fitted clear sky radiation.

date

Character or Date vector, time series of dates used to precisely impute solar radiation according to the realized values in the same day of the year.

threshold

Numeric, scalar, threshold value used for imputation. Default is 0.0001.

quiet

Logical.

Details

The function will detect the observations for which x > Ct, x < 0 or is.na(x). Then, if

x < 0

If a value is below 0 for a day it will be imputed to be equal to min(x) for that day

.
x > Ct

If a value is above the maximum clear sky Ct it will be imputed to be Ct*(1-threshold)

.
is.na(x)

If a value is NA it will be imputed to be the average mean(x) for that day.

.

Note

Version 1.0.0

Examples

clearsky_outliers(c(1,2,3), 2)
#> Outliers: 2 (67 %)
#> $x
#> [1] 1.0000 1.9998 1.9998
#> 
#> $original
#> [1] 2 3
#> 
#> $imputed
#> [1] 1.9998 1.9998
#> 
#> $index
#> [1] 2 3
#> 
#> $index_type
#> $index_type$na
#> integer(0)
#> 
#> $index_type$lo
#> integer(0)
#> 
#> $index_type$hi
#> [1] 2 3
#> 
#> 
#> $date
#> [1] NA
#> 
#> $n
#> [1] 2
#> 
#> $MAPE
#> [1] 11.11667
#> 
#> $MSE
#> [1] 0.577408
#> 
#> $threshold
#> [1] 1e-04
#>