From 0bafe961a8fcf764e11ee0c3a69d0f48aa46a2a4 Mon Sep 17 00:00:00 2001 From: lecfab Date: Wed, 7 Aug 2024 18:50:11 +0200 Subject: [PATCH] fill zeroes only where necessary, to reduce memory footprint --- R/reportSE.R | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/R/reportSE.R b/R/reportSE.R index 65ce038d..3a334e9d 100644 --- a/R/reportSE.R +++ b/R/reportSE.R @@ -372,8 +372,10 @@ reportSE <- function(gdx, regionSubsetList = NULL, t = c(seq(2005, 2060, 5), seq vm_demFeSector[is.na(vm_demFeSector)] <- 0 # SE demand vm_demSe <- readGDX(gdx, "vm_demSe", field = "l", restore_zeros = F)[, y, ] * pm_conv_TWa_EJ - # SE demand of specific energy system technologies - v_demSeOth <- readGDX(gdx, c("v_demSeOth","vm_demSeOth"), field = "l", restore_zeros = T)[, y, ] * pm_conv_TWa_EJ + # SE demand of specific energy system technologies (ensure that all regions have a value) + v_demSeOth <- readGDX(gdx, c("v_demSeOth", "vm_demSeOth"), field = "l", restore_zeros = FALSE)[, y, ] * pm_conv_TWa_EJ + matrixRegionsYears <- new.magpie(cells_and_regions = getRegions(dataoc), years = y, fill = 0, sets = getSets(v_demSeOth, fulldim = FALSE)) + v_demSeOth <- matchDim(v_demSeOth, matrixRegionsYears, dim=1, fill=0) # conversion efficiency pm_eta_conv <- readGDX(gdx, "pm_eta_conv", field = "l", restore_zeros = F)[, y, ]