#' module_emissions_batch_ssp2_emissions_factors_xml
#'
#' Construct XML data structure for \code{ssp2_emissions_factors.xml}.
#'
#' @param command API command to execute
#' @param ... other optional parameters, depending on command
#' @return Depends on \code{command}: either a vector of required inputs,
#' a vector of output names, or (if \code{command} is "MAKE") all
#' the generated outputs: \code{ssp2_emissions_factors.xml}. The corresponding file in the
#' original data system was \code{batch_ssp2_emissions_factors_xml.R} (emissions XML).
module_emissions_batch_ssp2_emissions_factors_xml <- function(command, ...) {
if(command == driver.DECLARE_INPUTS) {
return(c("L251.ssp2_ef",
"L251.ssp2_ef_vin"))
} else if(command == driver.DECLARE_OUTPUTS) {
return(c(XML = "ssp2_emissions_factors.xml"))
} else if(command == driver.MAKE) {
all_data <- list(...)[[1]]
# Load required inputs
L251.ssp2_ef <- get_data(all_data, "L251.ssp2_ef")
L251.ssp2_ef_vin <- get_data(all_data, "L251.ssp2_ef_vin")
# Silence package checks
emiss.coeff <- NULL
# ===================================================
# Rename L251.ssp2_ef column to match the expected column
# names in the add_xml_data header.
L251.ssp2_ef <- rename(L251.ssp2_ef, `emiss.coef` = `emiss.coeff`)
# Produce outputs
create_xml("ssp2_emissions_factors.xml") %>%
add_xml_data(L251.ssp2_ef, "InputEmissCoeff") %>%
add_xml_data(L251.ssp2_ef_vin, "ReadInControl") %>%
add_precursors("L251.ssp2_ef", "L251.ssp2_ef_vin") ->
ssp2_emissions_factors.xml
return_data(ssp2_emissions_factors.xml)
} else {
stop("Unknown command")
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.