Skip to contents

This function calculates the primary energy supply shares of each product within each fossil fuel group. By default, it uses flows in the "V" matrix and selects only primary energy products for each fossil fuel group, which are "All fossil fuels", "Oil and gas products", and "Coal products". Oil products and natural gas are not differentiated at this point because their primary extraction is not differentiated in IEA data.

Usage

calc_share_primary_ff_supply_by_product_by_group(
  .tidy_iea_df,
  primary_production_mats = c(IEATools::psut_cols$V),
  list_primary_oil_products = IEATools::primary_oil_products,
  list_primary_coal_products = IEATools::primary_coal_products,
  list_primary_gas_products = IEATools::primary_gas_products,
  product.group = "Product.Group",
  total_product_supply = "Total_Product_Supply",
  total_group_supply = "Total_Group_Supply",
  share = "Share",
  energy.stage = "Energy.stage",
  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,
  unit = IEATools::iea_cols$unit,
  product = IEATools::iea_cols$product,
  product_without_origin = "product_without_origin"
)

Arguments

.tidy_iea_df

The tidy iea data frame for which the supply shares of each product within each fossil fuel group need to be calculated.

primary_production_mats

A list containing the names of matrices containing primary production flows. Default is c(IEATools::psut_cols$V).

list_primary_oil_products

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

list_primary_coal_products

A list containing the names of primary coal products. Default is IEATools::primary_coal_products,.

list_primary_gas_products

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

product.group

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

total_product_supply

Column name containing total primary energy supply by product. Default is "Total_Product_Supply".

total_group_supply

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

share

The name of the column returning the shares of each product use within each fossil fuel group. Default is "Share".

energy.stage

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

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

See IEATools::iea_cols.

product_without_origin

The name of the column containing the product name without the product origin. Default is "product_without_origin"

Value

A tidy data frame returning the primary energy supply shares of each product within each fossil fuel 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.

Examples

ECCTools::tidy_AB_data %>% 
   IEATools::add_psut_matnames() %>% 
   ECCTools::transform_to_dta() %>% 
   calc_share_primary_ff_supply_by_product_by_group()
#> # A tibble: 6 × 13
#> # Groups:   Country, Method, Energy.type, Last.stage, Year, Product.Group,
#> #   Energy.stage [3]
#>   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   Primary      ktoe 
#> 2 A       PCM    E           Final       2018 Oil and gas pr… Primary      ktoe 
#> 3 A       PCM    E           Final       2018 Oil and gas pr… Primary      ktoe 
#> 4 A       PCM    E           Final       2018 All fossil fue… Primary      ktoe 
#> 5 A       PCM    E           Final       2018 All fossil fue… Primary      ktoe 
#> 6 A       PCM    E           Final       2018 All fossil fue… Primary      ktoe 
#> # ℹ 5 more variables: Total_Group_Supply <dbl>, Product <chr>,
#> #   product_without_origin <chr>, Total_Product_Supply <dbl>, Share <dbl>