Title: | Calculate Air Travel Emissions |
---|---|
Description: | A handy tool to calculate carbon footprints from air travel based on three-letter International Air Transport Association (IATA) airport codes or latitude and longitude. footprint first calculates the great-circle distance between departure and arrival destinations. It then uses the Department of Environment, Food & Rural Affairs (DEFRA) greenhouse gas conversion factors for business air travel to estimate the carbon footprint. These conversion factors consider trip length, flight class (e.g. economy, business), and emissions metric (e.g. carbon dioxide equivalent, methane). |
Authors: | Anthony Schmidt [aut, cre] , Kasia Kulma [aut] |
Maintainer: | Anthony Schmidt <[email protected]> |
License: | CC0 |
Version: | 0.2 |
Built: | 2024-10-29 05:02:42 UTC |
Source: | https://github.com/acircleda/footprint |
A function that calculates emissions per flight based on pairs of three-letter airport codes, flight classes, and emissions metrics. Emissions are returned in kilograms of the chosen metric.
airport_footprint( departure, arrival, flightClass = "Unknown", output = "co2e", year = 2019 )
airport_footprint( departure, arrival, flightClass = "Unknown", output = "co2e", year = 2019 )
departure |
a character vector naming one or more three-letter IATA (International Air Transport Association) airport codes for outbound destination |
arrival |
a character vector naming one or more three-letter IATA (International Air Transport Association) airport codes for inbound destination |
flightClass |
a character vector naming one or more flight class categories. Must be of the following "Unknown" "Economy", "Economy+", "Business" or "First". If no argument is included, "Unknown" is the default and represents the average passenger. |
output |
a single character argument naming the emissions metric of the output. For metrics that include radiative forcing, one of
|
year |
A numeric or string representing a year between 2019-2024, inclusive. Default is 2019. |
Distances between airports are based on the Haversine great-circle distane formula, which assumes a spherical earth. They are calculated using the airportr
package. The carbon footprint estimates are derived from the Department for Environment, Food & Rural Affairs (UK) Greenhouse Gas Conversion Factors for Business Travel (air). These factors vary by year, which can be acounted for by the year
argument.
a numeric value expressed in kilograms of chosen metric
# Calculations based on individual flights airport_footprint("LAX", "LHR") airport_footprint("LAX", "LHR", "First") airport_footprint("LAX", "LHR", "First", "ch4") airport_footprint("LAX", "LHR", output = "ch4") # Calculations based on a data frame of flights library(dplyr) library(tibble) travel_data <- tribble(~name, ~from, ~to, ~class, "Mike", "LAX", "PUS", "Economy", "Will", "LGA", "LHR", "Economy+", "Elle", "TYS", "TPA", "Business") travel_data |> rowwise() |> mutate(emissions = airport_footprint(from, to, flightClass = class, output="co2e"))
# Calculations based on individual flights airport_footprint("LAX", "LHR") airport_footprint("LAX", "LHR", "First") airport_footprint("LAX", "LHR", "First", "ch4") airport_footprint("LAX", "LHR", output = "ch4") # Calculations based on a data frame of flights library(dplyr) library(tibble) travel_data <- tribble(~name, ~from, ~to, ~class, "Mike", "LAX", "PUS", "Economy", "Will", "LGA", "LHR", "Economy+", "Elle", "TYS", "TPA", "Business") travel_data |> rowwise() |> mutate(emissions = airport_footprint(from, to, flightClass = class, output="co2e"))
A function that calculates emissions per flight based on longitude and latitude, flight classes, and emissions metrics. Emissions are returned in kilograms of the chosen metric.
latlong_footprint( departure_lat, departure_long, arrival_lat, arrival_long, flightClass = "Unknown", output = "co2e", year = 2019 )
latlong_footprint( departure_lat, departure_long, arrival_lat, arrival_long, flightClass = "Unknown", output = "co2e", year = 2019 )
departure_lat |
a numeric vector of one or more latitudes for departure location |
departure_long |
a numeric vector of one or more longitudes for outbound location |
arrival_lat |
a numeric vector of one or more latitudes for arrival location |
arrival_long |
a numeric vector of one or more longitudes for arrival location |
flightClass |
a character vector naming one or more flight class categories. Must be of the following "Unknown" "Economy", "Economy+", "Business" or "First". If no argument is included, "Unknown" is the default and represents the average passenger. |
output |
character emissions metric of the output. For metrics that include radiative forcing, one of
|
year |
A numeric or string representing a year between 2019-2024, inclusive. Default is 2019. |
Distances between latitude and longitude pairs are based on the Haversine great-circle distance formula, which assumes a spherical earth. The carbon footprint estimates are derived from the Department for Environment, Food & Rural Affairs (UK) Greenhouse Gas Conversion Factors for Business Travel (air). These factors vary by year, which can be acounted for by the year
argument.
a numeric value expressed in kilograms of chosen metric
# Calculations based on individual flights latlong_footprint(34.052235, -118.243683, 35.179554, 129.075638) latlong_footprint(34.052235, -118.243683, 35.179554, 129.075638, "First") latlong_footprint(34.052235, -118.243683, 35.179554, 129.075638, "First", "ch4") latlong_footprint(34.052235, -118.243683, 35.179554, 129.075638, output = "ch4") # Calculations based on a data frame of flight library(dplyr) library(tibble) travel_data <- tribble(~name, ~departure_lat, ~departure_long, ~arrival_lat, ~arrival_long, # Los Angeles -> Busan "Mike", 34.052235, -118.243683, 35.179554, 129.075638, # New York -> London "Will", 40.712776, -74.005974, 51.52, -0.10) travel_data |> rowwise() |> mutate(emissions = latlong_footprint(departure_lat, departure_long, arrival_lat, arrival_long, output="co2e"))
# Calculations based on individual flights latlong_footprint(34.052235, -118.243683, 35.179554, 129.075638) latlong_footprint(34.052235, -118.243683, 35.179554, 129.075638, "First") latlong_footprint(34.052235, -118.243683, 35.179554, 129.075638, "First", "ch4") latlong_footprint(34.052235, -118.243683, 35.179554, 129.075638, output = "ch4") # Calculations based on a data frame of flight library(dplyr) library(tibble) travel_data <- tribble(~name, ~departure_lat, ~departure_long, ~arrival_lat, ~arrival_long, # Los Angeles -> Busan "Mike", 34.052235, -118.243683, 35.179554, 129.075638, # New York -> London "Will", 40.712776, -74.005974, 51.52, -0.10) travel_data |> rowwise() |> mutate(emissions = latlong_footprint(departure_lat, departure_long, arrival_lat, arrival_long, output="co2e"))