optigob ======= .. py:module:: optigob Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/optigob/bioenergy/index /autoapi/optigob/budget_model/index /autoapi/optigob/database/index /autoapi/optigob/forest/index /autoapi/optigob/input_helper/index /autoapi/optigob/livestock/index /autoapi/optigob/logger/index /autoapi/optigob/optigob/index /autoapi/optigob/other_land/index /autoapi/optigob/protein_crops/index /autoapi/optigob/resource_manager/index /autoapi/optigob/static_ag/index /autoapi/optigob/substitution/index Attributes ---------- .. autoapisummary:: optigob.__version__ Classes ------- .. autoapisummary:: optigob.Optigob optigob.OptiGobDataManager optigob.InputHelper Functions --------- .. autoapisummary:: optigob.configure_logging optigob.get_logger Package Contents ---------------- .. py:data:: __version__ .. py:class:: Optigob(optigob_data_manager) Central interface for retrieving, aggregating, and analyzing all model outputs in the FORESIGHT system. The Optigob class provides a unified API for accessing emissions, land area, protein, bioenergy, harvested wood products, and substitution impacts for both baseline and scenario cases. It wraps all major model outputs, including sectoral and total values for CO2e, CO2, CH4, N2O, land area (aggregated/disaggregated/HNV), protein, bioenergy, harvested wood products, and substitution impacts. All results can be returned as dictionaries or tidy Pandas DataFrames for further analysis and reporting. :param optigob_data_manager: An instance of the data manager class, typically OptiGobDataManager, providing access to all model data and configuration. .. py:attribute:: data_manager_class .. py:attribute:: baseline_emission .. py:attribute:: emission_budget .. py:attribute:: land_area_budget .. py:attribute:: econ_output .. py:attribute:: split_gas .. py:method:: get_livestock_co2e_emission_budget() Retrieve the total livestock CO2e emissions (kt) budget available for the scenario. :returns: Total livestock CO2e emissions budget in kilotons. :rtype: float .. py:method:: get_livestock_split_gas_ch4_emission_budget() Retrieve the total livestock split gas CH4 emissions (kt) budget available for the scenario. :returns: Total livestock split gas CH4 emissions budget in kilotons. :rtype: float :raises ValueError: If split gas is not included in the model configuration. .. py:method:: total_emission_co2e() Return the total scenario CO2e emissions (kt) for all sectors combined. :returns: Total scenario CO2e emissions in kilotons. :rtype: float .. py:method:: check_net_zero_status() Check if the model is set to net zero, using either the split gas or net zero budget as appropriate. :returns: True if the model is set to net zero (or split gas net zero), False otherwise. None if not applicable. :rtype: bool or None .. py:method:: get_baseline_co2e_emissions_by_sector() Retrieve baseline CO2e emissions by sector. :returns: Sectors as keys and baseline CO2e emissions (kt) as values. :rtype: dict .. py:method:: get_baseline_ch4_emissions_by_sector() Retrieve baseline CH4 emissions by sector. :returns: Sectors as keys and baseline CH4 emissions (kt) as values. :rtype: dict .. py:method:: get_baseline_n2o_emissions_by_sector() Retrieve baseline N2O emissions by sector. :returns: Sectors as keys and baseline N2O emissions (kt) as values. :rtype: dict .. py:method:: get_baseline_co2_emissions_by_sector() Retrieve baseline CO2 emissions by sector. :returns: Sectors as keys and baseline CO2 emissions (kt) as values. :rtype: dict .. py:method:: get_baseline_co2e_emissions_total() Retrieve total baseline CO2e emissions. :returns: Total baseline CO2e emissions in kilotons. :rtype: float .. py:method:: get_baseline_co2_emissions_total() Retrieve total baseline CO2 emissions. :returns: Total baseline CO2 emissions in kilotons. :rtype: float .. py:method:: get_baseline_ch4_emissions_total() Retrieve total baseline CH4 emissions. :returns: Total baseline CH4 emissions in kilotons. :rtype: float .. py:method:: get_baseline_n2o_emissions_total() Retrieve total baseline N2O emissions. :returns: Total baseline N2O emissions in kilotons. :rtype: float .. py:method:: get_scenario_co2e_emissions_by_sector() Retrieve scenario CO2e emissions by sector. :returns: Sectors as keys and scenario CO2e emissions (kt) as values. :rtype: dict .. py:method:: get_scenario_ch4_emissions_by_sector() Retrieve scenario CH4 emissions by sector. :returns: Sectors as keys and scenario CH4 emissions (kt) as values. :rtype: dict .. py:method:: get_scenario_n2o_emissions_by_sector() Retrieve scenario N2O emissions by sector. :returns: Sectors as keys and scenario N2O emissions (kt) as values. :rtype: dict .. py:method:: get_scenario_co2_emissions_by_sector() Retrieve scenario CO2 emissions by sector. :returns: Sectors as keys and scenario CO2 emissions (kt) as values. :rtype: dict .. py:method:: get_total_emissions_co2e_by_sector() Retrieve total CO2e emissions by sector for both baseline and scenario. :returns: Dictionary with 'baseline' and 'scenario' as keys and dictionaries of sector emissions as values. :rtype: dict .. py:method:: get_total_emissions_ch4_by_sector() Retrieve total CH4 emissions by sector for both baseline and scenario. :returns: Dictionary with 'baseline' and 'scenario' as keys and dictionaries of sector emissions as values. :rtype: dict .. py:method:: get_total_emissions_n2o_by_sector() Retrieve total N2O emissions by sector for both baseline and scenario. :returns: Dictionary with 'baseline' and 'scenario' as keys and dictionaries of sector emissions as values. :rtype: dict .. py:method:: get_total_emissions_co2_by_sector() Retrieve total CO2 emissions by sector for both baseline and scenario. :returns: Dictionary with 'baseline' and 'scenario' as keys and dictionaries of sector emissions as values. :rtype: dict .. py:method:: get_total_emissions_co2e_by_sector_df() Return total CO2e emissions as a tidy DataFrame with sectors as rows and 'baseline' and 'scenario' as columns. :returns: DataFrame with sectors as rows and 'baseline' and 'scenario' as columns. :rtype: pd.DataFrame .. py:method:: get_aggregated_total_land_area_by_sector() Retrieve aggregated land area by sector for both baseline and scenario. :returns: Dictionary with 'baseline' and 'scenario' as keys and dictionaries of sector land areas as values. :rtype: dict .. py:method:: get_aggregated_total_land_area_by_sector_df() Return aggregated land area as a tidy DataFrame with sectors as rows and 'baseline' and 'scenario' as columns. :returns: DataFrame with sectors as rows and 'baseline' and 'scenario' as columns. :rtype: pd.DataFrame .. py:method:: get_disaggregated_total_land_area_by_sector() Retrieve disaggregated land area by sector for both baseline and scenario. :returns: Dictionary with 'baseline' and 'scenario' as keys and dictionaries of disaggregated sector land areas as values. :rtype: dict .. py:method:: get_disaggregated_total_land_area_by_sector_df() Return disaggregated land area as a tidy DataFrame with disaggregated sectors as rows and 'baseline' and 'scenario' as columns. :returns: DataFrame with disaggregated sectors as rows and 'baseline' and 'scenario' as columns. :rtype: pd.DataFrame .. py:method:: get_total_protein_by_sector() Retrieve total protein by sector for both baseline and scenario. :returns: Dictionary with 'baseline' and 'scenario' as keys and dictionaries of sector protein as values. :rtype: dict .. py:method:: get_total_protein_by_sector_df() Return total protein as a tidy DataFrame with sectors as rows and 'baseline' and 'scenario' as columns. :returns: DataFrame with sectors as rows and 'baseline' and 'scenario' as columns. :rtype: pd.DataFrame .. py:method:: get_total_hnv_land_area_by_sector() Retrieve total HNV (High Nature Value) land area by sector for both baseline and scenario. :returns: Dictionary with 'baseline' and 'scenario' as keys and dictionaries of HNV land areas as values. :rtype: dict .. py:method:: get_total_hnv_land_area_by_sector_df() Return total HNV land area as a tidy DataFrame with sectors as rows and 'baseline' and 'scenario' as columns. :returns: DataFrame with sectors as rows and 'baseline' and 'scenario' as columns. :rtype: pd.DataFrame .. py:method:: get_bioenergy_by_sector() Retrieve bioenergy area by sector for both baseline and scenario. :returns: Dictionary with 'baseline' and 'scenario' as keys and dictionaries of bioenergy areas as values. :rtype: dict .. py:method:: get_bioenergy_by_sector_df() Return bioenergy area as a tidy DataFrame with sectors as rows and 'baseline' and 'scenario' as columns. :returns: DataFrame with sectors as rows and 'baseline' and 'scenario' as columns. :rtype: pd.DataFrame .. py:method:: get_hwp_volume() Retrieve the volume of harvested wood products (in cubic meters) for both baseline and scenario. :returns: Dictionary with 'baseline' and 'scenario' as keys and HWP volumes as values. :rtype: dict .. py:method:: get_hwp_volume_df() Return the harvested wood products (HWP) volume as a tidy DataFrame with 'baseline' and 'scenario' as columns. :returns: DataFrame with 'baseline' and 'scenario' as columns. :rtype: pd.DataFrame .. py:method:: get_substitution_emission_by_sector_co2e() Retrieve substitution emissions by sector for CO2e. :returns: Dictionary with 'baseline' and 'scenario' as keys and dictionaries of substitution emissions as values. :rtype: dict .. py:method:: get_substitution_emission_by_sector_co2e_df() Return substitution emissions for CO2e as a tidy DataFrame with sectors as rows and 'baseline' and 'scenario' as columns. :returns: DataFrame with sectors as rows and 'baseline' and 'scenario' as columns. :rtype: pd.DataFrame .. py:method:: get_substitution_emission_by_sector_co2() Retrieve substitution emissions by sector for CO2. :returns: Dictionary with 'baseline' and 'scenario' as keys and dictionaries of substitution emissions as values. :rtype: dict .. py:method:: get_substitution_emission_by_sector_co2_df() Return substitution emissions for CO2 as a tidy DataFrame with sectors as rows and 'baseline' and 'scenario' as columns. :returns: DataFrame with sectors as rows and 'baseline' and 'scenario' as columns. :rtype: pd.DataFrame .. py:method:: get_substitution_emission_by_sector_ch4() Retrieve substitution emissions by sector for CH4. :returns: Dictionary with 'baseline' and 'scenario' as keys and dictionaries of substitution emissions as values. :rtype: dict .. py:method:: get_substitution_emission_by_sector_ch4_df() Return substitution emissions for CH4 as a tidy DataFrame with sectors as rows and 'baseline' and 'scenario' as columns. :returns: DataFrame with sectors as rows and 'baseline' and 'scenario' as columns. :rtype: pd.DataFrame .. py:method:: get_substitution_emission_by_sector_n2o() Retrieve substitution emissions by sector for N2O. :returns: Dictionary with 'baseline' and 'scenario' as keys and dictionaries of substitution emissions as values. :rtype: dict .. py:method:: get_substitution_emission_by_sector_n2o_df() Return substitution emissions for N2O as a tidy DataFrame with sectors as rows and 'baseline' and 'scenario' as columns. :returns: DataFrame with sectors as rows and 'baseline' and 'scenario' as columns. :rtype: pd.DataFrame .. py:method:: get_livestock_population() Retrieve the livestock population in number of animals for both baseline and scenario. :returns: Dictionary with 'baseline' and 'scenario' as keys and dictionaries of livestock populations as values. :rtype: dict .. py:method:: get_livestock_population_df() Return the livestock population as a tidy DataFrame with 'baseline' and 'scenario' as columns. :returns: DataFrame with 'baseline' and 'scenario' as columns. :rtype: pd.DataFrame .. py:class:: OptiGobDataManager(sip) .. py:attribute:: db_manager .. py:attribute:: solver_name :value: None .. py:attribute:: _livestock_emission_scalers :value: None .. py:attribute:: _livestock_area_scalers :value: None .. py:attribute:: _livestock_protein_scalers :value: None .. py:attribute:: _forest_scalers :value: None .. py:attribute:: _static_forest_scalers :value: None .. py:attribute:: _wood_ccs_scalers :value: None .. py:attribute:: _hwp_scalers :value: None .. py:attribute:: _substitution_scalers :value: None .. py:attribute:: _organic_soil_emission_scalers :value: None .. py:attribute:: _organic_soil_area_scalers :value: None .. py:attribute:: _ad_area_scalers :value: None .. py:attribute:: _ad_emission_scalers :value: None .. py:attribute:: _crop_scalers :value: None .. py:attribute:: _static_livestock_emission_scalers :value: None .. py:attribute:: _static_livestock_area_scalers :value: None .. py:attribute:: _static_livestock_protein_scalers :value: None .. py:attribute:: _protein_crop_emission_scalers :value: None .. py:attribute:: _protein_crop_protein_scalers :value: None .. py:attribute:: _protein_content_scalers :value: None .. py:attribute:: _willow_bioenergy_scalers :value: None .. py:attribute:: _ha_to_kha :value: 0.001 .. py:attribute:: _kha_to_ha :value: 1000.0 .. py:attribute:: _AR_VALUES .. py:attribute:: emission_sectors :value: ['agriculture', 'existing_forest', 'afforestation', 'hwp', 'other_land_use', 'ad', 'beccs'] .. py:method:: _get_available_solvers() Retrieves the list of available solvers from the Pyomo SolverFactory. :returns: A list of available solver names. :rtype: list .. py:method:: _validate_input_parameters() Validate that input parameters are consistent and within valid ranges. This method performs two types of validation: 1. Parameter consistency checks (e.g., split_gas and split_gas_frac) 2. Database combination validation (e.g., forest, organic soil, abatement parameters) For database combination validation, the method checks if the provided parameter combinations exist in the underlying database. Not all parameter combinations are valid - the database contains only specific combinations that have been modeled. Use the InputHelper class to explore valid combinations: from optigob.input_helper import InputHelper helper = InputHelper() helper.print_all_combos() # View all valid combinations :raises ValueError: If parameters are invalid, inconsistent, or form an invalid combination not present in the database. :Warns: **UserWarning** -- If parameters are confusing but don't affect calculations. .. py:method:: _validate_forest_parameters() Validate forest parameter combinations against database. Checks if the provided forest parameters form a valid combination that exists in the database. Only validates if all four forest parameters are provided. :raises ValueError: If the forest parameter combination is invalid. .. py:method:: _validate_organic_soil_parameters() Validate organic soil parameter combinations against database. Checks if the provided organic soil parameters form a valid combination that exists in the database. Only validates if both organic soil parameters are provided. :raises ValueError: If the organic soil parameter combination is invalid. .. py:method:: _validate_abatement_productivity_parameters() Validate abatement and productivity parameter combinations against database. Checks if the provided abatement_type and abatement_scenario form a valid combination that exists in the database. Only validates if both parameters are provided. :raises ValueError: If the abatement/productivity parameter combination is invalid. .. py:method:: get_solver_name() Retrieves the solver name from the SIP input parameters. :returns: The solver name specified in the SIP input parameters. :rtype: str :raises ValueError: If the solver_name parameter is missing from the SIP input parameters. .. py:method:: get_ha_to_kha() Retrieves the conversion factor from hectares to square kilometers. :returns: The conversion factor. :rtype: float .. py:method:: get_kha_to_ha() Retrieves the conversion factor from square kilometers to hectares. :returns: The conversion factor. :rtype: float .. py:method:: get_AR_gwp100_values(gas) Retrieves the GWP values for each gas based on the AR value. :param gas: The gas identifier (e.g., "CO2", "CH4", "N2O"). :type gas: str :returns: The GWP values for each gas. :rtype: dict .. py:method:: get_emission_sectors() Retrieves the emission sectors. :returns: The emission sectors. :rtype: list .. py:method:: _load_livestock_emission_scalers() Loads and caches the livestock scalers from the database. .. py:method:: _load_static_livestock_emission_scalers() Loads and caches the static livestock scalers from the database. .. py:method:: _load_livestock_area_scalers() Loads and caches the livestock area scalers from the database. .. py:method:: _load_static_livestock_area_scalers() Loads and caches the static livestock area scalers from the database. .. py:method:: _load_livestock_protein_scalers() Loads and caches the livestock protein scalers from the database. .. py:method:: _load_static_livestock_protein_scalers() Loads and caches the static livestock protein scalers from the database. .. py:method:: _load_forest_scalers() Loads and caches the forest scalers from the database. .. py:method:: _load_static_forest_scalers() Loads and caches the static forest scalers from the database. .. py:method:: _load_wood_ccs_scalers() Loads and caches the CCS scalers from the database. .. py:method:: _load_hwp_scalers() Loads and caches the HWP scalers from the database. .. py:method:: _load_substitution_scalers() Loads and caches the substitution scalers from the database. .. py:method:: _load_organic_soil_emission_scalers() Loads and caches the organic soil emission scalers from the database. .. py:method:: _load_organic_soil_area_scalers() Loads and caches the organic soil area scalers from the database. .. py:method:: _load_ad_area_scalers() Loads and caches the AD area scalers from the database. .. py:method:: _load_ad_emission_scalers() Loads and caches the AD emission scalers from the database. .. py:method:: _load_crop_scalers() Loads and caches the crop scalers from the database. .. py:method:: _load_protein_crop_emission_scalers() Loads and caches the protein crop emission scalers from the database. .. py:method:: _load_protein_crop_protein_scalers() Loads and caches the protein crop protein scalers from the database. .. py:method:: _load_protein_content_scalers() Loads and caches the protein content scalers from the database. .. py:method:: _load_willow_bioenergy_scalers() Loads and caches the willow bioenergy scalers from the database. .. py:method:: get_livestock_emission_scaler(year, system, gas, scenario, abatement) Retrieves the scaler value for a given year, system, gas, and scenario. :param year: The year of interest. :type year: int :param system: The system identifier. :type system: str :param gas: The gas identifier. :type gas: str :param scenario: The scenario identifier. :type scenario: int :param abatement: The abatement identifier. :type abatement: int :returns: The scaler value and additional information. :rtype: dict :raises ValueError: If no matching row is found. .. py:method:: get_livestock_area_scaler(year, system, scenario, abatement) Retrieves the scaler value for a given year, system, and scenario. :param year: The year of interest. :type year: int :param system: The system identifier(s). :type system: str or list :param scenario: The scenario identifier. :type scenario: int :param abatement: The abatement identifier. :type abatement: int :returns: The filtered DataFrame containing the scaler values. :rtype: DataFrame :raises ValueError: If no matching row is found. .. py:method:: get_livestock_protein_scaler(year, system, item, scenario, abatement) Retrieves the scaler value for a given year, system, and scenario. :param year: The year of interest. :type year: int :param system: The system identifier. :type system: str :param item: The item identifier. :type item: str :param scenario: The scenario identifier. :type scenario: int :param abatement: The abatement identifier. :type abatement: int :returns: The filtered DataFrame containing the scaler values. :rtype: DataFrame :raises ValueError: If no matching row is found. .. py:method:: get_static_livestock_emission_scaler(year, system, gas, abatement) Retrieves the static scaler value for a given year, system, gas, and abatement. :param year: The year of interest. :type year: int :param system: The system identifier. :type system: str :param gas: The gas identifier. :type gas: str :param abatement: The abatement identifier. :type abatement: int :returns: The filtered DataFrame containing the scaler values. :rtype: DataFrame :raises ValueError: If no matching row is found. .. py:method:: get_static_livestock_area_scaler(year, system, abatement) Retrieves the static scaler value for a given year, system, and abatement. :param year: The year of interest. :type year: int :param system: The system identifier. :type system: str :param abatement: The abatement identifier. :type abatement: int :returns: The filtered DataFrame containing the scaler values. :rtype: DataFrame :raises ValueError: If no matching row is found. .. py:method:: get_static_livestock_protein_scaler(year, system, item, abatement) Retrieves the static scaler value for a given year, system, and abatement. :param year: The year of interest. :type year: int :param system: The system identifier. :type system: str :param item: The item identifier. :type item: str :param abatement: The abatement identifier. :type abatement: int :returns: The filtered DataFrame containing the scaler values. :rtype: DataFrame :raises ValueError: If no matching row is found. .. py:method:: get_forest_scaler(target_year, affor_rate, broadleaf_frac, organic_soil_frac, harvest) Retrieves the scaler value for a given year and forest management parameters. :param target_year: The year of interest. :type target_year: int :param affor_rate: The afforestation rate in kha per year. :type affor_rate: float :param broadleaf_frac: The fraction of broadleaf trees. :type broadleaf_frac: float :param organic_soil_frac: The fraction of organic soil. :type organic_soil_frac: float :param harvest: The forest harvest intensity. :type harvest: float :returns: The filtered DataFrame containing the scaler values. :rtype: DataFrame :raises ValueError: If no matching row is found. .. py:method:: get_static_forest_scaler(target_year, harvest) Retrieves the static scaler value for a given year and harvest intensity. :param target_year: The year of interest. :type target_year: int :param harvest: The forest harvest intensity. :type harvest: float :returns: The filtered DataFrame containing the scaler values. :rtype: DataFrame :raises ValueError: If no matching row is found. .. py:method:: get_wood_ccs_scaler(target_year, affor_rate, broadleaf_frac, organic_soil_frac, harvest) Retrieves the CCS scaler value for a given year and forest management parameters. :param target_year: The year of interest. :type target_year: int :param affor_rate: The afforestation rate in kha per year. :type affor_rate: float :param broadleaf_frac: The fraction of broadleaf trees. :type broadleaf_frac: float :param organic_soil_frac: The fraction of organic soil. :type organic_soil_frac: float :param harvest: The forest harvest intensity. :type harvest: float :returns: The filtered DataFrame containing the scaler values. :rtype: DataFrame :raises ValueError: If no matching row is found. .. py:method:: get_hwp_scaler(target_year, affor_rate, broadleaf_frac, organic_soil_frac, harvest) Retrieves the HWP scaler value for a given year and forest management parameters. :param target_year: The year of interest. :type target_year: int :param affor_rate: The afforestation rate in kha per year. :type affor_rate: float :param broadleaf_frac: The fraction of broadleaf trees. :type broadleaf_frac: float :param organic_soil_frac: The fraction of organic soil. :type organic_soil_frac: float :param harvest: The forest harvest intensity. :type harvest: float :returns: The filtered DataFrame containing the scaler values. :rtype: DataFrame :raises ValueError: If no matching row is found. .. py:method:: get_substitution_scaler(target_year, affor_rate, broadleaf_frac, organic_soil_frac, harvest) Retrieves the substitution scaler value for a given year and forest management parameters. :param target_year: The year of interest. :type target_year: int :param affor_rate: The afforestation rate in kha per year. :type affor_rate: float :param broadleaf_frac: The fraction of broadleaf trees. :type broadleaf_frac: float :param organic_soil_frac: The fraction of organic soil. :type organic_soil_frac: float :param harvest: The forest harvest intensity. :type harvest: float :returns: The filtered DataFrame containing the scaler values. :rtype: DataFrame :raises ValueError: If no matching row is found. .. py:method:: get_organic_soil_emission_scaler(target_year, wetland_restored_frac, organic_soil_under_grass_frac) Retrieves the organic soil emission scaler value for a given year and land management parameters. :param target_year: The year of interest. :type target_year: int :param wetland_restored_frac: The fraction of wetland restored. :type wetland_restored_frac: float :param organic_soil_under_grass_frac: The fraction of organic soil under grass. :type organic_soil_under_grass_frac: float :returns: The filtered DataFrame containing the scaler values. :rtype: DataFrame :raises ValueError: If no matching row is found. .. py:method:: get_organic_soil_area_scaler(target_year, wetland_restored_frac, organic_soil_under_grass_frac) Retrieves the organic soil area scaler value for a given year and land management parameters. :param target_year: The year of interest. :type target_year: int :param wetland_restored_frac: The fraction of wetland restored. :type wetland_restored_frac: float :param organic_soil_under_grass_frac: The fraction of organic soil under grass. :type organic_soil_under_grass_frac: float :returns: The filtered DataFrame containing the scaler values. :rtype: DataFrame :raises ValueError: If no matching row is found. .. py:method:: get_ad_area_scaler(target_year) Retrieves the AD area scaler value for a given year. :param target_year: The year of interest. :type target_year: int :returns: The filtered DataFrame containing the scaler values. :rtype: DataFrame :raises ValueError: If no matching row is found. .. py:method:: get_ad_emission_scaler(target_year) Retrieves the AD emission scaler value for a given year. :param target_year: The year of interest. :type target_year: int :returns: The filtered DataFrame containing the scaler values. :rtype: DataFrame :raises ValueError: If no matching row is found. .. py:method:: get_crop_scaler(year, gas, abatement) Retrieves the crop scaler value for a given year, gas, and abatement. :param year: The year of interest. :type year: int :param gas: The gas identifier. :type gas: str :param abatement: The abatement identifier. :type abatement: int :returns: The filtered DataFrame containing the scaler values. :rtype: DataFrame :raises ValueError: If no matching row is found. .. py:method:: get_protein_crop_emission_scaler(year, ghg, abatement) Retrieves the protein crop emission scaler value for a given year, crop, gas, and abatement. .. py:method:: get_protein_crop_protein_scaler(year, abatement) Retrieves the protein crop protein scaler value for a given year, crop, and abatement. .. py:method:: get_protein_content_scaler(type) Retrieves the protein content scaler value. :returns: The DataFrame containing the protein content scaler values. :rtype: DataFrame :raises ValueError: If no matching row is found. .. py:method:: get_willow_bioenergy_scaler(year, type, ghg) Retrieves the willow bioenergy scaler value for a given year, type, and gas. :param year: The year of interest. :type year: int :param type: The type of willow bioenergy. :type type: str :param ghg: The greenhouse gas identifier. :type ghg: str :returns: The filtered DataFrame containing the scaler values. :rtype: DataFrame :raises ValueError: If no matching row is found. .. py:method:: get_baseline_year() Retrieves the baseline year from the SIP input file. :returns: The baseline year. :rtype: int .. py:method:: get_target_year() Retrieves the target year from the SIP input file. :returns: The target year. :rtype: int .. py:method:: get_abatement_scenario() Retrieves the abatement scenario from the SIP input file. :returns: The abatement scenario. :rtype: str .. py:method:: get_livestock_ratio_type() Retrieves the livestock ratio type from the SIP input file. :returns: The livestock ratio type. :rtype: str .. py:method:: get_livestock_ratio_value() Retrieves the livestock ratio from the SIP input file. :returns: The livestock ratio. :rtype: float .. py:method:: get_forest_harvest_intensity() Retrieves the forest harvest intensity from the SIP input file. :returns: The forest harvest intensity. :rtype: float .. py:method:: get_afforestation_rate_kha_per_year() Retrieves the afforestation rate in kha per year from the SIP input file. :returns: The afforestation rate in kha per year. :rtype: float .. py:method:: get_broadleaf_fraction() Retrieves the broadleaf fraction from the SIP input file. :returns: The broadleaf fraction. :rtype: float .. py:method:: get_organic_soil_fraction_forest() Retrieves the organic soil fraction for forest from the SIP input file. :returns: The organic soil fraction for forest. :rtype: float .. py:method:: get_beccs_included() Retrieves whether BECCS is included from the SIP input file. :returns: True if BECCS is included, False otherwise. :rtype: bool .. py:method:: get_wetland_restored_fraction() Retrieves the wetland restored fraction from the SIP input file. :returns: The wetland restored fraction. :rtype: float .. py:method:: get_organic_soil_under_grass_fraction() Retrieves the organic soil under grass fraction from the SIP input file. :returns: The organic soil under grass fraction. :rtype: float .. py:method:: get_biomethane_included() Retrieves whether biomethane is included from the SIP input file. :returns: True if biomethane is included, False otherwise. :rtype: bool .. py:method:: get_abatement_type() Retrieves the abatement type from the SIP input file. :returns: The abatement type. :rtype: str .. py:method:: get_AR() Retrieves the AR value from the SIP input file. :returns: The AR value. :rtype: str .. py:method:: get_split_gas() Retrieves whether split gas is used from the SIP input file. :returns: True if split gas is used, False otherwise. :rtype: bool .. py:method:: get_split_gas_fraction() Retrieves the split gas fraction from the SIP input file. :returns: The split gas fraction. :rtype: float .. py:method:: get_protein_crop_included() Retrieves whether protein crop is included from the SIP input file. :returns: True if protein crop is included, False otherwise. :rtype: bool .. py:method:: get_protein_crop_multiplier() Retrieves the protein crop multiplier from the SIP input file. :returns: The protein crop multiplier. :rtype: float .. py:method:: get_beccs_willow_area_multiplier() Retrieves the BECCS willow area multiplier from the SIP input file. :returns: The BECCS willow area multiplier. :rtype: float .. py:method:: get_pig_and_poultry_multiplier() Retrieves the pig and poultry multiplier from the SIP input file. :returns: The pig and poultry multiplier. :rtype: float .. py:method:: get_baseline_dairy_population() Retrieves the baseline dairy population from the SIP input file. :returns: The baseline dairy population. :rtype: int .. py:method:: get_baseline_beef_population() Retrieves the baseline beef population from the SIP input file. :returns: The baseline beef population. :rtype: int .. py:class:: InputHelper InputHelper class for querying and displaying valid input parameter combinations for Optigob scenarios. Provides convenience methods to print, filter, and retrieve input combos as DataFrames or dicts. .. py:attribute:: query .. py:method:: get_combos_dict() Returns all valid input combinations as a dictionary. :returns: {input_type: [combo_dict, ...], ...} :rtype: dict .. py:method:: get_combos_df() Returns all valid input combinations as a pandas DataFrame. :returns: DataFrame with all input combinations and input_type column. :rtype: pd.DataFrame .. py:method:: print_all_combos() Prints all valid input combinations to the screen, grouped by input type. .. py:method:: filter_combos(input_type=None, **kwargs) Filters input combinations by input_type and/or parameter values. :param input_type: Filter by input type (e.g., 'forest', 'organic_soil'). :type input_type: str, optional :param \*\*kwargs: Additional key-value pairs to filter on (e.g., broadleaf_frac=0.5). :returns: Filtered DataFrame of input combinations. :rtype: pd.DataFrame .. py:method:: print_readable_combos(max_rows_per_type=10) Prints a nicely formatted, readable summary of valid input combinations, grouped by input type. Limits rows per input type for readability. :param max_rows_per_type: Maximum number of combos to show per input type. :type max_rows_per_type: int .. py:function:: configure_logging(level=logging.INFO, log_to_file=None, format_style='detailed') Configure logging for optigob with sensible defaults. This is a convenience function for common logging setups. Users can call this at the start of their script to control what optigob logs. :param level: Minimum logging level to display. Options: - logging.DEBUG (most verbose - shows everything) - logging.INFO (normal - shows general info) - logging.WARNING (quiet - only warnings and errors) - logging.ERROR (very quiet - only errors) Default: logging.INFO :type level: int :param log_to_file: If provided, logs will be written to this file in addition to the console. If None, logs only go to console. Default: None :type log_to_file: str, optional :param format_style: How detailed the log messages should be. Options: - "simple": Just the message - "detailed": Time, module name, level, and message Default: "detailed" :type format_style: str :returns: None .. rubric:: Example >>> # Show all INFO and above messages >>> configure_logging(level=logging.INFO) >>> # Only show warnings and errors >>> configure_logging(level=logging.WARNING) >>> # Log everything to a file >>> configure_logging(level=logging.DEBUG, log_to_file="optigob.log") .. note:: This function configures the root 'optigob' logger. If you need more advanced control, use Python's logging module directly. .. py:function:: get_logger(name=None) Get a logger instance for optigob. This function returns a logger that is part of the 'optigob' logging hierarchy. All optigob loggers can be controlled together by configuring the root 'optigob' logger. :param name: Name of the module/component requesting the logger. If provided, logger will be named "optigob.{name}". If None, returns the root "optigob" logger. :type name: str, optional :returns: A logger instance that can be used to log messages. :rtype: logging.Logger .. rubric:: Example >>> logger = get_logger("data_manager") >>> logger.info("Loading data...") >>> logger.warning("Parameter validation issue detected") .. note:: By default, if no configuration has been done, Python's logging will only show WARNING level and above. Call configure_logging() to see INFO and DEBUG.