A few months ago I began a project with my brother to create a calculator for the environmental footprint of food. It’s called FoodPact to merge food and ecological impact. It’s a work in progress and I’m excited to share the code for it.
Data sources to inform the calculator include:
- Water footprint data for crops from a 2011 study by M.M. Mekonnen and A. Y. Hoekstra.
- Greenhouse gas emissions data from Business for Social Responsibility (BSR) and Environmental Protection Agency (EPA) documents on transport via boat, rail, and freight.
- Food waste data from the United States Department of Agriculture (USDA) Economic Research Service (ERS)
- Global food import data from the USDA Foreign Agricultural Service’s Global Agricultural Trade System (GATS).
- Country centroid data from a President and Fellows of Harvard College 2015 data file.
- US city locations from SimpleMaps.
We used a Bootstrap Bootswatch for the web application’s layout and Flask as the microframework.
Python packages used in the program include:
- Pandas to create more refined dataframes for use within the application
- NumPy for equations
- geopy for calculating great circle distance between latitudes and longitudes
- Matplotlib and pyplot for creating graphs
The whole point of the program is to take a user’s location, food product, and the product’s country of origin to generate the estimated distance the food traveled, the approximate amount of carbon dioxide that travel generated, and the water requirements for the product.
Conversions include: cubic metric tons to gallons of water, tons of crops to pounds, and grams of carbon dioxide per kilometer to pounds per mile.
Selected graphics from FoodPact project:
One limitation of the calculator is that the values for carbon dioxide consider either full travel by ship, train, or truck and not a combination of the three methods. Emissions refer to the amount it takes to ship a twenty-foot equivalent (TEU) container full of the food product across the world. The country of origin considers the centroid and not the exact location of food production. Similarly, the list of cities displays the 5 most populated cities in that given state. The only exception is New York, for which I considered New York City close enough in latitude and longitude to account for Brooklyn, Queens, Manhattan, the Bronx, and Staten Island.
The data referenced in the calculator is meant to give a relative idea of the inputs required to generate and transport food products to give perspective to consumers. Ideally, the calculator will encourage conversations about the food system and inspire people to reduce their personal food waste.