Skip to content

Commit

Permalink
Merge pull request #737 from flohump/f_ageclass
Browse files Browse the repository at this point in the history
Bugfix age-classes
  • Loading branch information
flohump authored Oct 31, 2024
2 parents 7db3bc3 + e826a09 commit 8ca3f86
Show file tree
Hide file tree
Showing 23 changed files with 119 additions and 105 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- **config** changed default input data to use 2017USD
- **module_documentation** all references to USD05 changed to USD17
- **scripts** REMIND coupling reads data in US$2017, not US$2005
- **config** updated input data to rev4.113
- **config** updated input data to rev4.114
- **config** SHAPE scenarios start year of dietary shift changed to 2025
- **core** number of age-classes doubled from 150 to 300 years for better match of growth curves with potential natural vegetation.
- **35_natveg** revised age-class initialization of secondary forest

### added
- **62_material** added switch to turn off future material demand for bioplastic
Expand All @@ -24,6 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- **11_costs** changed equation to fix bug in total water cost calculation
- **29_cropland** treecover age-class growth was not working properly because ac_sub was erroneously not fixed
- **scripts** script/output/extra/resubmit.R
- **28_ageclass** bugfix input data unit and code clean-up. Renamed `feb21` realization to `oct24`

## [4.8.2] - 2024-09-24

Expand Down
10 changes: 5 additions & 5 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.113_h12_magpie.tgz",
cellular = "rev4.113_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz",
validation = "rev4.113_h12_validation.tgz",
cfg$input <- c(regional = "rev4.114_h12_magpie.tgz",
cellular = "rev4.114_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz",
validation = "rev4.114_h12_validation.tgz",
additional = "additional_data_rev4.57.tgz",
calibration = "calibration_H12_27Sep24.tgz")

Expand Down Expand Up @@ -690,8 +690,8 @@ cfg$gms$s22_conservation_start <- 2025 # def = 2025
cfg$gms$s22_conservation_target <- 2050 # def = 2050

# ***--------------------- 28_ageclass -----------------------------------
# * (feb21): Distribution of age-classes according to Poulter et al 2018
cfg$gms$ageclass <- "feb21" # def = feb21
# * (oct24): Forest age-classes based on GFAD V1.1 from Poulter et al 2019
cfg$gms$ageclass <- "oct24" # def = oct24

# ***--------------------- 29_cropland -----------------------------------
# * Cropland is defined as the sum of croparea, fallow land and tree cover
Expand Down
2 changes: 1 addition & 1 deletion config/projects/scenario_config_el2.csv
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ gms$s15_exo_alcohol;1;1;1
gms$s15_alc_scen;0;0;0
gms$factor_costs;sticky_labor;sticky_labor;sticky_labor
gms$c70_feed_scen;ssp1;ssp2;ssp2
input['cellular'];rev4.113EL2_h12_c6a7458f_cellularmagpie_c200_IPSL-CM6A-LR-ssp370_lpjml-8e6c5eb1.tgz;;
input['cellular'];rev4.114EL2_h12_c6a7458f_cellularmagpie_c200_IPSL-CM6A-LR-ssp370_lpjml-8e6c5eb1.tgz;;
magicc_emis_scen;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_DeepDive_noNDC-rem-12.mif;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_DeepDive_noNDC-rem-12.mif;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_DeepDive_noNDC-rem-12.mif
6 changes: 3 additions & 3 deletions config/projects/scenario_config_fsec.csv
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,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.113_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.113_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.113_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.113_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.113_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.113_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.113_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;;;
input['regional'];rev4.113_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
input['validation'];rev4.113_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
input['cellular'];rev4.114_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.114_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.114_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.114_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.114_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.114_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.114_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;;;
input['regional'];rev4.114_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
input['validation'];rev4.114_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
input['additional'];additional_data_rev4.57.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
input['calibration'];calibration_FSEC_27Sep24.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;;
2 changes: 1 addition & 1 deletion config/scenario_config.csv
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ gms$c60_biodem_level;;;;;;;;;;;;;;;;;;;;1;0;;;;;;;;;;;;
gms$c60_res_2ndgenBE_dem;;;;ssp1;ssp2;ssp2;ssp3;ssp4;ssp5;sdp;ssp2;sdp;sdp;;;;;;;;;;;;;;;;;;;;
gms$c70_feed_scen;;;;ssp1;ssp2;ssp2;ssp3;ssp4;ssp5;ssp1;ssp5;ssp1;ssp1;;;;;;;;;;;;;;;;;;;;
gms$s73_timber_demand_switch;;;;;;;;;;;;;;;;;;;;;;;;;1;1;0;;;;;;
input['cellular'];;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.113_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.113_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.113_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.113_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.113_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.113_h12_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz
input['cellular'];;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.114_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.114_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.114_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.114_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.114_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.114_h12_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz
5 changes: 4 additions & 1 deletion core/sets.gms
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,10 @@ sets
ac Age classes / ac0,ac5,ac10,ac15,ac20,ac25,ac30,ac35,ac40,ac45,ac50,
ac55,ac60,ac65,ac70,ac75,ac80,ac85,ac90,ac95,ac100,
ac105,ac110,ac115,ac120,ac125,ac130,ac135,ac140,ac145,
ac150,ac155,acx /
ac150,ac155,ac160,ac165,ac170,ac175,ac180,ac185,ac190,ac195,
ac200,ac205,ac210,ac215,ac220,ac225,ac230,ac235,ac240,ac245,
ac250,ac255,ac260,ac265,ac270,ac275,ac280,ac285,ac290,ac295,
ac300, acx /

ac_est(ac) Dynamic subset of age classes for establishment

Expand Down
13 changes: 13 additions & 0 deletions literature.bib
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,19 @@ @article{poulter2018global
publisher = {NASA National Aeronautics and Space Administration, PANGAEA}
}

@misc{poulter_global_2019,
title = {The global forest age dataset and its uncertainties (GFADv1.1)},
copyright = {info:eu-repo/semantics/openAccess},
url = {https://doi.pangaea.de/10.1594/PANGAEA.897392},
doi = {10.1594/PANGAEA.897392},
urldate = {2024-10-27},
publisher = {PANGAEA},
author = {Poulter, Benjamin and Aragão, Luiz and Andela, Niels and Bellassen, Valentin and Ciais, Philippe and Kato, Tomomichi and Lin, Xin and Nachin, Baatarbileg and Luyssaert, Sebastiaan and Pederson, Niel and Peylin, Philippe and Piao, Shilong and Pugh, Tom and Saatchi, Sassan and Schepaschenko, Dmitry and Schelhaas, Martjan and Shivdenko, Anatoly},
year = {2019},
note = {Publication Title: NASA National Aeronautics and Space Administration},
keywords = {age class, GFAD, Poulter},
}

@article{zabel_global_2014,
title = {Global {{Agricultural Land Resources}} \textendash{} {{A High Resolution Suitability Evaluation}} and {{Its Perspectives}} until 2100 under {{Climate Change Conditions}}},
author = {Zabel, Florian and Putzenlechner, Birgitta and Mauser, Wolfram},
Expand Down
14 changes: 7 additions & 7 deletions main.gms
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@ $title magpie

*##################### R SECTION START (VERSION INFO) ##########################
*
* Used data set: rev4.112_h12_magpie.tgz
* Used data set: rev4.114_h12_magpie.tgz
* md5sum: NA
* Repository: https://rse.pik-potsdam.de/data/magpie/public
*
* Used data set: rev4.112_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz
* Used data set: rev4.114_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz
* md5sum: NA
* Repository: https://rse.pik-potsdam.de/data/magpie/public
*
* Used data set: rev4.112_h12_validation.tgz
* Used data set: rev4.114_h12_validation.tgz
* md5sum: NA
* Repository: https://rse.pik-potsdam.de/data/magpie/public
*
Expand All @@ -179,11 +179,11 @@ $title magpie
*
* Regionscode: 62eff8f7
*
* Regions data revision: 4.112
* Regions data revision: 4.114
*
* lpj2magpie settings:
* * LPJmL data: MRI-ESM2-0:ssp370
* * Revision: 4.112
* * Revision: 4.114
*
* aggregation settings:
* * Input resolution: 0.5
Expand All @@ -195,7 +195,7 @@ $title magpie
* * Call: withCallingHandlers(expr, message = messageHandler, warning = warningHandler, error = errorHandler)
*
*
* Last modification (input data): Tue Sep 24 17:20:08 2024
* Last modification (input data): Sun Oct 27 00:37:36 2024
*
*###################### R SECTION END (VERSION INFO) ###########################

Expand Down Expand Up @@ -247,7 +247,7 @@ $setglobal processing substitution_may21
$setglobal trade selfsuff_reduced
$setglobal land_conservation area_based_apr22

$setglobal ageclass feb21
$setglobal ageclass oct24

$setglobal cropland simple_apr24
$setglobal croparea simple_apr24
Expand Down
15 changes: 0 additions & 15 deletions modules/28_ageclass/feb21/preloop.gms

This file was deleted.

26 changes: 0 additions & 26 deletions modules/28_ageclass/feb21/realization.gms

This file was deleted.

8 changes: 4 additions & 4 deletions modules/28_ageclass/module.gms
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

*' @title Age class

*' @description The age-class module calculates the distribution of secondary
*' forests and timber plantations based on Poulter dataset. This is used in
*' [32_forestry] and [35_natveg] for initialization of forest areas.
*' @description The age-class module provides forest area in age-classes
*' to other modules. The interface `im_forest_ageclass` is used in
*' [35_natveg] for the initialization of secondary forest areas.

*' @authors Abhijeet Mishra, Florian Humpenöder

*###################### R SECTION START (MODULETYPES) ##########################
$Ifi "%ageclass%" == "feb21" $include "./modules/28_ageclass/feb21/realization.gms"
$Ifi "%ageclass%" == "oct24" $include "./modules/28_ageclass/oct24/realization.gms"
*###################### R SECTION END (MODULETYPES) ############################
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
*** | Contact: [email protected]

parameter
im_plantedclass_ac(j,ac) Raw Distribution of ageclass in secondary forest as a proxy for planted forest (mio. ha)
im_forest_ageclass(j,ac) Forest area in 5-year age-classes based on GFAD (mio. ha)
;
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*** | MAgPIE License Exception, version 1.0 (see LICENSE file).
*** | Contact: [email protected]

table f28_forestageclasses(j,ac_poulter) Poulter age-class area in each cluster (1)
table f28_forestageclasses(j,ac_gfad) Forest area in 15 10-year age classes from GFAD (Mha)
$ondelim
$include "./modules/28_ageclass/input/forestageclasses.cs3"
$offdelim
Expand Down
14 changes: 14 additions & 0 deletions modules/28_ageclass/oct24/preloop.gms
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK)
*** | authors, and contributors see CITATION.cff file. This file is part
*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of
*** | AGPL-3.0, you are granted additional permissions described in the
*** | MAgPIE License Exception, version 1.0 (see LICENSE file).
*** | Contact: [email protected]

* Two age-classes in `ac` are mapped to one age-class in `ac_gfad`.
* Therefore, each age-class in `ac_gfad` is distributed equally to all belonging age-classes in `ac`.
im_forest_ageclass(j,ac) = 0;
im_forest_ageclass(j,ac) = sum(ac_gfad_to_ac(ac_gfad,ac),f28_forestageclasses(j,ac_gfad)) / 2;
* `class15` in GFAD1.1 includes forests that are 150 years or older, also including primary forest.
* Therefore, `class15` is mapped to the highest age-class `acx`.
im_forest_ageclass(j,"acx") = f28_forestageclasses(j,"class15");
File renamed without changes.
22 changes: 22 additions & 0 deletions modules/28_ageclass/oct24/realization.gms
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK)
*** | authors, and contributors see CITATION.cff file. This file is part
*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of
*** | AGPL-3.0, you are granted additional permissions described in the
*** | MAgPIE License Exception, version 1.0 (see LICENSE file).
*** | Contact: [email protected]

*' @description This realization provides forest area in age-classes `im_forest_ageclass`
*' based on the Global Forest Age Dataset (GFAD V1.1) from @poulter_global_2019.

*' @limitations Disturbances such as forest fires change the age structure of forests over time.
*' GFAD V1.1 likely includes such disturbances in younger age-classes (`ac_young`).
*' Since forest disturbances are not modeled extensively in MAgPIE,
*' using these numbers directly in the model might generate biases.

*####################### R SECTION START (PHASES) ##############################
$Ifi "%phase%" == "sets" $include "./modules/28_ageclass/oct24/sets.gms"
$Ifi "%phase%" == "declarations" $include "./modules/28_ageclass/oct24/declarations.gms"
$Ifi "%phase%" == "input" $include "./modules/28_ageclass/oct24/input.gms"
$Ifi "%phase%" == "preloop" $include "./modules/28_ageclass/oct24/preloop.gms"
$Ifi "%phase%" == "presolve" $include "./modules/28_ageclass/oct24/presolve.gms"
*######################## R SECTION END (PHASES) ###############################
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,15 @@
*** | Contact: [email protected]

sets
ac_poulter Forest age classes in Poulter data set
ac_gfad Forest age classes in GFAD data set
/ class1, class2, class3, class4, class5,
class6, class7, class8, class9, class10,
class11, class12, class13, class14, class15 /

ac_planted(ac) Young age classes which probably belong to managed forest
ac_young(ac) Young age classes
/ ac0, ac5, ac10, ac15, ac20, ac25, ac30 /

ac_plantations(ac) Possible age classes which probably belong to plantations
/ ac0, ac5, ac10, ac15, ac20, ac25, ac30,
ac35, ac40, ac45, ac50, ac55, ac60 /

ac_poulter_to_ac(ac_poulter,ac) mapping between ac and ac_poulter
ac_gfad_to_ac(ac_gfad,ac) mapping between ac and ac_gfad
/
class1 . (ac5,ac10)
class2 . (ac15,ac20)
Expand All @@ -34,10 +30,9 @@ class11 . (ac105,ac110)
class12 . (ac115,ac120)
class13 . (ac125,ac130)
class14 . (ac135,ac140)
class15 . (ac145,ac150)
/

;

alias(ac_poulter,ac_poulter2);
alias(ac_gfad,ac_gfad2);
alias(ac,ac2);
4 changes: 2 additions & 2 deletions modules/35_natveg/pot_forest_may24/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ parameters
p35_carbon_density_other(t,j,othertype35,ac,ag_pools) Carbon density other land (tC per ha)
p35_disturbance_loss_secdf(t,j,ac) Loss due to disturbances in secondary forest (mio. ha)
p35_disturbance_loss_primf(t,j) Loss due to disturbances in primary forest (mio. ha)
i35_plantedclass_ac(j,ac) Area of age-classes in secondary forest (1)
p35_poulter_dist(j,ac) Share of age-classes in secondary forest (1)
p35_secdf_ageclass(j,ac) Secondadry forest area in 5-year age-classes (mio. ha)
p35_secdf_ageclass_dist(j,ac) Share of age-classes in secondary forest (1)
p35_land_start_ac(j,ac,land_natveg) Initial Natural vegetation area (mio. ha)
p35_protection_dist(j,ac) Distribution of secondary forest protection (1)
p35_land_restoration(j,land_natveg) Actual secondary forest and other land restoration area (mio. ha)
Expand Down
Loading

0 comments on commit 8ca3f86

Please sign in to comment.