goblin_lite.data_processing.animal_data_generation

This module contains the AnimalDataGenerator class, which is responsible for generating animal data and livestock outputs for a specified scenario. The class leverages the AnimalData and Exports classes to calculate animal data and livestock outputs based on scenario-specific and baseline animal data.

Module Contents

Classes

AnimalDataGenerator

A class to generate animal data and livestock outputs for a specified scenario.

class goblin_lite.data_processing.animal_data_generation.AnimalDataGenerator(ef_country, calibration_year, target_year, scenario_input_dataframe)[source]

A class to generate animal data and livestock outputs for a specified scenario.

This class is responsible for generating animal data and livestock outputs for a specified scenario. It leverages the AnimalData and Exports classes to calculate animal data and livestock outputs based on scenario-specific and baseline animal data.

ef_country

The country for which the livestock data is being generated.

Type:

str

calibration_year

The year used for calibration.

Type:

int

target_year

The target year for the scenario.

Type:

int

scenario_input_dataframe

A DataFrame containing scenario-specific input data required for livestock output calculations.

Type:

pandas.DataFrame

generate_animal_data()[source]

Generates animal data for a specified scenario.

generate_livestock_ouputs()[source]

Generates and returns a DataFrame of livestock outputs for the given scenario.

generate_animal_data()[source]

Generates animal data for baseline and scenarios.

Returns:

A tuple containing two pandas DataFrames: (baseline_animal_data, scenario_animal_data).

Return type:

tuple

generate_livestock_ouputs()[source]

Generates and returns a DataFrame of livestock outputs for the given scenario.

This method leverages the Exports class to calculate protein and milk production based on scenario-specific and baseline animal data. It produces a summary DataFrame combining milk production data and beef (carcass) weight from protein production data.

Returns:

A DataFrame, named protein_and_milk_summary, combining milk production data and beef carcass weight, indexed by ‘Scenarios’.

Return type:

pandas.DataFrame

Notes

The method performs the following steps: 1. Initializes an instance of the Exports class with country-specific parameters, calibration year, target year, and scenario inputs. 2. Computes protein production data using compute_system_protien_exports of the Exports class, which includes carcass weight information. 3. Computes milk production data using compute_system_milk_exports of the Exports class. 4. Creates the protein_and_milk_summary DataFrame by copying milk production data and appending the beef carcass weight from the protein production data. 5. Sets ‘Scenarios’ as the index of the protein_and_milk_summary DataFrame.

The generated protein_and_milk_summary DataFrame provides a comprehensive overview of the livestock outputs, including milk production and beef carcass weight, for both scenario-specific and baseline data comparisons.

The attributes and methods referenced in this documentation are class attributes and methods and should be available within the class instance when this method is called.