Cross-Fades the values of one MAGPIE object into the values of another over a certain time
Usage
convergence(
origin,
aim,
start_year = NULL,
end_year = NULL,
direction = NULL,
type = "smooth",
par = 1.5
)Arguments
- origin
an object with one name-column
- aim
Can be twofold: An magpie object or a numeric value.
- start_year
year in which the convergence from origin to aim starts. If set to NULL the the first year of aim is used as start_year
- end_year
year in which the convergence from origin to aim shall be (nearly) reached. If set to NULL the the last year of aim is used as end_year.
- direction
NULL, "up" or "down". NULL means normal convergence in both directions, "up" is only a convergence if origin<aim, "down" means only a convergence if origin>aim
- type
"smooth", "s", "linear" or "decay". Describes the function used for convergence (x starts at 0 and ends at 1): "linear" means linear interpolation. "s" is an s-curve which starts from origin in start_year and reaches aim precisely in end_year. After 50% of the convergence time, it reaches about the middle of the two values. It's using the function x^4/(0.07+x^4)*1.07). "smooth" is a conversion based on the function x^3/(0.1+x^3). With "smooth" only 90% of convergence will be reached in the end year, full convergence is approached as x approaches infinity. "decay" is a conversion based on the function x / (par + x) * (par + 1).
- par
parameter value for convergence function; currently only used for type="decay"
Value
returns a time-series with the same timesteps as origin, which lineary fades into the values of the aim object
See also
Other TemporalOperations:
commonYears(),
lowpass(),
time_interpolate()
Examples
pop <- maxample("pop")
population <- add_columns(pop, "MIX")
population[, , "MIX"] <- convergence(population[, , "A2"], population[, , "B1"])