Skip to content

io.technology_mapping

Load the technology-parameter map for cost sourcing.

Schema: see examples/technology-mapping.example.yaml.

build_technology_sources(spec)

Expand a raw technology entry to its {parameter: source} map.

A bare string applies to every standard parameter; a dict's overrides: win over its source: (or, absent source:, only overrides: parameters are sourced at all).

Source code in src/iampypsa/io/technology_mapping.py
def build_technology_sources(spec: Any) -> dict[str, Any]:
    """Expand a raw technology entry to its ``{parameter: source}`` map.

    A bare string applies to every standard parameter; a dict's ``overrides:`` win over its
    ``source:`` (or, absent ``source:``, only ``overrides:`` parameters are sourced at all).
    """
    if isinstance(spec, str):
        return {param: spec for param in STANDARD_PARAMETERS}
    overrides = spec.get("overrides", {})
    if "source" not in spec:
        return dict(overrides)
    source = spec["source"]
    return {param: overrides.get(param, source) for param in STANDARD_PARAMETERS}

iam_name(tech, spec)

Return the IAM technology name an entry pulls IAM values from.

Source code in src/iampypsa/io/technology_mapping.py
def iam_name(tech: str, spec: Any) -> str:
    """Return the IAM technology name an entry pulls IAM values from."""
    if isinstance(spec, str):
        return tech
    return spec.get("iam_name", tech)

load_technology_parameters(path)

Return {"technologies": {name: spec}} from the model's technology-mapping YAML.

Source code in src/iampypsa/io/technology_mapping.py
def load_technology_parameters(path: str | PathLike) -> dict[str, Any]:
    """Return ``{"technologies": {name: spec}}`` from the model's technology-mapping YAML."""
    with open(path) as f:
        return {"technologies": yaml.safe_load(f)}