Skip to content

Commit

Permalink
minor streamlining of code
Browse files Browse the repository at this point in the history
  • Loading branch information
pvjeetze committed May 23, 2024
1 parent 5210068 commit 390afbd
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 53 deletions.
8 changes: 4 additions & 4 deletions config/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ cfg$model <- "main.gms" #def = "main.gms"
#### input settings ####

# which input data sets should be used?
cfg$input <- c(regional = "rev4.105_h12_magpie.tgz",
cellular = "rev4.105_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz",
validation = "rev4.105_h12_validation.tgz",
cfg$input <- c(regional = "rev4.106_h12_magpie.tgz",
cellular = "rev4.106_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz",
validation = "rev4.106_h12_validation.tgz",
additional = "additional_data_rev4.50.tgz",
calibration = "calibration_H12_26Mar24.tgz")

Expand Down Expand Up @@ -882,7 +882,7 @@ cfg$gms$c32_interest_rate <- "regional" # def = "regional"
cfg$gms$s32_forestry_int_rate <- 0.05 # def = 0.05

# Setting to define if the model should be forward looking or not in terms of
# seeing the future demand for current timestep establishment of new plantations.
# seeing the future demand for current timestep establishment of new plantations.
# * 0 = static (establishment based on current demand)
# * 1 = forward looking (establishment based on future demand according to rotation length)
cfg$gms$s32_demand_establishment <- 1 # def = 1
Expand Down
2 changes: 1 addition & 1 deletion config/scenario_config.csv
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ gms$s73_timber_demand_switch;;;;;;;;;;;;;;;;;;;;;;;;;1;1;1;1;1;;;;;1;1;0;;;;;;;;
gms$s35_forest_damage;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4;4;4;4;4;;;;;;;;
gms$c32_shock_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;none;002lin2030;004lin2030;008lin2030;016lin2030;;;;;;;;
gms$c35_shock_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;none;002lin2030;004lin2030;008lin2030;016lin2030;;;;;;;;
input['cellular'];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.105_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.105_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.105_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.105_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.105_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.105_h12_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;;
input['cellular'];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.106_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.106_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.106_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.106_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.106_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.106_h12_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;;
gms$c52_land_carbon_sink_rcp;;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;RCP19;RCP26;RCP45;RCP60;RCPBU;RCPBU;;
gms$c57_macc_version;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;PBL_2022;PBL_2022;PBL_2022;PBL_2022;;;;;;;;;;;;;;;;
gms$c57_macc_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Default;Optimistic;Default;Optimistic;;;;;;;;;;;;;;;;
Expand Down
6 changes: 3 additions & 3 deletions config/scenario_fsec.csv
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ gms$s62_max_dem_bioplastic;0;;;;400;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
gms$c70_fac_req_regr;reg;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
gms$c70_feed_scen;;;;;;;;;;;;;;;;;;ssp1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
gms$c73_build_demand;;;;;;;;;;;;;;;;;;;;;;;;50pc;;;;;;;;;;;;;;;;;;;;;;;;;;;
input['cellular'];rev4.105_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.105_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.105_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.105_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.105_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.105_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.105_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;;;
input['regional'];rev4.105_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
input['validation'];rev4.105_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
input['cellular'];rev4.106_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.106_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.106_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.106_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.106_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.106_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.106_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;;;
input['regional'];rev4.106_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
input['validation'];rev4.106_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
input['additional'];additional_data_rev4.50.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
input['calibration'];calibration_FSEC_26Mar24.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
magicc_emis_scen;bjoernAR6_C_SSP2-NDC.mif;;;bjoernAR6_C_SSP2-PkBudg900.mif;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;bjoernAR6_C_SSP1-NDC.mif;;;;;;;;;;;;bjoernAR6_C_RemSDP-900-MagSSP1.mif;;
60 changes: 30 additions & 30 deletions main.gms
Original file line number Diff line number Diff line change
Expand Up @@ -147,44 +147,44 @@ $title magpie
*' * Always try to access model outputs through the corresponding magpie package instead of accessing them directly with readGDX. It cannot be guaranteed that your script will work in the future if you do otherwise (as only the corresponding magpie package will be continuously adapted to changes in the GAMS code).

*##################### R SECTION START (VERSION INFO) ##########################
*
* Used data set: rev4.104_h12_magpie.tgz
* md5sum: NA
* Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output
*
* Used data set: rev4.104_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz
* md5sum: NA
* Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output
*
* Used data set: rev4.104_h12_validation.tgz
* md5sum: NA
* Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output
*
* Used data set: additional_data_rev4.48.tgz
* md5sum: NA
* Repository: scp://cluster.pik-potsdam.de/p/projects/landuse/data/input/archive
*
*
* Used data set: rev4.106_h12_magpie.tgz
* md5sum: e76c52a364c5028c8c8e9f427bbf788a
* Repository: /p/projects/rd3mod/inputdata/output
*
* Used data set: rev4.106_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz
* md5sum: 21ae47f599f0526af325f43b2316978e
* Repository: /p/projects/rd3mod/inputdata/output
*
* Used data set: rev4.106_h12_validation.tgz
* md5sum: 9f7639ae2bef9f24fcae12d85300d4bd
* Repository: /p/projects/rd3mod/inputdata/output
*
* Used data set: additional_data_rev4.50.tgz
* md5sum: d29e253bd32fce7d3b9217642a5978d5
* Repository: /p/projects/landuse/data/input/archive
*
* Used data set: calibration_H12_26Mar24.tgz
* md5sum: NA
* Repository: https://rse.pik-potsdam.de/data/magpie/public
*
*
* Low resolution: c200
* High resolution: 0.5
*
*
* Total number of cells: 200
*
*
* Number of cells per region:
* CAZ CHA EUR IND JPN LAM MEA NEU OAS REF SSA USA
* 14 23 10 7 4 26 21 9 16 23 32 15
*
*
* Regionscode: 62eff8f7
*
* Regions data revision: 4.104
*
*
* Regions data revision: 4.106
*
* lpj2magpie settings:
* * LPJmL data: MRI-ESM2-0:ssp370
* * Revision: 4.104
*
* * Revision: 4.106
*
* aggregation settings:
* * Input resolution: 0.5
* * Output resolution: c200
Expand All @@ -193,10 +193,10 @@ $title magpie
* CAZ CHA EUR IND JPN LAM MEA NEU OAS REF SSA USA
* 14 23 10 7 4 26 21 9 16 23 32 15
* * Call: withCallingHandlers(expr, message = messageHandler, warning = warningHandler, error = errorHandler)
*
*
* Last modification (input data): Wed May 8 14:54:42 2024
*
*
*
* Last modification (input data): Thu May 23 11:16:51 2024
*
*###################### R SECTION END (VERSION INFO) ###########################

$offupper
Expand Down
2 changes: 1 addition & 1 deletion modules/35_natveg/input/files
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ npi_ndc_ad_aolc_pol.cs3
f35_forest_disturbance_share.cs4
f35_forest_lost_share.cs3
f35_forest_shock.csv
pot_forest_area.cs3
pot_forest_area.cs2
pot_forest_area_0.5.mz
2 changes: 1 addition & 1 deletion modules/35_natveg/pot_forest_may24/input.gms
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ $offdelim
parameter f35_pot_forest_area(j) Potential forest area (mio. ha)
/
$ondelim
$include "./modules/35_natveg/input/pot_forest_area.cs3"
$include "./modules/35_natveg/input/pot_forest_area.cs2"
$offdelim
/;
6 changes: 3 additions & 3 deletions modules/35_natveg/pot_forest_may24/postsolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
*** | Contact: magpie@pik-potsdam.de

*secdforest age class calculation
p35_secdforest(t,j,ac) = v35_secdforest.l(j,ac);
pc35_secdforest(j,ac) = v35_secdforest.l(j,ac);

*other land age class calculation
p35_other(t,j,ac) = v35_other.l(j,ac);
p35_youngsecdf(t,j,ac) = v35_youngsecdf.l(j,ac);
pc35_other(j,ac) = v35_other.l(j,ac);
pc35_youngsecdf(j,ac) = v35_youngsecdf.l(j,ac);

* Reset forest establishment bound
pcm_max_forest_est(j) = f35_pot_forest_area(j) - sum(land_forest, vm_land.l(j,land_forest));
Expand Down
8 changes: 8 additions & 0 deletions modules/35_natveg/pot_forest_may24/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,11 @@ p35_land_start_ac(j,ac,"secdforest") = i35_secdforest(j,ac);
* Set forest damage trajectory
* -----------------------------
m_sigmoid_time_interpol(p35_damage_fader,sm_fix_SSP2,s35_forest_damage_end,0,1);

* ---------------------------------------
* Initialise natveg in first time step
* ---------------------------------------

pc35_secdforest(j,ac) = i35_secdforest(j,ac);
pc35_youngsecdf(j,ac) = i35_youngsecdf(j,ac);
pc35_other(j,ac) = i35_other(j,ac);
10 changes: 0 additions & 10 deletions modules/35_natveg/pot_forest_may24/presolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,6 @@
*** | MAgPIE License Exception, version 1.0 (see LICENSE file).
*** | Contact: magpie@pik-potsdam.de

if((ord(t) = 1),
pc35_secdforest(j,ac) = i35_secdforest(j,ac);
pc35_youngsecdf(j,ac) = i35_youngsecdf(j,ac);
pc35_other(j,ac) = i35_other(j,ac);
else
pc35_secdforest(j,ac) = p35_secdforest(t-1,j,ac);
pc35_youngsecdf(j,ac) = p35_youngsecdf(t-1,j,ac);
pc35_other(j,ac) = p35_other(t-1,j,ac);
);

* ----------------------------------------------------
* Shift ageclasses due to shifting agriculture fires
* ----------------------------------------------------
Expand Down

0 comments on commit 390afbd

Please sign in to comment.