ITR.temperature_score

Classes

ScenarioType

A scenario defines which scenario should be run.

EngagementType

An engagement type defines how the companies will be engaged.

Scenario

A scenario defines the action the portfolio holder will take to improve its temperature score.

TemperatureScore

This class provides a temperature score based on the climate goals.

Module Contents

class ITR.temperature_score.ScenarioType(*args, **kwds)

Bases: enum.Enum

A scenario defines which scenario should be run.

TARGETS = 1
APPROVED_TARGETS = 2
HIGHEST_CONTRIBUTORS = 3
HIGHEST_CONTRIBUTORS_APPROVED = 4
static from_int(value) ScenarioType | None
class ITR.temperature_score.EngagementType(*args, **kwds)

Bases: enum.Enum

An engagement type defines how the companies will be engaged.

SET_TARGETS = 1
SET_SBTI_TARGETS = 2
static from_int(value) EngagementType

Convert an integer to an engagement type.

Parameters:

value – The value to convert

Returns:

static from_string(value: str | None) EngagementType

Convert a string to an engagement type.

Parameters:

value – The value to convert

Returns:

class ITR.temperature_score.Scenario

A scenario defines the action the portfolio holder will take to improve its temperature score.

scenario_type: ScenarioType | None
engagement_type: EngagementType
get_score_cap() float
get_default_score(default_score: float) float
static from_dict(scenario_values: dict) Scenario | None

Convert a dictionary to a scenario. The dictionary should have the following keys:

  • number: The scenario type as an integer

  • engagement_type: The engagement type as a string

Parameters:

scenario_values – The dictionary to convert

Returns:

A scenario object matching the input values or None, if no scenario could be matched

static from_interface(scenario_values: ITR.interfaces.ScenarioInterface | None) Scenario | None

Convert a scenario interface to a scenario.

Parameters:

scenario_values – The interface model instance to convert

Returns:

A scenario object matching the input values or None, if no scenario could be matched

class ITR.temperature_score.TemperatureScore(time_frames: List[ITR.interfaces.ETimeFrames], scopes: List[ITR.interfaces.EScope], default_score: float = TemperatureScoreConfig.DEFAULT_SCORE, model: int = TemperatureScoreConfig.MODEL_NUMBER, scenario: Scenario | None = None, aggregation_method: ITR.portfolio_aggregation.PortfolioAggregationMethod = PortfolioAggregationMethod.WATS, grouping: List | None = None, config: Type[ITR.configs.TemperatureScoreConfig] = TemperatureScoreConfig)

Bases: ITR.portfolio_aggregation.PortfolioAggregation

This class provides a temperature score based on the climate goals.

Parameters:
  • default_score – The temp score if a company is not found

  • model – The regression model to use

  • config – A class defining the constants that are used throughout this class. This parameter is only required if you’d like to overwrite a constant. This can be done by extending the TemperatureScoreConfig class and overwriting one of the parameters.

model = 1
c: Type[ITR.configs.TemperatureScoreConfig]
scenario: Scenario | None = None
default_score = 3.4
time_frames
scopes
aggregation_method: ITR.portfolio_aggregation.PortfolioAggregationMethod
grouping: list = []
regression_model = None
s3_calculation_test = False
get_target_mapping(target: pandas.Series) str | None

Map the target onto an AR6 target (None if not available).

Parameters:

target – The target as a row of a dataframe

Returns:

The mapped AR6 target

get_annual_reduction_rate(target: pandas.Series) float | None

Get the annual reduction rate (or None if not available). From version 1.5 the annual reduction rate is calculated as a compund annual reduction rate, CAR.

Parameters:

target – The target as a row of a dataframe

Returns:

The annual reduction

get_regression(target: pandas.Series) Tuple[float | None, float | None]

Get the regression parameter and intercept from the model’s output.

Parameters:

target – The target as a row of a dataframe

Returns:

The regression parameter and intercept

_merge_regression(data: pandas.DataFrame)

Merge the data with the regression parameters from the CDP-WWF Warming Function. :param data: The data to merge :return: The data set, amended with the regression parameters

get_score(target: pandas.Series) Tuple[float, float]

Get the temperature score for a certain target based on the annual reduction rate and the regression parameters.

Parameters:

target – The target as a row of a data frame

Returns:

The temperature score

aggregate_company_score(row: pandas.Series, company_data: pandas.DataFrame) Tuple[float, float, list]

Get the aggregated temperature score and a temperature result, which indicates how much of the score is based on the default score for a certain company based on the emissions of company.

Parameters:
  • company_data – The original data, grouped by company, time frame and scope category

  • row – The row to calculate the temperature score for (if the scope of the row isn’t s1s2s3,

it will return the original score :return: The aggregated temperature score for a company

get_default_score(target: pandas.Series) int

Get the temperature score for a certain target based on the annual reduction rate and the regression parameters.

Parameters:

target – The target as a row of a dataframe

Returns:

The temperature score

_prepare_data(data: pandas.DataFrame)

Prepare the data such that it can be used to calculate the temperature score.

Parameters:

data – The original data set as a pandas data frame

Returns:

The extended data frame

_calculate_company_score(data)

Calculate the combined s1s2s3 scores for all companies.

Parameters:

data – The original data set as a pandas data frame

Returns:

The data frame, with an updated s1s2s3 temperature score

calculate(data: pandas.DataFrame | None = None, data_providers: List[TemperatureScore.calculate.data] | None = None, portfolio: List[ITR.interfaces.PortfolioCompany] | None = None)

Calculate the temperature for a dataframe of company data. The columns in the data frame should be a combination of IDataProviderTarget and IDataProviderCompany.

Parameters:
  • data – The data set (or None if the data should be retrieved)

  • data_providers – A list of DataProvider instances. Optional, only required if data is empty.

  • portfolio – A list of PortfolioCompany models. Optional, only required if data is empty.

Returns:

A data frame containing all relevant information for the targets and companies

_get_aggregations(data: pandas.DataFrame, total_companies: int) Tuple[ITR.interfaces.Aggregation, pandas.Series, pandas.Series]

Get the aggregated score over a certain data set. Also calculate the (relative) contribution of each company

Parameters:

data – A data set, containing one row per company

Returns:

An aggregated score and the relative and absolute contribution of each company

_get_score_aggregation(data: pandas.DataFrame, time_frame: ITR.interfaces.ETimeFrames, scope: ITR.interfaces.EScope) ITR.interfaces.ScoreAggregation | None

Get a score aggregation for a certain time frame and scope, for the data set as a whole and for the different groupings.

Parameters:
  • data – The whole data set

  • time_frame – A time frame

  • scope – A scope

Returns:

A score aggregation, containing the aggregations for the whole data set and each individual group

aggregate_scores(data: pandas.DataFrame) ITR.interfaces.ScoreAggregations

Aggregate scores to create a portfolio score per time_frame (short, mid, long).

Parameters:

data – The results of the calculate method

Returns:

A weighted temperature score for the portfolio

cap_scores(scores: pandas.DataFrame) pandas.DataFrame

Cap the temperature scores in the input data frame to a certain value, based on the scenario that’s being used. This can either be for the whole data set, or only for the top X contributors.

Parameters:

scores – The data set with the temperature scores

Returns:

The input data frame, with capped scores

anonymize_data_dump(scores: pandas.DataFrame) pandas.DataFrame

Anonymize the scores by deleting the company IDs, ISIN and renaming the companies .

Parameters:

scores – The data set with the temperature scores

Returns:

The input data frame, anonymized

_calculate_s1s2_score(data: pandas.DataFrame) pandas.DataFrame

Calculate the combined S1S2 score each combination of company_id, time_frame and scope. If it was possible på calculate individual S1 and S2 scores, then we calculate the aggregated S1S2 score.

Parameters:

data – The data to calculate the S1S2 score for.

Returns:

The S1S2 score.

_aggregate_s3_score(data: pandas.DataFrame) pandas.DataFrame

Aggregate Scope 3 category scores into a single score per company and time frame.

Steps: 1) Calculate the mean temperature score for s3_category == CAT_15. 2) Remove original CAT_15 rows and append the mean CAT_15 score back to the data. 3) For each company and time frame: a) If GHG data is available for all categories, calculate a weighted average. b) If not, calculate a simple average of the scores. 4) Replace the original scores with the aggregated score.