Skip to content

Commit

Permalink
Convert factors from basic to producer price
Browse files Browse the repository at this point in the history
  • Loading branch information
bl-young committed Sep 13, 2023
1 parent 8bee3db commit dc63fd2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion R/LoadExternalImportFactors.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ loadExternalImportFactors <- function(model, configpaths = NULL) {
# Format IFTable to match model$M
IFTable['Flow'] <- paste(IFTable$Flowable, IFTable$Context, IFTable$Unit, sep = "/")

#TODO: Convert from basic to producer price using TAU if possible
# Convert from basic to producer price using TAU of CurrencyYear
Tau <- model$Tau[, as.character(meta$CurrencyYear)]
names(Tau) <- gsub("/.*","",names(Tau))
IFTable <- merge(IFTable, as.data.frame(Tau), by.x = 'Sector', by.y = 0, all.y = FALSE)
IFTable['FlowAmount'] <- IFTable['FlowAmount'] / IFTable['Tau']
IFTable['PriceType'] <- 'Producer'
IFTable['CurrencyYear'] <- model$specs$IOYear

if(model$specs$IODataSource =="stateior") {
#TODO
Expand Down

2 comments on commit dc63fd2

@bl-young
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jvendries can you please check my implementation here for using Tau?

@jvendries
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commenting to confirm our discussion

Since
IF table is in kg CO2 (or other impact metric) / BAS price,

and

Tau is in BAS price / Prod price,

Then we need to multiply IF Table by Tau to get the values in kg CO2 / Prod prices in the updated table.

Please sign in to comment.