Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
-

### removed
-
- **scripts** Drop the `gdxrrw`/`gdx` R dependency from REMIND scripts; GDX writes now use `gamstransfer`-based `quitte::write.gdx`
[[#2485](https://github.com/remindmodel/remind/pull/2485)]

### fixed
- **scripts** Fix call to harmonization and infilling console entry point in `climateAssessmentInterimRun.R`
Expand Down
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Imports:
GDPuc,
gdx2,
gdxdt,
gdxrrw,
ggplot2,
glue,
gms (>= 0.33.4),
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ so!
Model dependencies **must be publicly available** and should be Open Source.
Development aim is to rather minimize than expand dependencies on non-free
and/or non open source software. That means that besides currently existing
dependencies on GAMS, the `gdxrrw` R package and the corresponding solvers there
should be no additional dependencies of this kind and that these existing
dependencies on GAMS and the corresponding solvers there should be no
additional dependencies of this kind and that these existing
dependencies should be resolved in the future if possible.

If a new R package is added as dependency this package should fulfill the
Expand Down
22 changes: 9 additions & 13 deletions scripts/input/climateAssessmentImpulseResponse.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# | Contact: remind@pik-potsdam.de
# !/bin/bash
library(dplyr)
require(gdxrrw) # Needs an environmental variable to be set, see below
library(lucode2)
library(magrittr)
library(piamInterfaces)
Expand Down Expand Up @@ -234,18 +233,15 @@ oupt <- oupt %>%
runTimes <- c(runTimes, "postprocessing end" = Sys.time())
runTimes <- c(runTimes, "write_gdx start" = Sys.time())

writeToGdx <- function(file = "pm_magicc_temperatureImpulseResponse", df) {
df$tall <- factor(df$tall)
df$tall1 <- factor(df$tall1)
attr(df, which = "symName") <- "pm_temperatureImpulseResponse"
attr(df, which = "domains") <- c("tall", "tall")
attr(df, which = "domInfo") <- "full"

wgdx.lst(file, df, squeeze = FALSE)
}

# write to GDX:
writeToGdx("pm_magicc_temperatureImpulseResponse", oupt)
# write to GDX
oupt %>%
rename(value = tirf) %>%
mutate(variable = "pm_temperatureImpulseResponse") %>%
write.gdx(
"pm_magicc_temperatureImpulseResponse.gdx",
varmap = c("pm_temperatureImpulseResponse" = "pm_temperatureImpulseResponse"),
dimCols = c("tall", "tall1")
)
cat(date(), "climateAssessmentImpulseResponse.R: Wrote results to 'pm_magicc_temperatureImpulseResponse.gdx'\n")
runTimes <- c(runTimes, "write_gdx end" = Sys.time())

Expand Down
1 change: 0 additions & 1 deletion scripts/input/climateAssessmentInterimRun.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# | Contact: remind@pik-potsdam.de
# !/bin/bash
library(dplyr)
require(gdxrrw) # Needs an environmental variable to be set, see below
library(lucode2)
library(magrittr)
library(piamInterfaces)
Expand Down
25 changes: 9 additions & 16 deletions scripts/input/run_KotzWenz_damages.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
# FP
print("Calculating damages and marginal damages for SCC ")
require(dplyr)
require(gdxrrw)
require(quitte)
igdx(system("dirname $( which gams )", intern = TRUE))

beta1 <- read.csv("../../modules/50_damages/KotzWenz/input/f50_KLW_df_beta1.cs4r",skip=4,header=FALSE) %>% rename(iso=V1,realization=V2,value=V3)
beta2 <- read.csv("../../modules/50_damages/KotzWenz/input/f50_KLW_df_beta2.cs4r",skip=4,header=FALSE) %>% rename(iso=V1,realization=V2,value=V3)
Expand Down Expand Up @@ -56,23 +54,18 @@ for(i in countries){
alldam_marg <- rbind(alldam_marg,rename(select(dam_q,c("iso","period","low_marg","med_marg","mean_marg","high_marg")),tall=period))
}

writeToGdx = function(file,df,name){
df$tall = factor(df$tall)
df$iso = factor(df$iso)
df$percentile = factor(df$percentile)
attr(df,which = 'symName') = name
attr(df,which = 'domains') = c('tall','iso','percentile')
attr(df,which = 'domInfo') = 'full'

wgdx.lst(file,df,squeeze = F)
}

alldam <- reshape2::melt(alldam,id.vars=c("tall","iso")) %>% rename(percentile=variable)
alldam_marg <- reshape2::melt(rename(alldam_marg,low=low_marg,med=med_marg,mean=mean_marg,high=high_marg),id.vars=c("tall","iso")) %>% rename(percentile=variable)

# write to GDX:
writeToGdx('pm_KotzWenz_damageIso',alldam,'pm_damageIso')
writeToGdx('pm_KotzWenz_damageMarginalIso',alldam_marg,'pm_damageMarginalIso')
# write to GDX
alldam %>%
mutate(variable = "pm_damageIso") %>%
write.gdx("pm_KotzWenz_damageIso.gdx",
varmap = c(pm_damageIso = "pm_damageIso"), dimCols = c("tall", "iso", "percentile"))
alldam_marg %>%
mutate(variable = "pm_damageMarginalIso") %>%
write.gdx("pm_KotzWenz_damageMarginalIso.gdx",
varmap = c(pm_damageMarginalIso = "pm_damageMarginalIso"), dimCols = c("tall", "iso", "percentile"))
print("...done.")


Expand Down
1 change: 0 additions & 1 deletion scripts/output/comparison/checkClimatePercentiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#
require(tidyverse)
require(quitte)
require(gdx)
require(yaml)

cat("===================== STARTING checkClimatePercentiles.R", "\n")
Expand Down
2 changes: 1 addition & 1 deletion scripts/start/prepare.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ prepare <- function() {
# list all packages of interest alphabetically here
tribble(
~Package, "data.table", "devtools", "dplyr", "edgeTransport",
"flexdashboard", "gdx2", "gdxdt", "gdxrrw", "ggplot2", "gtools",
"flexdashboard", "gdx2", "gdxdt", "ggplot2", "gtools",
"lucode2", "luplot", "luscale", "magclass", "magpie4", "methods",
"mip", "mrtransport", "optparse", "parallel",
"plotly", "remind2", "reporttransport", "reticulate", "rlang",
Expand Down
1 change: 0 additions & 1 deletion scripts/start/prepareAndRun.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ library(gms, quietly = TRUE,warn.conflicts =FALSE)
library(lucode2, quietly = TRUE,warn.conflicts =FALSE)
library(dplyr, quietly = TRUE,warn.conflicts =FALSE)
library(yaml, quietly = TRUE,warn.conflicts=FALSE)
require(gdx)


# Call prepare() and run() without cfg, because cfg is read from results folder, where it has been
Expand Down
Loading