diff --git a/R/LCIAfmtFunctions.R b/R/LCIAfmtFunctions.R index 2c4f8cbb..f04d0c5d 100644 --- a/R/LCIAfmtFunctions.R +++ b/R/LCIAfmtFunctions.R @@ -49,6 +49,9 @@ getImpactMethod <- function(ind_spec) { # Subset the method by indicator if(!is.null(indicators)){ imp_method <- imp_method[imp_method$Indicator %in% indicators, ] + if(nrow(imp_method)==0) { + logging::logwarn("Error selecting indicators from method") + } } return(imp_method) diff --git a/R/LoadSatellites.R b/R/LoadSatellites.R index 77a2956e..d060d9dc 100644 --- a/R/LoadSatellites.R +++ b/R/LoadSatellites.R @@ -114,10 +114,20 @@ generateTbSfromSatSpec <- function(sat_spec, model) { } } totals_by_sector <- do.call(eval(totalsgenfunction), list(params)) - } else { + } else if (sat_spec$FileLocation == "DataCommons") { f <- loadDataCommonsfile(sat_spec$StaticFile) totals_by_sector <- utils::read.table(f, sep = ",", header = TRUE, stringsAsFactors = FALSE, fileEncoding = 'UTF-8-BOM') + } else { + totals_by_sector <- utils::read.table(sat_spec$StaticFile, sep = ",", + header = TRUE, stringsAsFactors = FALSE, + fileEncoding = 'UTF-8-BOM') + } + # Ensure context is not NA + for (i in c('Context')) { + if (all(is.na(totals_by_sector[, i]))) { + totals_by_sector[ , i] <- "" + } } return(totals_by_sector) }