analysis module

class ezclimate.analysis.ClimateOutput(utility)[source]

Bases: object

Calculate and save output from the EZ-Climate model.

Parameters:utility (Utility object) – object of utility class
utility

Utility object – object of utility class

prices

ndarray – SCC prices

ave_mitigations

ndarray – average mitigations

ave_emissions

ndarray – average emissions

expected_period_price

ndarray – expected SCC for the period

expected_period_mitigation

ndarray – expected mitigation for the period

expected_period_emissions

ndarray – expected emission for the period

calculate_output(m)[source]

Calculated values based on optimal mitigation. For every node the function calculates and saves

  • average mitigation
  • average emission
  • GHG level
  • SCC

as attributes.

For every period the function also calculates and saves

  • expected SCC/price
  • expected mitigation
  • expected emission

as attributes.

Parameters:m (ndarray or list) – array of mitigation
save_output(m, prefix=None)[source]

Function to save calculated values in calculate_output in the file prefix + ‘node_period_output’ in the ‘data’ directory in the current working directory.

The function also saves the values calculated in the utility function in the file prefix + ‘tree’ in the ‘data’ directory in the current working directory.

If there is no ‘data’ directory, one is created.

Parameters:
  • m (ndarray or list) – array of mitigation
  • prefix (str, optional) – prefix to be added to file_name
class ezclimate.analysis.ConstraintAnalysis(run_name, utility, const_value, opt_m=None)[source]

Bases: object

save_output(prefix=None)[source]
class ezclimate.analysis.RiskDecomposition(utility)[source]

Bases: object

Calculate and save analysis of output from the EZ-Climate model.

Parameters:utility (Utility object) – object of utility class
utility

Utility object – object of utility class

sdf_tree

BaseStorageTree object – SDF for each node

expected_damages

ndarray – expected damages in each period

risk_premium

ndarray – risk premium in each period

expected_sdf

ndarray – expected SDF in each period

cross_sdf_damages

ndarray – cross term between the SDF and damages

discounted_expected_damages

ndarray – expected discounted damages for each period

net_discount_damages

ndarray – net discount damage, i.e. when cost is also accounted for

cov_term

ndarray – covariance between SDF and damages

save_output(m, prefix=None)[source]

Save attributes calculated in sensitivity_analysis into the file prefix + sensitivity_output in the data directory in the current working directory.

Furthermore, the perpetuity yield, the discount factor for the last period is calculated, and SCC, expected damage and risk premium for the first period is calculated and saved in into the file prefix + tree in the data directory in the current working directory. If there is no data directory, one is created.

Parameters:
  • m (ndarray or list) – array of mitigation
  • prefix (str, optional) – prefix to be added to file_name
sensitivity_analysis(m)[source]

Calculate sensitivity analysis based on the optimal mitigation. For every sub-period, i.e. the periods given by the utility calculations, the function calculates and saves:

  • discount prices
  • net expected damages
  • expected damages
  • discounted expected damages
  • risk premium
  • cross SDF & damages
  • covariance between SDF and damages

as attributes.

Parameters:
  • m (ndarray or list) – array of mitigation
  • utility (Utility object) – object of utility class
  • prefix (str, optional) – prefix to be added to file_name
ezclimate.analysis.additional_ghg_emission(m, utility)[source]

Calculate the emission added by every node.

Parameters:
  • m (ndarray or list) – array of mitigation
  • utility (Utility object) – object of utility class
Returns:

additional emission in nodes

Return type:

ndarray

ezclimate.analysis.constraint_first_period(utility, first_node, m_size)[source]

Calculate the changes in consumption, the mitigation cost component of consumption, and new mitigation values when constraining the first period mitigation to first_node.

Parameters:
  • m (ndarray or list) – array of mitigation
  • utility (Utility object) – object of utility class
  • first_node (float) – value to constrain first period to
Returns:

(new mitigation array, storage tree of changes in consumption, ndarray of costs in first sub periods)

Return type:

tuple

ezclimate.analysis.delta_consumption(m, utility, cons_tree, cost_tree, delta_m)[source]

Calculate the changes in consumption and the mitigation cost component of consumption when increaseing period 0 mitigiation with delta_m.

Parameters:
  • m (ndarray or list) – array of mitigation
  • utility (Utility object) – object of utility class
  • cons_tree (BigStorageTree object) – consumption storage tree of consumption values from optimal mitigation values
  • cost_tree (SmallStorageTree object) – cost storage tree of cost values from optimal mitigation values
  • delta_m (float) – value to increase period 0 mitigation by
Returns:

(storage tree of changes in consumption, ndarray of costs in first sub periods)

Return type:

tuple

ezclimate.analysis.find_bec(m, utility, constraint_cost, a=-0.1, b=1.5)[source]

Used to find a value for consumption that equalizes utility at time 0 in two different solutions.

Parameters:
  • m (ndarray or list) – array of mitigation
  • utility (Utility object) – object of utility class
  • constraint_cost (float) – utility cost of constraining period 0 to zero
  • a (float, optional) – initial guess
  • b (float, optional) – initial guess - f(b) needs to give different sign than f(a)
Returns:

result of optimization

Return type:

tuple

Note

requires the ‘scipy’ package

ezclimate.analysis.find_ir(m, utility, payment, a=0.0, b=1.0)[source]

Find the price of a bond that creates equal utility at time 0 as adding payment to the value of consumption in the final period. The purpose of this function is to find the interest rate embedded in the EZUtility model.

Parameters:
  • m (ndarray or list) – array of mitigation
  • utility (Utility object) – object of utility class
  • payment (float) – value added to consumption in the final period
  • a (float, optional) – initial guess
  • b (float, optional) – initial guess - f(b) needs to give different sign than f(a)
Returns:

result of optimization

Return type:

tuple

Note

requires the ‘scipy’ package

ezclimate.analysis.find_term_structure(m, utility, payment, a=0.0, b=1.5)[source]

Find the price of a bond that creates equal utility at time 0 as adding payment to the value of consumption in the final period. The purpose of this function is to find the interest rate embedded in the EZUtility model.

Parameters:
  • m (ndarray or list) – array of mitigation
  • utility (Utility object) – object of utility class
  • payment (float) – value added to consumption in the final period
  • a (float, optional) – initial guess
  • b (float, optional) – initial guess - f(b) needs to give different sign than f(a)
Returns:

result of optimization

Return type:

tuple

Note

requires the ‘scipy’ package

ezclimate.analysis.perpetuity_yield(price, start_date, a=0.1, b=10.0)[source]

Find the yield of a perpetuity starting at year start_date.

Parameters:
  • price (float) – price of bond ending at start_date
  • start_date (int) – start year of perpetuity
  • a (float, optional) – initial guess
  • b (float, optional) – initial guess - f(b) needs to give different sign than f(a)
Returns:

result of optimization

Return type:

tuple

Note

requires the ‘scipy’ package

ezclimate.analysis.store_trees(prefix=None, start_year=2015, **kwargs)[source]

Saves values of BaseStorageTree objects. The file is saved into the ‘data’ directory in the current working directory. If there is no ‘data’ directory, one is created.

Parameters:
  • prefix (str, optional) – prefix to be added to file_name
  • start_year (int, optional) – start year of analysis
  • **kwargs – arbitrary keyword arguments of BaseStorageTree objects