Giter Site home page Giter Site logo

ghg_emissions's Introduction

Auto-CCAFS-MOT: a batch calculator tool for farmers GHG emissions

CCAFS

Introduction

The greenhouse gas (GHG) emissions measurement, produced by agricultural activities such as fertilizers, irrigation, tillage, among others, is important for quantifying the impact that this sector has on climate change. For that reason, several methodologies have been proposed to address a baseline measurement using data from farmers. The main purpose of this repository is to offer a tool that is able to estimate GHG emissions for multiple commercial cropping events. It is important to mention that this work is based on the Mitigation Option Tool for Agriculture project (CCAFS - MOT) developed by CCAFS and The Aberdeen University.

Requirements

  • Python Version >= 3.6
  • Libraries:
    pandas==1.1.0
    rasterio==1.1.8
    matplotlib==3.3.2
    numpy==1.19.1

Get started

The following example shows how to use this code for ghg emissions

Organice your Input

The input files must contain a certain amount of parameters for each cropping event (please check the example located in the data folder). There are two files, one refers to general information about the crop event, and the second one provides insights about the fertilizers used during the crop cycle.

The general information that is required for running the code is:

  • id_event: This is an unique identification code for each crop event.
  • longitude and latitude: these are the field spatial coordinates
  • crop: crop that was planted.
  • crop_yield_kg_ha: crop productivity

The fertilizer file must have the following variables:

  • id_event: This is an unique identification code for each crop event.
  • fertliser_product: fertilizer that was used during the crop cycle.
  • amount_kg_ha: how many kg/ha of fertiliser was added to the soil.

Moreover, there are other optional variables related to climate and soil. These insights can be provided by the users otherwise they are going to be inferred from secondary sources. for example, in the case of soil, we use the provided coordinates for extracting data from SoilGrid project. For climate, we use the Saire's climate region classification.

Additional variables are explained in each excel file.

Once both files are filled with the required inputs, you can start with the code.

from scripts import crop_ghg_emissions as ghg

ghg_data = ghg.ghg_emissions('data/inputs_mot_example.xlsx', ## file path to the general information 
                             'data/fertiliser_inputs_mot_example.xlsx', ## file path to the fertilizers information   
                             id_event= 'event_7' ## you can ppoint out an specif crop event, or for run through the all events don't put this paremeter)

Visualization

A bar blot is used to show the CO2 eq . ha-1 for each emission sources.

plot_functions.bar_plot_emissions(
    ghg_data.emissions_summary, #  table summary obtained from previous step
    'mean' # function to aggregated all crop events)

Data downloading

Finally, you can download the summary table, which is a pandas dataframe type. Only one parameter must be provided, the file output path.

ghg_data.emissions_summary.to_csv("example.csv")

Examples

Please feel free to check the example file created in Colab.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.