prepare_preprocessed_data: Apply corrections to pre-processed data

View source: R/model-downscale.R

prepare_preprocessed_dataR Documentation

Apply corrections to pre-processed data

Description

Addresses errors and omissions in submitted model data loaded by load_preprocessed_data prior to performing any data processing. Where necessary, corrections are performed by calling model-specific functions. This function also performs a number of processing steps that are optional but default to true. These include: subsetting only quantity flow variables (the methods assume that the components to all indicator variables are reported as quantity flows, and can be re-computed post-hoc from various levels of regional aggregation), removing "All" categories when the consituent components are available (remove_redundant_alls), interpolating years where necessary for harmonized reporting years, dropping missing values (the alternative is setting them to zero), and aggregating redundant categories (as category re-assignment may cause multiple values with the same ID info).

Usage

prepare_preprocessed_data(
  model_data_list,
  derive_weighted_indicators = TRUE,
  subset_quantity_flows = TRUE,
  remove_redundant_alls = TRUE,
  interpolate_years = TRUE,
  drop_na_values = TRUE,
  aggregate_redundant_categories = TRUE,
  ...
)

Arguments

model_data_list

list of data frames with model-specific data

subset_quantity_flows

logical (default = TRUE) indicating whether to subset only quantity flow variables

remove_redundant_alls

logical (default = TRUE) indicating whether to remove observations with "All" that could be calculated instead by adding provided components. These "All" values should not be downscaled.

interpolate_years

logical (default = TRUE) indicating whether to interpolate years. If FALSE, no interpolation will be performed. If TRUE, iTEM analysis years that fall within the model's range of reported years will be linearly interpolated, as necessary.

drop_na_values

logical (default = TRUE) indicating whether to drop observations with no value in model- submitted data. If FALSE, missing values are set to zero.

aggregate_redundant_categories

logical (default = TRUE) indicating whether to add up categories that are redundant (i.e., all ID information the same), which generally result from re-setting variables from model- reported data to more aggregate categories.

Details

To apply model-specific functions, this function searches for a correction function containing each model name in the list (i.e., "correct_" + model name). This step is applied prior to all others. The interpolation function does not extrapolate, so the data from any model does not necessarily include all iTEM analysis years. In its present form, this function does not call additional functions to compute quantity flows from indicator variables, though such capacity may be added for an expanded variable set. For example, to process fuel prices, fuel expenditures would be calculated as reported prices times consumption.


transportenergy/item_mip_data_processing documentation built on July 6, 2023, 7:51 p.m.