Skip to content

gcages.sci_june_2026.harmonisation#

Harmonisation helpers for the SCI workflow

Functions:

Name Description
create_scijune2026_harmoniser

Create an Aneris harmoniser configured for SCI June 2026 harmoniser.

load_historical_emissions

Load historical emissions for harmonisation.

create_scijune2026_harmoniser #

create_scijune2026_harmoniser(
    historical_emissions_file: Path,
    aneris_overrides_file: Path,
    harmonisation_year: int = 2023,
    run_checks: bool = True,
    progress: bool = True,
    n_processes: int | None = cpu_count(),
) -> AnerisHarmoniser

Create an Aneris harmoniser configured for SCI June 2026 harmoniser.

Parameters:

Name Type Description Default
historical_emissions_file Path

File containing CMIP7 ScenarioMIP historical emissions.

required
aneris_overrides_file Path

File containing aneris overrides for the global workflow.

required
harmonisation_year int

Year in which to harmonise

2023
run_checks bool

Should checks of input and output data be performed?

True
progress bool

Should progress bars be shown?

True
n_processes int | None

Number of processes to use for parallel processing.

cpu_count()

Returns:

Type Description
AnerisHarmoniser

Harmoniser that will behave in line with CMIP7 ScenarioMIP's global workflow

Source code in src/gcages/sci_june_2026/harmonisation.py
def create_scijune2026_harmoniser(  # noqa: PLR0913
    historical_emissions_file: Path,
    aneris_overrides_file: Path,
    harmonisation_year: int = 2023,
    run_checks: bool = True,
    progress: bool = True,
    n_processes: int | None = multiprocessing.cpu_count(),
) -> AnerisHarmoniser:
    """
    Create an Aneris harmoniser configured for SCI June 2026 harmoniser.

    Parameters
    ----------
    historical_emissions_file
        File containing CMIP7 ScenarioMIP historical emissions.

    aneris_overrides_file
        File containing aneris overrides for the global workflow.

    harmonisation_year
        Year in which to harmonise

    run_checks
        Should checks of input and output data be performed?

    progress
        Should progress bars be shown?

    n_processes
        Number of processes to use for parallel processing.

    Returns
    -------
    :
        Harmoniser that will behave in line with CMIP7 ScenarioMIP's global workflow
    """
    historical_emissions = load_historical_emissions(
        historical_emissions_file,
    )

    aneris_overrides = load_aneris_overrides_file(aneris_overrides_file)
    aneris_overrides_df = aneris_overrides.to_frame(name="method")

    updated_df = rename_variables(
        aneris_overrides_df,
        from_convention=SupportedNamingConventions.CMIP7_SCENARIOMIP,
        to_convention=SupportedNamingConventions.GCAGES,
    )
    aneris_overrides = updated_df["method"]

    return AnerisHarmoniser(
        historical_emissions=historical_emissions,
        harmonisation_year=harmonisation_year,
        aneris_overrides=aneris_overrides,
        run_checks=run_checks,
        progress=progress,
        n_processes=n_processes,
    )

load_historical_emissions #

load_historical_emissions(
    historical_emissions_file: Path,
) -> DataFrame

Load historical emissions for harmonisation.

Parameters:

Name Type Description Default
historical_emissions_file Path

Path from which to load the file

required

Returns:

Type Description
DataFrame

Historical emissions in GCAGES format

Source code in src/gcages/sci_june_2026/harmonisation.py
def load_historical_emissions(
    historical_emissions_file: Path,
) -> pd.DataFrame:
    """
    Load historical emissions for harmonisation.

    Parameters
    ----------
    historical_emissions_file
        Path from which to load the file

    Returns
    -------
    :
        Historical emissions in GCAGES format
    """
    historical_emissions = load_timeseries_csv(
        historical_emissions_file,
        lower_column_names=True,
        index_columns=["model", "scenario", "region", "variable", "unit"],
        out_columns_type=int,
    )

    # Drop out the model and scenario levels
    historical_emissions = historical_emissions.reset_index(
        historical_emissions.index.names.difference(["variable", "region", "unit"]),  # type: ignore # pandas-stubs out of date
        drop=True,
    )

    # Use gcages naming to match pre-processed outputs.
    historical_emissions = rename_variables(
        historical_emissions,
        from_convention=SupportedNamingConventions.CMIP7_SCENARIOMIP,
        to_convention=SupportedNamingConventions.GCAGES,
    )

    return historical_emissions