Source code for hestia_earth.calculation.emissions.nh3ToAirCropResidueBurningAkagiEtAl2011AndIpcc2006

from hestia_earth.calculation.abstract_model import Model
from hestia_earth.utils.api import download_hestia
from hestia_earth.calculation.data.constants.nh3 import DRY_MATTER_FACTOR_TO_NH3
from hestia_earth.calculation.utils import summation

MODEL_KEY = 'nh3ToAirCropResidueBurningAkagiEtAl2011AndIpcc2006'


[docs]class NH3ToAirCropResidueBurningAkagiEtAl2011AndIpcc2006(Model): def __init__(self): # Define model tier self.tier = 1 self.term = download_hestia(MODEL_KEY) # Define model requirements self.dry_matter = None # Instantiate variables self.nh3ToAirCropResidueBurning = None def calculate_nh3ToAirCropResidueBurning(self): # Calculate total NH3 emissions self.nh3ToAirCropResidueBurning = self.dry_matter * DRY_MATTER_FACTOR_TO_NH3 return self.nh3ToAirCropResidueBurning def complete(self, completeness): self.dry_matter = 0 if self.dry_matter == {} and completeness['cropResidue'] else self.dry_matter def check_nh3ToAirCropResidueBurning(self, cycle): # Check that we have all the inputs self.dry_matter = summation(cycle['products']['aboveGroundCropResidueBurnt']['value']) self.complete(cycle['dataCompleteness']) return self.dry_matter != {}