title: "Release notes for IEATools
"
output: html_document
Cite all releases with doi 10.5281/zenodo.5086371, which always resolves to the latest release.
extend_to_useful_helper()
and extend_to_useful()
now return additional matrices, namely
Y_fu_details
and U_EIOU_fu_details
.
These new matrices provide detailed information about the
process of extending to the useful stage:
the final energy product,
the destination sector,
the useful energy product, and
the final-to-useful machine.fix_AUS_bfg()
fixes the Blast furnace gas data for Australia
for the 2010--2020 timeframe.nonenergy_use
is now aligned with IEA definitions for
Non-energy use products.
Specifically, now only
"Additives/blending components",
"Bitumen",
"Lubricants",
"Naphtha",
"Paraffin waxes",
"Refinery feedstocks", and
"White spirit & SBP"
are Non-energy use Products.
"Coal tar",
"Crude/NGL/feedstocks (if no detail)",
"Crude oil",
"Natural gas liquids",
"Oil shale and oil sands",
"Other hydrocarbons", and
"Other oil products"
were formerly included in the constant but have now been removed.etwmb
and etwab
)
in aggregate_regions()
.matrix.class
argument to matrix_class
.IEATools::fap_flows
to accommodate detailed "Non-energy use in xxxxx"
flows.IEATools::fd_sectors
now contains specific
"Non-energy use in <>" strings
to support the option to specify Non-energy use flows
when possible.notation
argument was not being set properly
in a call to RCLabels::get_pref_suff()
when extracting prefixes.specify_non_energy_flows
on load_tidy_iea_df()
enables specifying Non-energy use flows
via the new specify_non_energy_use()
function where possible.
For now, the default is FALSE
to maintain backward compatibility
(i.e., not specifying Non-energy use flows).specify_non_energy_use()
uses "Memo: Non-energy use in <>"
where possible.augment_iea_df()
now adds Flow.aggregation.point
s
for all aggregation flows that will (eventually) be removed.
This change will enable future specification
of "Non-energy use in xxxxx" flows
with "Memo: Non-energy use in xxxxx" where possible.Matrix
objects with
prep_psut()
, form_C_mats()
, form_eta_fu_phi_u_vecs()
,
extract_S_units_from_tidy()
, and collapse_to_tidy_psut()
.
This change enables sparse matrices to save memory and disk space.tidyselect
package about
deprecated functionality.
The package builds and tests cleanly again!add_psut_matnames()
(R_includes_all_exogenous_flows
)
switches between
(a) including all exogenous flows
("Resources", "Imports", "Statistical differences", and
"Stock changes") in the R
matrix (TRUE
) and
(b) placing only Resource flows
in the R matrix (FALSE
).
Default is TRUE
.eiou_flows
.
We route "Own use in electricity, CHP and heat plants" to
"Main activity producer electricity plants",
so we need to include "Main activity producer electricity plants" in the EIOU flows.
Same for "Natural gas extraction".non_energy_flows
to fd_sectors
to conform to IEA approach to calculating final energy.RCLabels
.
Now using "pref" and "suff" instead of "prefix" and "suffix"
in several places.slurp_iea_to_raw_df()
,
ensure_ascii_countries
,
which converts characters with diacritic marks to
straight ascii.
The default value is TRUE
.slurp_iea_to_raw_df()
.
This change enables country names like
"Cote d'Ivoire"
and
"Curacao/Netherlands Antilles"
to be read correctly from the data file.RCLabels
:
keep_pref_suff()
--> get_pref_suff()
,
among others.NA
and lead to a "Missing value where TRUE/FALSE needed" error.form_eta_fu_phi_u_vecs()
now gives only the product name
as the row name of the phi vectors, but
it does so only after checking that all phi values are the same.
If different phi values are detected for
the same combination of metadata parameters and year,
an error is emitted.
This change solves a downstream issue where
phi values from the phi_constants.xlsx
file
have only products as row names, leading to incompatibility
when summing phi vectors from the two sources and
when multiplying the phi vectors into matrices
where names of a dimension are product names only.form_eta_fu_phi_u_vecs()
now changes the name of the single column
of the exergy-to-energy ratio vector (phi_u
) from "phi.u" to simply "phi",
to become compatible with the phi_pf
vector, whose single column is named "phi".
This change fixes a downstream bug in the SEAPSUTWorkflow
package.load_phi_constants_table()
sample_phi_constants_path()
Flow.aggregation.point
,
Flow
, or Product
are encountered in arrange_iea_fu_allocation_template()
.fap_flows
constant.
These entries enable generation of templates for
"World marine bunkers" and "World aviation bunkers".load_tidy_iea_df()
has new arguments which are passed to use_iso_coutries()
,
thereby exposing the new functionality of use_iso_coutries()
to load_tidy_iea_df()
.use_iso_countries()
:
can supply a data frame of ISO 3-letter codes
in argument override_df
.extend_to_useful()
.ECCTools
.NULL
, but NULL
was not detected.extend_to_useful()
now robust to cases where there is no EIOU,
thanks to now using matsindf::matsindf_apply()
.matsindf::matsindf_apply()
for extend_to_useful()
.
This change will enable better handling of cases where
a country has no EIOU.
The first use case will be bunkers.extend_to_useful_helper()
,
because some vectors may be the 0
vector and be eliminated.replace_null_UR()
function to the workflow in the prep_psut()
function.replace_null_UR()
replaces missing or NULL
R
, U_feed
, U_EIOU
, U
, and r_EIOU
with 0 matrices with appropriate row and column names.
The replacements are built from Y and V matrices.
The need for this functionality arises when
the last stage is final energy
and imports (V matrix)
are the only source of an energy carrier that
is consumed in final demand (Y matrix).
In that situation, the R and U matrices
will be missing,
and they can be replaced by 0 matrices with the right dimensions.Flow
for countries World_X_bunkers
are now
specified to be "International navigation" and "International aviation"
to correspond with their "Domestic" equivalents.split_oil_gas_extraction_eiou()
function splits the EIOU of
the "Oil and gas extraction" industry into EIOU for the
"Oil extraction" and for the "Natural gas extraction" activities.inst/extdata
.specify_primary_production()
updated so that all products coming from Resources
are now called Product [from Resources]. Then, for each product,
a manufacturing industry takes these Product [from Resources] as inputs
and transforms them into actual Products.industry_net_flows
, transport_domestic_flows
, fd_sectors
, eiou_flows
, and prim_agg_flows
coal_and_coal_products
constant.specify_all()
function coded, so that it now splits non-specified
industries, splits the IEA "Own use in electricity, CHP and heat plants"
flow in main activity producer electricity, heat, and CHP plants, and so that
a nuclear industry is added when needed.specify_all()
function
are called within the specify_tp_eiou()
function.gather_producer_autoproducer()
,
the route_pumped_storage()
, the route_own_use_elect_chp_heat()
,
the add_nuclear_industry()
, and the route_non_specified_flows()
functions.
*specify_primary_production()
function changed, the product
naming is now modified.extract_S_units_from_tidy()
function hotfixed so that
it also works when the .tidy_iea_df
data frame already
has a matnames
column.calc_tidy_iea_df_balances
function updated
so that it also accounts for balancing flows
when checking balances.aggregate_regions()
hotfixed.Flow
s
for footprinting analyses (and maybe other work in the future).matnames
is present in .tidy_iea_df
,
add_psut_matnames()
now returns .tidy_iea_df
unmodified.
This new feature enables other functions for assigning matrix names.rownames
, colnames
, rowtypes
, and coltypes
are present in .tidy_iea_df
,
add_row_col_meta()
now returns .tidy_iea_df
unmodified.
This new feature enables other functions for assigning row and column names
and row and column types.aggregate_regions()
hotfixed.primary_aggregates_IEA()
and finaldemand_aggregates_IEA()
from the Recca
package to IEATools
.
Functions renamed to remove the _IEA
suffix.
Hosting the functions in Recca
must have made sense at some point.
But now it is clear these functions should be in IEATools
,
because they aggregate IEA-style tidy data frames.extend_to_useful()
now creates r_EIOU
matricesprep_psut()
now creates r_EIOU
matricesfinal_to_useful()
.extend_to_useful_helper()
to get around a bug that occurs when a 1x1 matrix is column summed.extend_to_useful()
now assumes that
columns C_Y
, C_eiou
, and eta_fu
are present in the incoming .sutdata
data frame.
This change makes the API of extend_to_useful()
more consistent with
the APIs of other functions in the package.form_eta_fu_phi_u_vecs()
exposed by new code.form_eta_fu_phi_u_vecs()
now accepts tidy data frames on input.
This change allows better integration with the SEAPSUTWorkflow
package.form_C_mats()
now accepts tidy data frames on input.
This change allows better integration with the SEAPSUTWorkflow
package.prep_psut()
now returns a column for the U
matrix
in addition to U_feed
and U_EIOU
columns.aggregate_regions()
function that enables regional aggregation
of a .tidy_iea_df
based on a user-defined aggregation table.read_aggregation_region_table()
and
default_aggregation_region_table_path()
enables aggregate_regions()
.eta_fu_table
in complete_eta_fu_table()
.specify_primary_production()
.
In fact, we need to specify all cases,
not only if energy industry own use is present.
This change solves a bug in a drake
workflow.U_excl_EIOU
to U_feed
everywhere.fix_tidy_iea_df_balances()
now deals correctly with a no-row IEA data frame..err
column
in fix_tidy_iea_df_balances.eta_fu_template()
now accepts tidy data frames.check_fu_allocation_data()
verifies that all Ef.product
and Eu.product
entries are identical when Machine
is Non-energy
..tol
on allocation sums bumped from 1e-10
to 1e-9
, because some
errors are 3e-10
.C_source
column,
which caused a problem when checking for completion of a final-to-useful efficiency table. which_quantity
argument to complete_eta_fu_table()
now checked for validity.tidy_eta_fu_table()
does what the name suggests.
This function (and previous new function tidy_fu_allocation_table()
)
enable elimination of duplicated code in several places.extract_S_units_from_tidy()
now correctly sets rowtype by default.
rowtype was Unit
, but it should have been Product
.tidy_fu_allocation_table()
makes an FU allocation table tidy if it is not.year_cols()
now returns the "Year" column, if it exists.meta_cols()
gives metadata columns in any IEA data frame.complete_fu_allocation_table()
and complete_eta_fu_table()
to use
fu_allocation_table_completed()
and eta_fu_table_completed()
.eta_fu_table_completed()
tells when an FU Efficiency table is complete.fu_allocation_table_completed()
that tells when an FU Allocation table is complete.switch-notation
documentation.IEATools::fu_analysis_file_info
.IEATools::aggregation_regions
,
because these regions are not aggregations.remove_agg_regions()
that removes known aggregation regions from an IEA extended energy balances data frame.complete_fu_allocation_table()
and complete_eta_fu_table()
.eta_fu_template()
,
any Machine whose name begins with "Non-energy use"
is now given default efficiency (eta.fu) of 0.0001% (i.e., 1e-6) and
phi of 1.0.use_iso_countries()
.
The problem is that the countrycode
package uses a different name from
the IEA extended energy balance database.
For now, I have coded
"China (P.R. of China and Hong Kong, China)" as "CHN".
Another option would be to code it as "CHNHKG".IEATools::eta_fu_template()
.
The eu_product
ke
was not being subtracted, leaving
duplicate "KE" products in eu_product_sort_order
.despecify_col()
.
resources
and production
were not correctly using the tpes_flows
object.extend_to_useful()
.
Importantly, an energy balance check is now performed
at the end of extend_to_useful()
, and
a warning is emitted if the energy balance check fails.extend_to_useful()
and supporting functions
form_C_mats()
and form_eta_fu_phi_u_vecs()
.
These functions use a matrix method to move from last stage of final energy
to last stage of useful energy.n_allocation_rows
argument
to fu_allocation_template()
.switch_notation_byname()
, arrow_to_paren_byname()
, and paren_to_arrow_byname()
.
These functions are like *_byname
functions in the package
matsbyname
: they accept both single matrices and lists of matrices.
In that way, they are amenable to pipeline calculations using the
matsindf
package.
Adding this feature exposed bugs in matsbyname::setrownames_byname()
and
matsbyname::setcolnames_byname()
.
The bugs in matsbyname
have been fixed, so these features are now working.paren_to_arrow()
, arrow_to_paren()
, and switch_notation()
.form_eta_fu_phi_u_vecs()
which
creates column vectors of final-to-useful efficiencies (eta_fu)
and exergy-to-energy ratios (phi_u)
from an efficiency table.form_C_mats()
which makes a data frame of C matrices
(a.k.a. final-to-useful allocation matrices) and metadata
from an FU Allocation table.industry_flows
non_specified_flows
transformation_processes
row_col_types
psut_cols
mat_meta_cols
extract_TK()
now accepts strings
formulated for "cooling" in addition to "heating."
Thus, "LTC.15.C" is now accepted and parses correctly.iea_file_OK()
now works on the 2018 IEA extended energy balance data.sort_iea_df()
now works for specified IEA data frames.
Internally, sort_iea_df()
now uses despecify_col()
.despecify_col()
removes specification decoration from a column.specify_notation
).
These constants are referred throughout the package.$
referencing of specific list items.fix_iea_data
vignette. See Fixes for IEA Data.fix_*
functions, including
the internal do_fix()
function which will work for fixing data from any country in any years,
so long as a replacement data frame is available.fix_GHA_industry_electricity()
which adds specificity to Ghana's industry electricity.replace_join()
to assist with IEA data fixes.iea_cols
object to simplify and standardize names for columns in IEA data frames,
both tidy and wide.sort_iea_df()
function.sort_tidy_iea_df()
--> sort_iea_df()
, because
the function also sorts wide data frames.sort_tidy_iea_df()
previously worked only with tidy data frames (with a column of years).
sort_tidy_iea_df()
now also works with wide data frames (with years spread to the right).sort_tidy_iea_df()
that results in NA
values in the Last.stage
column.sort_tidy_iea_df()
which sorts tidy IEA data frames
with default IEA row orders.fix_GHA_psb()
which
smooths Ghana's Primary solid biofuels data
in the years 1991--1999.IEATools
package develop branch
against which the latest version of the PFU-Database repository was built.
However, the argument name change needs to be on the master branch of IEATools
so that install_github()
gets the updated argument name.iea_file_OK()
.adjacent_rownums()
that identifies the row numbers where
two adjacent entries exist.
This function is used extensively when determining the
row ranges for "Transformation processes" and "Energy industry own use".sample_iea_data_path()
which takes a year (representing year of data release)
as an argument.
Default year is (now) 2019.
In subsequent years, I will change the default year to the most-recent year available.
2018 is also supported.
This function allows supporting and testing of previous years' data versions.iea_file_OK()
which tells whether all countries in an IEA extended energy balance table
have the same order for all rows.augment_iea_df()
now recognizes "Final consumption not elsewhere specified" as an "other" flow.
"Final consumption not elsewhere specified" (in the 2019 data) is a synonym for "Non-specified (other)"
(in 2018 and earlier editions of the IEA data).augment_iea_df()
now recognizes "Industry not elsewhere specified" as an industry flow.
"Industry not elsewhere specified" (in the 2019 data) is a synonym for "Non-specified (industry)"
(in 2018 and earlier editions of the IEA data).iea_df()
now removes white space, even from "FLOW" entries that are quoted
to protect commas.iea_df()
now reads files with a clean header line.fix_tidy_iea_df_balances()
,
where clarifying examples are now provided.iea_df()
now deletes columns that end with estimated_year
, whose default value is "E".
This feature allows us to process IEA data files with column names such as "2014E".codecov.yml
file to repository..travis.yml
file to repository.
Now, Travis builds the package automatically after each commit.
In addition, test coverage is calculated after each build.extract_TK()
.sort_by
argument for eta_fu_template()
allows "useful_energy_type" and "importance".
"useful_energy_type" sorts first by md
, light
, ke
, and heat
,
then by magnitude of energy flow into the machine.
"importance" sorts by magnitude of energy flow into the machine only.
Default is "useful_energy_type".fu_allocation_template()
function that makes templates for
deciding allocations to final-to-useful machines in
Final consumption or Energy industry own use.specify_tp_eiou()
now aggregates inputs and outputs separately
at the end of its specification process.
Doing so avoids a situation where resource extraction industries
would look like a Transformation process sink industry when
inputs and outputs were netted together.augment_iea_df()
now removes (energy)
, (transf.)
, and (transformation)
suffixes
from the Flow
column after adding the Flow.aggregation.point
column.prep_psut()
bundles several PSUT-related functions together.production_to_resources()
function to convert Production
to Resources (product)
.specify_primary_production()
function to fix primary production issues in the IEA data.coal_and_coal_products
, oil_and_oil_products
, renewable_products
, biofuels_and_waste_products
.IEAData
to IEATools
to better reflect its purpose.
Users can't get data from this package, anyway.
This package will do more than distribute data.
This package allows users to also manipulate data and extend to useful stage.Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.