Skip to content

Commit

Permalink
Merge pull request #272 from USEPA/ext_sat_tables
Browse files Browse the repository at this point in the history
Enable external satellite tables
  • Loading branch information
bl-young authored Jan 15, 2024
2 parents e47169d + f6ffca8 commit 1c154d8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions R/LCIAfmtFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 11 additions & 1 deletion R/LoadSatellites.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 1c154d8

Please sign in to comment.