goblin_lite.data_processing.grassland_data_generation
This module contains the GrasslandDataGenerator class, which is responsible for generating grassland data and farm outputs. The class leverages the GrasslandOutput class to calculate grassland data and farm outputs based on scenario-specific and baseline grassland data.
Module Contents
Classes
Manages the process of generating grassland data and related farm outputs. Leverages |
- class goblin_lite.data_processing.grassland_data_generation.GrasslandDataGenerator(goblin_data_manager, scenario_dataframe, scenario_animal_data, baseline_animal_data)[source]
Manages the process of generating grassland data and related farm outputs. Leverages the GrasslandOutput class to perform core calculations.
- goblin_data_manager_class
Instance of the GoblinDataManager class.
- Type:
object
- ef_country
Country code for emission factors.
- Type:
str
- calibration_year
Base year for model calibration.
- Type:
int
- target_year
Year of analysis.
- Type:
int
- scenario_dataframe
Dataframe containing scenario-specific grassland parameters.
- Type:
pandas.DataFrame
- scenario_animal_data
Dataframe containing animal data for the scenarios.
- Type:
pandas.DataFrame
- baseline_animal_data
Dataframe containing baseline animal data.
- Type:
pandas.DataFrame
- generate_farm_inputs()[source]
Generates farm input data (from the GrasslandOutput class) for both baseline and scenario conditions.
- generate_grassland_areas()[source]
Calculates total spared grassland, total grassland area, spared area per soil type, grassland stocking rate, and grass yield per hectare.
- generate_grassland_areas()[source]
Calculate the total spared and total grassland areas for each scenario.
This method calculates and returns the total spared, total grassland areas, spared area by soil group, stocking rate, and grass yield per hectare for each scenario based on the provided scenario_dataframe, scenario_animal_data, and baseline_animal_data attributes. The GrasslandOutput class is utilized to perform the necessary calculations for each scenario.
The total spared area represents the area of grassland that will be converted (destocked) to other land uses (e.g., wetland, forests) in the target year compared to the baseline year. The total grassland area represents the remaining grassland area. Spared area by soil group represents the spared area by soil group (e.g., class 1, 2 and 3). The stocking rate represents the stocking rate per hectare of grassland. The grass yield per hectare represents the yield of grass per hectare of grassland.
- Parameters:
scenario_dataframe (pandas.DataFrame) – A pandas DataFrame containing scenario parameters.
scenario_animal_data (pandas.DataFrame) – A pandas DataFrame containing animal data for different scenarios.
baseline_animal_data (pandas.DataFrame) – A pandas DataFrame containing baseline animal data.
- Returns:
A tuple containing five pandas DataFrame: (total_spared_area, total_grassland_area, total_spared_area_by_soil_group, per_hectare_stocking_rate, per_hectare_grass_yield).
- Return type:
tuple