message_ix_models.model.material.share_constraints.CommShareConfig

class message_ix_models.model.material.share_constraints.CommShareConfig(share_name: str, type_tec_all_name: str, type_tec_share_name: str, all_tecs: ~typing.List[str], share_tecs: ~typing.List[str], nodes: str | ~typing.List[str], dims_all: dict[str, ~typing.List[str]] = <factory>, dims_share: dict[str, ~typing.List[str]] = <factory>)[source]

Bases: object

Configuration for commodity share constraints.

Collects and prepares all data required to add a new commodity share constraint to the model structure of a Scenario.

mode-commodity-level indices for map_shares_commodity_<total/share> can be inferred from input parameter data from a scenario based on the provided technology lists all_tecs and share_tecs.

Alternatively, they can be defined explicitly through dims_all and dims_share in the YAML config file.

The same applies to nodes. If nodes: all, all model regions except “World” are used.

__init__(share_name: str, type_tec_all_name: str, type_tec_share_name: str, all_tecs: ~typing.List[str], share_tecs: ~typing.List[str], nodes: str | ~typing.List[str], dims_all: dict[str, ~typing.List[str]] = <factory>, dims_share: dict[str, ~typing.List[str]] = <factory>) None

Methods

__init__(share_name, type_tec_all_name, ...)

add_to_scenario(scen)

Add all required sets and categories to a scenario.

dims_from_tecs(scen, tec_type)

Initialize dims_all or dims_share from model structure.

from_files(scen, name)

Create a CommShareConfig instance from YAML file and model structure.

get_map_share_set_share(scen)

Generate map_shares_commodity_share from config and model structure.

get_map_share_set_total(scen)

Generate map_shares_commodity_total from config and model structure.

remove_from_scenario(scen)

Remove all required sets and categories to a scenario.

Attributes

share_name

type_tec_all_name

type_tec_share_name

all_tecs

share_tecs

nodes

dims_all

dims_share

add_to_scenario(scen: Scenario) None[source]

Add all required sets and categories to a scenario.

dims_from_tecs(scen: Scenario, tec_type: Literal['all', 'share']) dict[str, List[str]][source]

Initialize dims_all or dims_share from model structure.

classmethod from_files(scen: Scenario, name: str) CommShareConfig[source]

Create a CommShareConfig instance from YAML file and model structure.

get_map_share_set_share(scen) DataFrame[source]

Generate map_shares_commodity_share from config and model structure.

get_map_share_set_total(scen: Scenario) DataFrame[source]

Generate map_shares_commodity_total from config and model structure.

remove_from_scenario(scen) None[source]

Remove all required sets and categories to a scenario.