gcubed.projections.derivation
Provides capacity to augment charting projections with derived variable projections
Overview
Provides convenience methods for all classes.
All G-Cubed classes inherit from this base class.
Overview
Sets up a derived variable to the projections object
Arguments
prefix
: The prefix for the derived variabledescription
: The description of the derived variableprefix_of_existing_variable_with_same_domain
: The variable name prefix of the variable in the database that has the same domain definition (it is defined over the same sets, in the same order).projection_function
: The function that calculates the derived variable. The function should take a single argument, the charting projections dataframe, and return the projections of the derived variable as dataframe.deviation_function
: The function that calculates deviations. The function should take two dataframe arguments.
For the deviations function:
- The first argument is a charting projections dataframe that contains the original projections for the derived variable.
- The second argument is a charting projections dataframe that contains the new projections for the derived variable.
The dataframes passed in the two arguments must have the same projection years and the projections for the same variables.
The deviations function must compute and return the deviations of the new projections for the derived variable from the original projections for the derived variable.
Returns
str
: The prefix of the existing variable with the same domain
Returns
callable
: The function that calculates the derived variable
Returns
callable
: The function that calculates deviations