Skip to main content

Tier 1 Environmental Impact Assessment tool for crops.

Project description

🌾 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crop_lca-0.2.1.tar.gz (179.3 kB view details)

Uploaded Source

Built Distribution

crop_lca-0.2.1-py3-none-any.whl (181.2 kB view details)

Uploaded Python 3

File details

Details for the file crop_lca-0.2.1.tar.gz.

File metadata

  • Download URL: crop_lca-0.2.1.tar.gz
  • Upload date:
  • Size: 179.3 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

Hashes for crop_lca-0.2.1.tar.gz
Algorithm Hash digest
SHA256 a497ea4d158c3204ad292c5d312bbfe7ed00e5fbed316e5b682293655c1c65f9
MD5 134537419d7a63374baab08c5266c3c0
BLAKE2b-256 89c5b98595c2c231e76f4528fac3ee94e757fad555eedc12623eb81a4dd13baa

See more details on using hashes here.

File details

Details for the file crop_lca-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: crop_lca-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 181.2 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

Hashes for crop_lca-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fa5f9b63eede860e3cfd99e2eb3bc3c3d5d5c7fb2fe5ff90368f6ef078798583
MD5 55ba7535bdb44fe7e4f27d5d5b9823d6
BLAKE2b-256 b8beeae049e6b20579eee4729cdfa44374225a24681b56bef6f89a1e15122444

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page