Skip to content

Commit

Permalink
Merge pull request #721 from pvjeetze/f_mag-seals
Browse files Browse the repository at this point in the history
Start script 'healthy landscapes paper' and output script for automatic submission of SEALS runs
  • Loading branch information
pascal-sauer authored Sep 20, 2024
2 parents cdc40d2 + 759ff44 commit 2929204
Show file tree
Hide file tree
Showing 28 changed files with 510 additions and 63 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- **config** additional data update additional_data_rev4.53.tgz
- **29_cropland** added option for linear and sigmoidal faders
- **scripts** output/extra/highres.R use default 13_tc realization
- **scripts** `.nc` files are no longer created by default after disaggregation
- **config** `cfg$gms$land_snv`changed from "secdforest, forestry, past, other" to "secdforest, other"
- **config** Submissions with high memory requirements now get 16 CPUs and 80GB of memory to account for the new specifications of PIK's new HPC 'Foote'. `maxMem` was renamed to `highMem`, because 80GB of memory does not correspond to the maximum available memory of a compute node.


### added
Expand All @@ -36,9 +39,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- **cropland** added option for discarding initial treecover on cropland
- **script** added output script for conversion of validation.mif file into validation.rds
- **script** for downscaling to 0.25 deg using LUH2v2h as reference via mrdownscale
- **config** added `scenario_config_year_fix.csv` for choosing until when parameters are fixed to SSP2 values
- **scripts** added start script for 'Healthly Landscapes' paper `paper_healthyLscps.R`
- **scripts** added script for automatic submission of SEALS allocation runs `./extra/runSEALSallocation.R`

### removed
-


### fixed
- **scripts** fixing an error in start.R and output.R which occurred if more than one slurm job was submitted at the same time.
Expand All @@ -52,7 +58,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### changed
- **29_ageclass** module 29_ageclass has been renamed to 28_ageclass to make space for `29_cropland` just before `30_croparea`
- **30_crop** module `30_crop` renamed to `30_croparea`, which now only accounts for crop area.
- **30_crop** Semi-Natural Vegetation (SNV) implementation has been moved from `30_crop` to `29_cropland`
- **30_crop** Semi-Natural Vegetation (SNV) implementation has been moved from `30_crop` to `29_cropland`
- **30_crop** the previous `30_crop/endo_apr21` realization has been moved to `30_croparea/simple_apr24`
- **30_crop** the two realizations `penalty_apr22` and `rotation_apr22` have been merged into a single `30_croparea/detail_apr24` realization
- **default.cfg** update additional data to rev4.51
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Imports:
m4fsdp,
madrat,
magclass (>= 6.14.0),
magpie4 (>= 2.11.0),
magpie4 (>= 2.12.0),
MagpieNCGains,
magpiesets,
mip,
Expand Down
41 changes: 22 additions & 19 deletions config/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ cfg$input <- c(regional = "rev4.111_h12_magpie.tgz",
cellular = "rev4.111_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz",
validation = "rev4.111_h12_validation.tgz",
additional = "additional_data_rev4.53.tgz",
calibration = "calibration_H12_26Mar24.tgz")
calibration = "calibration_H12_26Mar24_fixed.tgz")

# NOTE: It is recommended to recalibrate the model when changing cellular input data
# as well as for any other setting that would affect initial values in the model,
Expand Down Expand Up @@ -399,7 +399,7 @@ cfg$gms$kfo_rd <- "livst_rum" #def = livst_rum

# * Switch for supplemental fat needed as ingredient for scp-based meat alternatives
# * options: 0 (=off), 1 (=on)
cfg$gms$s15_scp_supplement_fat_meat <- 0 # def = 0
cfg$gms$s15_scp_supplement_fat_meat <- 0 # def = 0

# * Convergence of livestock food calorie supply towards a kcal/cap/day target with or w/o substitution.
# * The functional form and the start and target years of the food substitution can be specified below.
Expand Down Expand Up @@ -695,7 +695,7 @@ cfg$gms$ageclass <- "feb21" # def = feb21
# ***--------------------- 29_cropland -----------------------------------
# * Cropland is defined as the sum of croparea, fallow land and tree cover
# * Croparea is provided by 30_crop.
# * Fallow land and tree cover are defined by 29_cropland,
# * Fallow land and tree cover are defined by 29_cropland,
# * (simple_apr24): Fallow land and tree cover on cropland are fixed to zero
# * (detail_apr24): Fallow land and tree cover based on rules or incentives
# NOTE: It is recommended to recalibrate the model when changing this setting!
Expand Down Expand Up @@ -737,7 +737,7 @@ cfg$gms$s29_snv_scenario_target <- 2050 # def = 2050
# * plausible options: "secdforest, forestry, past, other",
# * "secdforest, other",
# * "secdforest, past, other" etc.
cfg$gms$land_snv <- "secdforest, forestry, past, other" #def = "secdforest, forestry, past, other"
cfg$gms$land_snv <- "secdforest, other" #def = "secdforest, other"

# *** Options only available for `detail_apr24` realization ***

Expand All @@ -755,7 +755,7 @@ cfg$gms$s29_treecover_map <- 0 # def = 0
# s29_treecover_target_noselect applies to all other countries.
cfg$gms$s29_treecover_target <- 0 # def = 0
cfg$gms$s29_treecover_target_noselect <- 0 # def = 0
# * Avoid loss of existing treecover (1=yes 0=no).
# * Avoid loss of existing treecover (1=yes 0=no).
# * If set to 1, `s29_treecover_target` will be adjusted based existing treecover area.
cfg$gms$s29_treecover_keep <- 0 # def = 0
# * Maximum share of treecover on total cropland (1)
Expand Down Expand Up @@ -808,12 +808,12 @@ cfg$gms$policy_countries30 <- all_iso_countries
## Agroforestry settings for bioenergy trees
# * Sigmoid fader for minimum area share of bioenergy trees (betr) on total cropland at cluster level
# * Minimum area share of bioenergy trees on total cropland in start year
# Note: s30_betr_start applies to countries selected in policy_countries30,
# Note: s30_betr_start applies to countries selected in policy_countries30,
# s30_betr_start_noselect applies to all other countries.
cfg$gms$s30_betr_start <- 0 # def = 0
cfg$gms$s30_betr_start_noselect <- 0 # def = 0
# * Minimum area share of bioenergy trees on total cropland in target year
# Note: s30_betr_target applies to countries selected in policy_countries30,
# Note: s30_betr_target applies to countries selected in policy_countries30,
# s30_betr_target_noselect applies to all other countries.
cfg$gms$s30_betr_target <- 0 # def = 0
cfg$gms$s30_betr_target_noselect <- 0 # def = 0
Expand Down Expand Up @@ -841,14 +841,14 @@ cfg$gms$s30_implementation <- 1 # def = 1
# * Rotation rules:
# * min (minimal constraints), default (best guess), good (good practice),
# * good_20div (good practice - 20% for other crops), setaside (default plus fallow),
# * legumes (minimum share of legumes), sixfoldrotation (crops can only repeat after 6 years),
# * legumes (minimum share of legumes), sixfoldrotation (crops can only repeat after 6 years),
# * agroecology (mix of previous scenarios), FSEC (similar to agroecology)
# * betr0 (minimum share of short rotation agroforestry trees), betr10, betr20, betr25, betr30, betr40, betr50.
cfg$gms$c30_rotation_rules <- "default" # def = "default"

# * Rotation incentives:
# * none (no incentives), default (best guess),
# * legumes (increased incentives for legumes), agroecology (mix),
# * none (no incentives), default (best guess),
# * legumes (increased incentives for legumes), agroecology (mix),
# * betr500 and betr1000 (incentives for short rotation agroforestry trees)
cfg$gms$c30_rotation_incentives <- "none" # def = "none"

Expand Down Expand Up @@ -2072,6 +2072,9 @@ cfg$gms$s80_secondsolve <- 0 # def = 0
# bjoernAR6_C_SSP2-NPi.mif, bjoernAR6_C_SSP2-PkBudg900.mif
cfg$magicc_emis_scen <- "bjoernAR6_C_SSP2-NDC.mif"

# Years in which SEALS downscaling is applied
cfg$seals_years <- c(2020, 2050)

# Decide whether the runs should be run sequentially (TRUE),
# or in parallel (FALSE)
# NA means that this decision is taken automatically
Expand All @@ -2080,15 +2083,15 @@ cfg$sequential <- NA

# Selection of QOS to be used for submitted runs on cluster.
# Will be ignored for all other runs.
# * options: short (24h max, no preemption)
# * short_maxMem (same as short but with 16 CPUs and max Memory)
# * medium (1 week max, no preemption)
# * priority (immediate start, but slots limited to 5 in parallel)
# * priority_maxMem (same as priority but with 16 CPUs and max Memory)
# * standby (1 week max, preemption possible)
# * standby_dayMax (24h max, preemption possible)
# * standby_maxMem_dayMax (same as standby_dayMax but with 16 CPUs and max Memory)
# * standby_maxMem (same as standby but with 16 CPUs and max Memory)
# * options: short (24h max, 3 CPUs, no preemption)
# * short_highMem (same as short but with 16 CPUs and 80GB of memory)
# * medium (1 week max, 3 CPUs, no preemption)
# * priority (immediate start, 3 CPUs, but slots limited to 5 in parallel)
# * priority_highMem (same as priority but with 16 CPUs and 80GB of memory)
# * standby (1 week max, 3 CPUs, preemption possible)
# * standby_dayMax (24h max, 3 CPUs, preemption possible)
# * standby_highMem_dayMax (same as standby_dayMax but with 16 CPUs and 80GB of memory)
# * standby_highMem (same as standby but with 16 CPUs and 80GB of memory)
# * NULL (educated guess of best option based
# * available resources)
cfg$qos <- NULL # def = NULL
Expand Down
16 changes: 16 additions & 0 deletions config/projects/scenario_config_year_fix.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
;fix_2020;fix_2025
gms$sm_fix_SSP2;2020;2025
gms$sm_fix_cc;2020;2025
gms$s15_food_substitution_start;2020;2025
gms$s15_exo_foodscen_start;2020;2025
gms$s21_trade_tariff_startyear;2020;2025
gms$s22_conservation_start;2020;2025
gms$s29_snv_scenario_start;2020;2025
gms$s29_treecover_scenario_start;2020;2025
gms$s29_fallow_scenario_start;2020;2025
gms$s30_betr_scenario_start;2020;2025
gms$s30_rotation_scenario_start;2020;2025
gms$s38_startyear_labor_substitution;2020;2025
gms$s42_efp_startyear;2020;2025
gms$s44_start_year;2020;2025
gms$s70_feed_substitution_start;2020;2025
1 change: 0 additions & 1 deletion scripts/output/extra/disaggregation.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ if (length(map_file) > 1) {
base::message(message)
x <- .fixCoords(x)
write.magpie(x, file, comment = comment)
write.magpie(x, sub(".mz", ".nc", file), comment = comment)
}

.dissagcrop <- function(gdx, land_hr, map_file) {
Expand Down
4 changes: 2 additions & 2 deletions scripts/output/extra/highres.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ highres <- function(cfg = cfg, res = "c1000", tc = NULL) {
cfg$gms$s_use_gdx <- 2

#max resources for parallel runs
cfg$qos <- "standby_maxMem_dayMax"
cfg$qos <- "standby_highMem_dayMax"

# set force download to FALSE
# otherwise data is download again when calling start_run(), which overwrites
Expand Down Expand Up @@ -156,7 +156,7 @@ highres <- function(cfg = cfg, res = "c1000", tc = NULL) {
write.magpie(readGDX(gdx,"f56_pollutant_prices_emulator"),"modules/56_ghg_policy/input/f56_pollutant_prices_emulator.cs3")
write.magpie(readGDX(gdx,"f60_bioenergy_dem_coupling"),"modules/60_bioenergy/input/reg.2ndgen_bioenergy_demand.csv")
write.magpie(readGDX(gdx,"f60_bioenergy_dem_emulator"),"modules/60_bioenergy/input/glo.2ndgen_bioenergy_demand.csv")

#get regional afforestation patterns from low resolution run with c200
aff <- dimSums(landForestry(gdx)[,,c("aff","ndc")],dim=3)
#Take away initial NDC area for consistency with global afforestation limit
Expand Down
Loading

0 comments on commit 2929204

Please sign in to comment.