Skip to contents

This function calculates the use of energy products by group for each fossil fuel group. The matrices containing energy use flows can be specified in the total_use_mats argument. By default, these matrices are U_EIOU and Y, and excludes energy flows used as feedstock. Exports and losses are also excluded from the total energy use. See details for more explanations.

Usage

calc_all_products_use_by_group(
  .tidy_iea_df,
  include_non_energy_uses = FALSE,
  final_use_mats = c(IEATools::psut_cols$Y, IEATools::psut_cols$U_eiou),
  list_oil_products = IEATools::oil_and_oil_products,
  list_coal_products = IEATools::coal_and_coal_products,
  list_gas_products = IEATools::primary_gas_products,
  list_non_energy_flows = IEATools::non_energy_flows,
  exports = IEATools::interface_industries$exports,
  losses = IEATools::tfc_compare_flows$losses,
  country = IEATools::iea_cols$country,
  method = IEATools::iea_cols$method,
  energy_type = IEATools::iea_cols$energy_type,
  last_stage = IEATools::iea_cols$last_stage,
  year = IEATools::iea_cols$year,
  product = IEATools::iea_cols$product,
  unit = IEATools::iea_cols$unit,
  flow = IEATools::iea_cols$flow,
  e_dot = IEATools::iea_cols$e_dot,
  matnames = IEATools::mat_meta_cols$matnames,
  product.group = "Product.Group",
  total_group_use = "Total_Group_Use",
  energy.stage = "Energy.stage",
  product_without_origin = "product_without_origin"
)

Arguments

.tidy_iea_df

The tidy iea data frame for which the use of energy products by group needs to be calculated.

include_non_energy_uses

A boolean indicating whether non-energy uses should be included in the calculation. Default is FALSE.

final_use_mats

A list describing from which matrices should total final energy uses be calculated. Default is c(IEATools::psut_cols$Y, IEATools::psut_cols$U_eiou).

list_oil_products

A list containing the names of oil products. Default is IEATools::oil_and_oil_products.

list_coal_products

A list containing the names of coal products. Default is IEATools::coal_and_coal_products.

list_gas_products

A list containing the names of gas products. Default is IEATools::primary_gas_products.

list_non_energy_flows

A list containing the names of non-energy flows in IEA data. Default is IEATools::non_energy_flows.

exports

A string identifying Exports flows. Default is IEATools::interface_industries$exports.

losses

A string identifying Losses flows. Default is IEATools::tfc_compare_flows$losses.

country, method, energy_type, last_stage, year, product, unit, flow, e_dot

See IEATools::iea_cols.

matnames

The column name of the column having matrices names. Default is IEATools::mat_meta_cols$matnames.

product.group

The column name of the column defining the fossil fuel group. Default is "Product.Group".

total_group_use

Column name containing total energy use by product group. Default is "Total_Group_Use".

energy.stage

The column name of the column defining the energy stage. Default is "Energy.stage".

product_without_origin

Column name containing the name of the product excluding the country of origin. Helpful for doing calculations with Global Market Assumption. Default is "product_without_origin".

Value

A tidy data frame indicating the final energy use for each product group.

Details

The function can work both on a single country Energy Conversion Chain of Domestic Technology Assumption type, or with a multi-regional Energy Conversion Chain for instance using the Global Market Assumption. The input data frame will have to be slightly adapted in this case. Non-energy use flows can be included or excluded from the calculations using the include_non_energy_uses boolean.

Examples

ECCTools::tidy_AB_data %>% 
   IEATools::add_psut_matnames() %>% 
   ECCTools::transform_to_dta() %>% 
   calc_all_products_use_by_group()
#> # A tibble: 5 × 9
#> # Groups:   Country, Method, Energy.type, Last.stage, Year, Product.Group,
#> #   Energy.stage [5]
#>   Country Method Energy.type Last.stage  Year Product.Group   Energy.stage Unit 
#>   <chr>   <chr>  <chr>       <chr>      <dbl> <chr>           <chr>        <chr>
#> 1 A       PCM    E           Final       2018 Coal products   Final (fuel) ktoe 
#> 2 A       PCM    E           Final       2018 Oil and gas pr… Final (fuel) ktoe 
#> 3 A       PCM    E           Final       2018 Natural gas     Final (fuel) ktoe 
#> 4 A       PCM    E           Final       2018 Oil products    Final (fuel) ktoe 
#> 5 A       PCM    E           Final       2018 All fossil fue… Final (fuel) ktoe 
#> # ℹ 1 more variable: Total_Group_Use <dbl>