Skip to content

Commit

Permalink
calculate Price|Carbon from pm_taxCO2eqSum
Browse files Browse the repository at this point in the history
  • Loading branch information
orichters committed Oct 18, 2023
1 parent 692e301 commit a4695a9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
7 changes: 1 addition & 6 deletions R/readPVP.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,7 @@ readPVP <- function(gdx, level="glo", enty="good"){
tmp1[regi,,] <- tmp
#getRegions(tmp1) <- sub("glob","GLO",getRegions(tmp1))
tmp <- tmp1
if(level=="reg" & enty=="perm"){
tmp <- readGDX(gdx, name = c("pm_pvpRegi","p80_pvpRegi"), format="first_found")[ , , enty]
}
}

# getNames(tmp) <- attr(tmp, "description") # this causes trouble due to ambiguous set definition

# getNames(tmp) <- attr(tmp, "description") # this causes trouble due to ambiguous set definition
return(tmp)
}
20 changes: 10 additions & 10 deletions R/reportPrices.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ reportPrices <- function(gdx, output=NULL, regionSubsetList=NULL,
if (is.null(bio_tax_factor)) bio_tax_factor <- readGDX(gdx,name="v21_tau_bio",field="l",format="first_found")[, t,]
pm_pvp <- readGDX(gdx,name=c("pm_pvp","p80_pvp"),format="first_found")[, t, p80_subset]
pm_dataemi <- readGDX(gdx,name=c("pm_emifac","pm_dataemi"),format="first_found",restore_zeros=FALSE)[,t, c("pegas.seel.ngt.co2","pecoal.seel.pc.co2")]
pm_pvpRegi <- readGDX(gdx,name='pm_pvpRegi',format="first_found")[, t, "perm"]
pm_taxCO2eq <- readGDX(gdx,name=c("pm_taxCO2eq","pm_tau_CO2_tax"),format="first_found")[, t,]
pm_taxCO2eqSum <- readGDX(gdx,name="pm_taxCO2eqSum",format="first_found")[, t,]
pm_taxCO2eqSCC <- readGDX(gdx,name='pm_taxCO2eqSCC',format="first_found")[, t,]
p21_CO2TaxSectorMarkup <- readGDX(gdx,name=c('p21_CO2TaxSectorMarkup','p21_CO2_tax_sector_markup'),format="first_found",react="silent")
if (dimExists("ttot", p21_CO2TaxSectorMarkup)) p21_CO2TaxSectorMarkup <- p21_CO2TaxSectorMarkup[, t,]
Expand Down Expand Up @@ -751,38 +751,38 @@ reportPrices <- function(gdx, output=NULL, regionSubsetList=NULL,
# report GHG taxes, differentiated by sector
# WARNING: the below sector markup code calculation does not consider regipol sector and emission market specific CO2eq prices. If you use both markups and the model 47 formulations, you will have wrongly reported CO2 sectoral and regional prices.
if (all(p21_CO2TaxSectorMarkup == 0)) { # then all are identical
out <- mbind(out, setNames(abs(pm_pvpRegi / (pm_pvp[,,"good"] + 1e-10)) * 1000 * 12/44, "Price|Carbon (US$2005/t CO2)"))
out <- mbind(out, setNames(pm_taxCO2eqSum * 1000 * 12/44, "Price|Carbon (US$2005/t CO2)"))
for (pcname in c("Price|Carbon|Demand|Buildings (US$2005/t CO2)", "Price|Carbon|Demand|Transport (US$2005/t CO2)",
"Price|Carbon|Demand|Industry (US$2005/t CO2)", "Price|Carbon|Supply (US$2005/t CO2)",
"Price|Carbon|AggregatedByGrossCO2 (US$2005/t CO2)")) {
out <- mbind(out, setNames(out[, , "Price|Carbon (US$2005/t CO2)"], pcname))
}
} else { # currently p21_CO2TaxSectorMarkup is only implemented for build and trans in REMIND
out <- mbind(out,
setNames((1 + p21_CO2TaxSectorMarkup[, , "build"]) * abs(pm_pvpRegi / (pm_pvp[,,"good"] + 1e-10)) * 1000 * 12/44,
setNames((1 + p21_CO2TaxSectorMarkup[, , "build"]) * pm_taxCO2eqSum * 1000 * 12/44,
"Price|Carbon|Demand|Buildings (US$2005/t CO2)"),
setNames((1 + p21_CO2TaxSectorMarkup[, , "trans"]) * abs(pm_pvpRegi / (pm_pvp[,,"good"] + 1e-10)) * 1000 * 12/44,
setNames((1 + p21_CO2TaxSectorMarkup[, , "trans"]) * pm_taxCO2eqSum * 1000 * 12/44,
"Price|Carbon|Demand|Transport (US$2005/t CO2)"),
setNames(abs(pm_pvpRegi / (pm_pvp[,,"good"] + 1e-10)) * 1000 * 12/44,
setNames(pm_taxCO2eqSum * 1000 * 12/44,
"Price|Carbon|Demand|Industry (US$2005/t CO2)"),
setNames(abs(pm_pvpRegi / (pm_pvp[,,"good"] + 1e-10)) * 1000 * 12/44,
setNames(pm_taxCO2eqSum * 1000 * 12/44,
"Price|Carbon|Supply (US$2005/t CO2)")
)
pm_pvpRegi_FE <- pm_pvpRegi * (1 +
pm_taxCO2eq_FE <- pm_taxCO2eqSum * (1 +
(
p21_CO2TaxSectorMarkup[, , "build"] * output_wo_GLO[, , "FE|Buildings (EJ/yr)"]
+ p21_CO2TaxSectorMarkup[, , "trans"] * output_wo_GLO[, , "FE|Transport (EJ/yr)"]
) / output_wo_GLO[, , "FE (EJ/yr)"]
)
pm_pvpRegi_Emi <- pm_pvpRegi * (1 +
pm_taxCO2eq_Emi <- pm_taxCO2eqSum * (1 +
(
p21_CO2TaxSectorMarkup[, , "build"] * output_wo_GLO[, , "Emi|GHG|Gross|Energy|Demand|Buildings (Mt CO2eq/yr)"]
+ p21_CO2TaxSectorMarkup[, , "trans"] * output_wo_GLO[, , "Emi|GHG|Gross|Energy|Demand|Transport (Mt CO2eq/yr)"]
) / output_wo_GLO[, , "Emi|GHG|Gross|Energy (Mt CO2eq/yr)"]
)
out <- mbind(out, setNames(abs(pm_pvpRegi_FE / (pm_pvp[,,"good"] + 1e-10)) * 1000 * 12/44,
out <- mbind(out, setNames(pm_taxCO2eq_FE * 1000 * 12/44,
"Price|Carbon (US$2005/t CO2)")) # AggregatedbyFE
out <- mbind(out, setNames(abs(pm_pvpRegi_Emi / (pm_pvp[,,"good"] + 1e-10)) * 1000 * 12/44,
out <- mbind(out, setNames(pm_taxCO2eq_Emi * 1000 * 12/44,
"Price|Carbon|AggregatedByGrossCO2 (US$2005/t CO2)")) # AggregatedByEmiGHGGross
}

Expand Down

0 comments on commit a4695a9

Please sign in to comment.