Algorithms for calculating methane and nitrous oxide emissions from manure management