Tier 2 Environmental Impact Assessment tool for sheep livestock.
Project description
🐏 Sheep_lca, a lifecycle assessment tool for sheep livestock systems
Based on the GOBLIN (General Overview for a Backcasting approach of Livestock INtensification) LifeCycle Analysis tool, the Sheep_lca module decouples this module making it an independent distribution package.
The package is shipped with key data for emissions factors, concentrate feed inputs, animal features, grassland parameters and upstream emissions.
Currently parameterised for Ireland, but the database can be updated with additional emissions factor contexts, which are selected able with an emissions factor key.
Final results are output as a dictionary object capturing emissions for:
- enteric_ch4
- manure_management_N2O
- manure_management_CH4
- manure_applied_N
- N_direct_PRP
- N_direct_PRP
- N_indirect_PRP
- N_direct_fertiliser
- N_indirect_fertiliser
- soils_CO2
- soil_organic_N_direct
- soil_organic_N_indirect
- soil_inorganic_N_direct
- soil_inorganic_N_indirect
- soil_histosol_N_direct
- crop_residues_N_direct
- soil_N_direct
- soil_N_indirect
- soils_N2O
Note, that the soil_histosol_N_direct and crop_residues_N_direct category will be 0. Estimation of the soils N2O direct emissions from histosols uses requires the land use data. Emissions can be included using the landcover_lca module and the crop_lca module.
Installation
Install from git hub.
pip install "sheep_lca@git+https://github.com/GOBLIN-Proj/sheep_lca.git@main"
Install from PyPI
pip install sheep_lca
Usage
import pandas as pd
from sheep_lca.resource_manager.models import load_livestock_data, load_farm_data
from sheep_lca.lca import ClimateChangeTotals
def main():
# Instantiate ClimateChange Totals Class, passing Ireland as the emissions factor country
climatechange = ClimateChangeTotals("ireland")
# Create a dictionary to store results
index = -1
emissions_dict = climatechange.create_emissions_dictionary([index])
# Create some data to generate results
livestock_data = {
'ef_country': ['ireland', 'ireland', 'ireland', 'ireland', 'ireland', 'ireland', 'ireland', 'ireland', 'ireland', 'ireland'],
'farm_id': [2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018],
'year': [2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018],
'cohort': ['ewes', 'ewes', 'ram', 'ram', 'lamb_more_1_yr', 'lamb_more_1_yr', 'lamb_less_1_yr', 'lamb_less_1_yr', 'male_less_1_yr', 'male_less_1_yr'],
'pop': [37812.8, 9453.199999, 1146.402738, 295.9906066, 2237.334377, 554.9823874, 17417.92548, 4365.861448, 10891.89346, 7628.877455],
'weight': [68, 68, 86, 86, 68, 68, 33, 33, 33, 33],
'daily_milk': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
'forage': ['average', 'average', 'average', 'average', 'average', 'average', 'average', 'average', 'average', 'average'],
'grazing': ['flat_pasture', 'hilly_pasture', 'flat_pasture', 'hilly_pasture', 'flat_pasture', 'hilly_pasture', 'flat_pasture', 'hilly_pasture', 'flat_pasture', 'hilly_pasture'],
'con_type': ['concentrate', 'concentrate', 'concentrate', 'concentrate', 'concentrate', 'concentrate', 'concentrate', 'concentrate', 'concentrate', 'concentrate'],
'con_amount': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
't_outdoors': [21.36, 21.36, 21.36, 21.36, 21.36, 21.36, 21.36, 21.36, 21.36, 21.36],
't_indoors': [2.64, 2.64, 2.64, 2.64, 2.64, 2.64, 2.64, 2.64, 2.64, 2.64],
'wool': [4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5],
't_stabled': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
'mm_storage': ['solid', 'solid', 'solid', 'solid', 'solid', 'solid', 'solid', 'solid', 'solid', 'solid'],
'daily_spreading': ['broadcast', 'broadcast', 'broadcast', 'broadcast', 'broadcast', 'broadcast', 'broadcast', 'broadcast', 'broadcast', 'broadcast'],
'n_sold': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
'n_bought': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
}
livestock_data_frame = pd.DataFrame(livestock_data)
farm_data = {
'ef_country': ['ireland'],
'farm_id': [2018],
'year': [2018],
'total_urea_kg': [2072487.127],
'total_lime_kg': [2072487.127],
'an_n_fert': [2072487.127],
'urea_n_fert': [2072487],
'total_urea_abated': [17310655.18],
'total_p_fert': [1615261.859],
'total_k_fert': [3922778.8],
'diesel_kg': [0],
'elec_kwh': [0]
}
farm_dataframe = pd.DataFrame(farm_data)
# load the dataframes
animals = load_livestock_data(livestock_data_frame)
farms = load_farm_data(farm_dataframe)
animals_loc = list(animals.keys())[0]
farm_loc = list(farms.keys())[0]
# generate results and store them in the dictionary
emissions_dict["enteric_ch4"][index] += climatechange.CH4_enteric_ch4(
animals[animals_loc]["animals"]
)
emissions_dict["manure_management_N2O"][index] += climatechange.Total_storage_N2O(
animals[animals_loc]["animals"]
)
emissions_dict["manure_management_CH4"][
index
] += climatechange.CH4_manure_management(animals[animals_loc]["animals"])
emissions_dict["manure_applied_N"][index] += 0
emissions_dict["N_direct_PRP"][index] += climatechange.N2O_total_PRP_N2O_direct(
animals[animals_loc]["animals"]
)
emissions_dict["N_indirect_PRP"][index] += climatechange.N2O_total_PRP_N2O_indirect(
animals[animals_loc]["animals"]
)
emissions_dict["N_direct_fertiliser"][index] = climatechange.N2O_direct_fertiliser(
farms[farm_loc].urea_n_fert,
farms[farm_loc].total_urea_abated,
farms[farm_loc].an_n_fert,
)
emissions_dict["N_indirect_fertiliser"][
index
] += climatechange.N2O_fertiliser_indirect(
farms[farm_loc].urea_n_fert,
farms[farm_loc].total_urea_abated,
farms[farm_loc].an_n_fert,
)
emissions_dict["soils_CO2"][index] += climatechange.CO2_soils_GWP(
farms[farm_loc].total_urea_kg,
farms[farm_loc].total_lime_kg,
)
# Add the totals
emissions_dict["soil_organic_N_direct"][index] = (
emissions_dict["manure_applied_N"][index]
+ emissions_dict["N_direct_PRP"][index]
)
emissions_dict["soil_organic_N_indirect"][index] = emissions_dict["N_indirect_PRP"][
index
]
emissions_dict["soil_inorganic_N_direct"][index] = emissions_dict[
"N_direct_fertiliser"
][index]
emissions_dict["soil_inorganic_N_indirect"][index] = emissions_dict[
"N_indirect_fertiliser"
][index]
emissions_dict["soil_N_direct"][index] = (
emissions_dict["soil_organic_N_direct"][index]
+ emissions_dict["soil_inorganic_N_direct"][index]
)
emissions_dict["soil_N_indirect"][index] = (
emissions_dict["soil_inorganic_N_indirect"][index]
+ emissions_dict["soil_organic_N_indirect"][index]
)
emissions_dict["soils_N2O"][index] = (
emissions_dict["soil_N_direct"][index]
+ emissions_dict["soil_N_indirect"][index]
)
# Print the emission results dictionary
print(emissions_dict)
if __name__ == "__main__":
main()
License
This project is licensed under the terms of the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sheep_lca-0.3.1.tar.gz
.
File metadata
- Download URL: sheep_lca-0.3.1.tar.gz
- Upload date:
- Size: 41.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.10.0 Linux/5.15.0-105-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e30c8f06c2a18dfb3136dd98a632ba33e9488231ac923393324ad6cf88977caa |
|
MD5 | 768c98e546482cc683f189eea7e231c8 |
|
BLAKE2b-256 | d0ed04614d212802380703ad9f06327128f51e5ef7158d1da7213a8c99a5d79c |
File details
Details for the file sheep_lca-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: sheep_lca-0.3.1-py3-none-any.whl
- Upload date:
- Size: 41.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.10.0 Linux/5.15.0-105-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 998f7426c84e65f9948b726350dad2364c93c437114e1e815e7dd0e221be3a8e |
|
MD5 | 5fc45320d54203f4bd59187999c01ae3 |
|
BLAKE2b-256 | 92106c3bf3879de5f5cb5a0bd95c6d35e6d0c6c7363450785328dfd57cbce937 |