Skip to main content

🌾 Crop_lca, a lifecycle assessment tool for cropping systems in Ireland

license python Code style: black

Based on the GOBLIN (General Overview for a Backcasting approach of Livestock INtensification) LifeCycle Analysis tool, the Crop_lca module decouples this module making it an independent distribution package.

The package is shipped with key data for emissions factors, fertiliser inputs, crop characteristics 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:

-   crop_residue_direct
-   N_direct_fertiliser
-   N_indirect_fertiliser
-   soils_CO2

Structure

The package is structured for use in national and catchment level analysis.

The geo_crop_lca sub module is intended for use at the catchment level and interfaces with the catchment_data_api to retrieve catchment specific crop areas and types data that has been retrieved from Ireland's National Land Cover map and merged with crop types using the LUCAS land cover dataset.

   src/
   │
   ├── crop_lca/
       └── ... (other modules and sub-packages)
       │
       ├── geo_crop_lca/
       |   └── ... (other modules and sub-packages)

Installation

Install from git hub.

pip install "crop_lca@git+https://github.com/GOBLIN-Proj/crop_lca.git@main" 

Install from PyPI

pip install crop_lca

Usage

import pandas as pd
from crop_lca.models import load_crop_farm_data
from crop_lca.lca import ClimateChangeTotals
from crop_lca.national_crop_production import NationalCropData


def main():
    # Instantiate ClimateChange Totals Class, passing Ireland as the emissions factor country
    climatechange = ClimateChangeTotals("ireland")

    # Create a dictionary to store results
    index = 2020
    crop_emissions_dict = climatechange.create_emissions_dictionary([index])

    # Create some data to generate results
    data = NationalCropData.gen_national_crop_production_dataframe(index)
    
    data_frame = pd.DataFrame(data)

    #proportion of fertiliser inputs that is urea
    urea_proportion =0.2
    urea_abated_proportion = 0
    # generate results and store them in the dictionary

    data = load_crop_farm_data(data_frame)

    crop_emissions_dict["crop_residue_direct"][index] += (
        climatechange.total_residue_per_crop_direct(
            data[index],
        )
    )
    crop_emissions_dict["N_direct_fertiliser"][index] += (
        climatechange.total_fertiliser_direct(
            data[index],
            urea_proportion,
            urea_abated_proportion,
        )
        
    )
    crop_emissions_dict["N_indirect_fertiliser"][index] += (
        climatechange.total_fertiliser_indirect(
            data[index],
            urea_proportion,
            urea_abated_proportion,
        )
    )
    crop_emissions_dict["soils_N2O"][index] += (
        crop_emissions_dict["crop_residue_direct"][index]
        + crop_emissions_dict["N_direct_fertiliser"][index]
        + crop_emissions_dict["N_indirect_fertiliser"][index]
    )
    crop_emissions_dict["soils_CO2"][index] += (
        climatechange.urea_co2(
            data[index],
            urea_proportion,
            urea_abated_proportion,
        )
        
    )

    print(crop_emissions_dict)


if __name__ == "__main__":
    main()

License

This project is licensed under the terms of the MIT license.

Metadata

Release files for crop_lca 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crop_lca 0.2.2
File Size Uploaded
crop_lca-0.2.2.tar.gz 179.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for crop_lca 0.2.2
File Interpreter ABI Platform
crop_lca-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 360.6 kB

Release files / crop_lca-0.2.2.tar.gz

Download URL crop_lca-0.2.2.tar.gz
Size 179.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a40821e725f7d289e73a62050618e3c2cff112ddd1ba0fe48f06894f84349583
BLAKE2b-256 checksum
How to use checksums
fc91d8bad30a6dd51b31f71d9be3097061a404b9dbdd93e3da6a6fd97292f4bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.10.0 Linux/5.15.0-106-generic

Release files / crop_lca-0.2.2-py3-none-any.whl

Download URL crop_lca-0.2.2-py3-none-any.whl
Size 181.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
09e8e570fdb142e0f72a6ddbfa96ee4aba369f66ffc994c6909af621573cdd2c
BLAKE2b-256 checksum
How to use checksums
3087a39380b3a76fba530ec19ba7951a51518e5d3ce35ace4f35d41952db7632
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.10.0 Linux/5.15.0-106-generic

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page