Skip to content

Commit

Permalink
Merge branch 'magpiemodel:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
pascal-sauer authored Aug 9, 2024
2 parents 141cc01 + e38329e commit e611cc7
Show file tree
Hide file tree
Showing 24 changed files with 25 additions and 26 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- **script** scripts/start_functions.R decide individually for demand and price whether they are read from a REMIND report.
- **80_optimization** abort GAMS in case of execution errors
- **script** updated EATLancet project start scripts
- **script** replaced gdx package with gdx2 package calls

### added
- **scripts** added output report `EU_report.R` that uses `EU_report.Rmd`
Expand Down
5 changes: 3 additions & 2 deletions scripts/calibration/calc_calib.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ calibration_run <- function(putfolder, calib_magpie_name, logoption = 3) {
get_areacalib <- function(gdx_file) {
require(magclass)
require(magpie4)
require(gdx)
require(gdx2)
data <- readGDX(gdx_file, "pm_land_start")[, , c("crop", "past")]
data <- dimSums(data, dim = 1.2)
magpie <- land(gdx_file)[, , c("crop", "past")]
Expand All @@ -54,7 +54,7 @@ get_areacalib <- function(gdx_file) {

get_yieldcalib <- function(gdx_file) {
require(magclass)
require(gdx)
require(gdx2)
require(luscale)

prep <- function(x) {
Expand All @@ -81,6 +81,7 @@ update_calib <- function(gdx_file, calib_accuracy = 0.1, calibrate_pasture = TRU
n_maxcalib = 20, best_calib = FALSE) {
require(magclass)
require(magpie4)
require(gdx2)
if (!(modelstat(gdx_file)[1, 1, 1] %in% c(1, 2, 7))) stop("Calibration run infeasible")

area_factor <- get_areacalib(gdx_file)
Expand Down
3 changes: 2 additions & 1 deletion scripts/calibration/landconversion_cost.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ calibration_run <- function(putfolder, calib_magpie_name, logoption = 3, s_use_g
getCalibFactor <- function(gdx_file, mode = "cost", calib_accuracy = 0.05, lowpass_filter = 1) {
require(magclass)
require(magpie4)
require(gdx)
require(gdx2)
y <- readGDX(gdx_file,"t")
magpie <- land(gdx_file)[, y, "crop"]
hist <- dimSums(readGDX(gdx_file, "f10_land")[, , "crop"], dim = 1.2)
Expand Down Expand Up @@ -94,6 +94,7 @@ getHistCrop <- function() {
update_calib <- function(gdx_file, calib_accuracy = 0.05, lowpass_filter = 1, calib_file, cost_max = 3, cost_min = 0.05, calibration_step = "", n_maxcalib = 40, best_calib = FALSE) {
require(magclass)
require(magpie4)
require(gdx2)
if (!(modelstat(gdx_file)[1, 1, 1] %in% c(1, 2, 7))) stop("Calibration run infeasible")

y <- readGDX(gdx_file,"t")
Expand Down
1 change: 1 addition & 0 deletions scripts/output/extra/disaggregation.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ library(luscale)
library(madrat)
library(dplyr)
library(gms)
library(gdx2)

# =============================================
# Basic configuration
Expand Down
2 changes: 1 addition & 1 deletion scripts/output/extra/highres.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# Author: Florian Humpenoeder

library(magclass)
library(gdx)
library(gdx2)
library(magpie4)
library(lucode2)
library(gms)
Expand Down
2 changes: 1 addition & 1 deletion scripts/output/extra/out_of_bounds_check.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#########################
# Version 1.0, Florian Humpenoeder
#
library(gdx)
library(gdx2)
library(lucode2)
library(magclass)

Expand Down
2 changes: 1 addition & 1 deletion scripts/output/extra/reportMAgPIE2SEALS.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# 1.00: first working version

library(gms)
library(gdx)
library(gdx2)
library(magpie4)

message("Starting to report gridded MAgPIE land use for SEALS")
Expand Down
2 changes: 1 addition & 1 deletion scripts/output/projects/FSDP_collect.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ library(magclass)
library(gms)
library(magpiesets)
library(data.table)
library(gdx)
library(gdx2)
library(quitte)
library(m4fsdp)
library(stringr)
Expand Down
2 changes: 1 addition & 1 deletion scripts/output/projects/FSDP_collect2.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ library(magclass)
library(gms)
library(magpiesets)
library(data.table)
library(gdx)
library(gdx2)
library(quitte)
library(m4fsdp)
library(stringr)
Expand Down
2 changes: 1 addition & 1 deletion scripts/output/projects/peatland.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
library(lucode2)
library(magpie4)
library(luscale)

library(gdx2)
library(luplot)
library(ggplot2)
library(luscale)
Expand Down
1 change: 1 addition & 0 deletions scripts/output/validation_cell.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ library(luscale)
library(luplot)
library(lusweave)
library(magpiesets)
library(gdx2)

############################# BASIC CONFIGURATION ##############################
if (!file.exists(paste0(outputdir, "/LUH2_croparea_0.5.mz"))) stop("Cell validation is not possible. LUH2_croparea_0.5.mz and MAPSPAM_croparea_0.5.mz files are missing")
Expand Down
1 change: 0 additions & 1 deletion scripts/run_submit/submit_priority.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

#SBATCH --qos=priority
#SBATCH --partition=priority
#SBATCH --job-name=mag-run
#SBATCH --output=slurm.log
#SBATCH --mail-type=END,FAIL
Expand Down
1 change: 0 additions & 1 deletion scripts/run_submit/submit_priority_maxMem.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

#SBATCH --qos=priority
#SBATCH --partition=priority
#SBATCH --job-name=mag-run
#SBATCH --output=slurm.log
#SBATCH --mail-type=END,FAIL
Expand Down
1 change: 0 additions & 1 deletion scripts/run_submit/submit_standby.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

#SBATCH --qos=standby
#SBATCH --partition=priority
#SBATCH --job-name=mag-run
#SBATCH --output=slurm.log
#SBATCH --mail-type=END,FAIL
Expand Down
1 change: 0 additions & 1 deletion scripts/run_submit/submit_standby_dayMax.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

#SBATCH --qos=standby
#SBATCH --partition=priority
#SBATCH --job-name=mag-run
#SBATCH --output=slurm.log
#SBATCH --mail-type=END,FAIL
Expand Down
1 change: 0 additions & 1 deletion scripts/run_submit/submit_standby_maxMem.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

#SBATCH --qos=standby
#SBATCH --partition=priority
#SBATCH --job-name=mag-run
#SBATCH --output=slurm.log
#SBATCH --mail-type=END,FAIL
Expand Down
1 change: 0 additions & 1 deletion scripts/run_submit/submit_standby_maxMem_dayMax.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

#SBATCH --qos=standby
#SBATCH --partition=priority
#SBATCH --job-name=mag-run
#SBATCH --output=slurm.log
#SBATCH --mail-type=END,FAIL
Expand Down
8 changes: 4 additions & 4 deletions scripts/slurmOutput.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
slurmjobs:
SLURM standby: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END,FAIL --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=standby --partition=priority --time=24:00:00"
SLURM standby maxMem: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END,FAIL --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=standby --partition=priority --time=24:00:00 --mem-per-cpu=0 --cpus-per-task=16"
SLURM priority: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END,FAIL --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=priority --partition=priority"
SLURM priority maxMem: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END,FAIL --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=priority --partition=priority --mem-per-cpu=0 --cpus-per-task=16"
SLURM standby: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END,FAIL --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=standby --time=24:00:00"
SLURM standby maxMem: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END,FAIL --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=standby --time=24:00:00 --mem-per-cpu=0 --cpus-per-task=16"
SLURM priority: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END,FAIL --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=priority"
SLURM priority maxMem: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END,FAIL --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=priority --mem-per-cpu=0 --cpus-per-task=16"
4 changes: 2 additions & 2 deletions scripts/slurmStart.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
slurmjobs:
SLURM priority: "sbatch --job-name=%NAME --output=logs/%NAME-%j.out --mail-type=END,FAIL --wrap=\"Rscript %SCRIPT\" --qos=priority --partition=priority --cpus-per-task=3"
SLURM standby: "sbatch --job-name=%NAME --output=logs/%NAME-%j.out --mail-type=END,FAIL --wrap=\"Rscript %SCRIPT\" --qos=standby --partition=priority --cpus-per-task=3"
SLURM priority: "sbatch --job-name=%NAME --output=logs/%NAME-%j.out --mail-type=END,FAIL --wrap=\"Rscript %SCRIPT\" --qos=priority --cpus-per-task=3"
SLURM standby: "sbatch --job-name=%NAME --output=logs/%NAME-%j.out --mail-type=END,FAIL --wrap=\"Rscript %SCRIPT\" --qos=standby --cpus-per-task=3"
SLURM medium: "sbatch --job-name=%NAME --output=logs/%NAME-%j.out --mail-type=END,FAIL --wrap=\"Rscript %SCRIPT\" --qos=medium --cpus-per-task=3"
2 changes: 1 addition & 1 deletion scripts/start/extra/input_REMIND.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

library(gms)
library(magclass)
library(gdx)
library(gdx2)

# Load start_run(cfg) function which is needed to start MAgPIE runs
source("scripts/start_functions.R")
Expand Down
2 changes: 1 addition & 1 deletion scripts/start/projects/paper_peatland.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

library(gms)
library(magclass)
library(gdx)
library(gdx2)
library(luscale)
library(magpie4)

Expand Down
2 changes: 1 addition & 1 deletion scripts/start/projects/project_ABCDR.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
library(lucode2)
library(gms)
library(magclass)
library(gdx)
library(gdx2)

# Load start_run(cfg) function which is needed to start MAgPIE runs
source("scripts/start_functions.R")
Expand Down
2 changes: 1 addition & 1 deletion scripts/start/projects/project_BEST.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ version <- "V13"

library(lucode2)
library(magclass)
library(gdx)
library(gdx2)
library(magpie4)
library(gms)

Expand Down
2 changes: 1 addition & 1 deletion scripts/start/projects/project_LAMACLIMA_WP4.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

library(gms)
library(magclass)
library(gdx)
library(gdx2)

# Load start_run(cfg) function which is needed to start MAgPIE runs
source("scripts/start_functions.R")
Expand Down

0 comments on commit e611cc7

Please sign in to comment.