latlong_footprint {footprint} | R Documentation |
Calculate flight emissions based on longitude and latitude pairs
Description
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.
Usage
latlong_footprint(
departure_lat,
departure_long,
arrival_lat,
arrival_long,
flightClass = "Unknown",
output = "co2e",
year = 2019
)
Arguments
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. |
Details
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.
Value
a numeric value expressed in kilograms of chosen metric
Examples
# 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"))