-
Notifications
You must be signed in to change notification settings - Fork 271
Add realization to 14_yields with regional and time-varying pasture Tau spillover values #882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
fcf6e51
First implementation of dynamic regional pasture Tau in new realization.
alexkoberle a268be3
add test dyn_reg_tau start script
5deba37
Bugfix to dynamic regional pasture tau implementation
alexkoberle 43c5aa8
Bugfix, add input files.
b0c3e55
Bugfix, add input files.
d9fb0ad
added new input data files to cfg
1b4c056
Merge branch 'develop' into dyn_reg_tau
alexkoberle 740771b
adjust description of default values in input file in realization.gms
6523f35
Addin Alex Köberle to module authors
alexkoberle daba8a0
Merge small change made directly in github. Merge branch 'dyn_reg_tau…
2626724
Fix gms warinings
1e17286
update presolve to latest develop; match preloop with managementcalib…
ed887fa
added missing newline
georg-schroeter b92c545
realization added in 2026, so copyright year should also be 2026
georg-schroeter c923b73
Update input data set versions in default.cfg
alexkoberle fec1c55
Update CHANGELOG with new features and changes
alexkoberle 8aa8b27
Merge branch 'develop' into dyn_reg_tau
codeZeilen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| *** | (C) 2008-2026 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: magpie@pik-potsdam.de | ||
|
|
||
| parameters | ||
| i14_yields_calib(t,j,kve,w) Calibrated biophysical input yields (excluding technological change) (tDM per ha per yr) | ||
| p14_pyield_LPJ_reg(t_all,i) Regional average input yields aggregated from clusters with initial pasture area as weights (tDM per ha per yr) | ||
| p14_pyield_corr(t,i) Regional pasture management correction for historical time steps (1) | ||
| i14_croparea_total(t_all,w,j) Cellular croparea (mio. ha) | ||
| i14_modeled_yields_hist(t_all,i,kcr) Biophysical input yields average over region and water supply type at the historical reference year (tDM per ha per yr) | ||
| i14_fao_yields_hist(t,i,kcr) FAO yields per region at the historical reference year (tDM per ha per yr) | ||
| i14_lambda_yields(t,i,kcr) Scaling factor for non-linear management calibration (1) | ||
| i14_managementcalib(t,j,kcr,w) Regional management calibration factor accounting for FAO yield levels (1) | ||
| im_growing_stock(t,j,ac,land_timber) Harvestable stem biomass per ha by age class (tDM per ha) | ||
| im_growing_stock_ysf(t,j,ac) Harvestable stem biomass per ha by age class for young secondary forest on other land (tDM per ha) | ||
| pm_yields_semi_calib(j,kve,w) Potential yields calibrated to FAO regional levels (tDM per ha per yr) | ||
| i14_calib_yields_hist(i,w) Calibrated yields average over region and crop type at the historical reference year (tDM per ha per yr) | ||
| i14_calib_yields_ratio(i) Irrigated to rainfed yield ratio for calibrated yields (1) | ||
| i14_target_ratio(i) Target irrigated to rainfed ratio as upper bound (1) | ||
| i14_modeled_yields_hist2(i,knbe14) Calibrated yields average over region and water supply type at the historical reference year (tDM per ha per yr) | ||
| ; | ||
|
|
||
| positive variables | ||
| vm_yld(j,kve,w) Yields (variable because of technical change) (tDM per ha per yr) | ||
| ; | ||
|
|
||
| equations | ||
| q14_yield_crop(j,kcr,w) Crop yields (tDM per ha per yr) | ||
| q14_yield_past(j,w) Pasture yields (tDM per ha per yr) | ||
| ; | ||
|
|
||
| *#################### R SECTION START (OUTPUT DECLARATIONS) #################### | ||
| parameters | ||
| ov_yld(t,j,kve,w,type) Yields (variable because of technical change) (tDM per ha per yr) | ||
| oq14_yield_crop(t,j,kcr,w,type) Crop yields (tDM per ha per yr) | ||
| oq14_yield_past(t,j,w,type) Pasture yields (tDM per ha per yr) | ||
| ; | ||
| *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| *** | (C) 2008-2026 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: magpie@pik-potsdam.de | ||
|
|
||
| *' @equations | ||
|
|
||
| ***CROP YIELD CALCULATIONS********************************************** | ||
|
|
||
| *' Technological change can increase the initial calibrated yields by: | ||
|
|
||
| q14_yield_crop(j2,kcr,w) .. | ||
| vm_yld(j2,kcr,w) =e= sum(ct,i14_yields_calib(ct,j2,kcr,w)) * | ||
| vm_tau(j2,"crop") / sum((cell(i2,j2), supreg(h2,i2)), fm_tau1995(h2)); | ||
|
|
||
| *' For the current time step of the optimization, cellular yields of irrigated | ||
| *' and rainfed crops are calculated by multiplying calibrated input yields from | ||
| *' LPJmL with the intensification rate relative to the initial time step 1995. | ||
|
|
||
| ***PASTURE YIELD CALCULATIONS******************************************* | ||
|
|
||
| *' In the case of pasture yields, technological change cannot be fully | ||
| *' translated into yield increases, to address that, an exogenous pasture management | ||
| *' factor `pm_past_mngmnt_factor` is used to scale pasture yields based on the | ||
| *' number of cattle reared to fulfill the domestic demand for ruminant livestock | ||
| *' products in module 70. | ||
| *' | ||
| *' Additionally, the parameter `f14_yld_past_switch` can be used to capture a | ||
| *' certain magnitude of spillovers of the yield increase due to technological | ||
| *' change from the time step before. It is defined per model region and time step, | ||
| *' and can range from 0 (no spillover) to 1 (full spillover). | ||
|
|
||
| q14_yield_past(j2,w) .. | ||
| vm_yld(j2,"pasture",w) =e= | ||
| sum(ct,(i14_yields_calib(ct,j2,"pasture",w)) | ||
| * sum(cell(i2,j2),pm_past_mngmnt_factor(ct,i2))) | ||
| * (1 + sum(ct, sum(cell(i2,j2), f14_yld_past_switch(ct,i2))) | ||
| * (sum((cell(i2,j2), supreg(h2,i2)), pcm_tau(j2,"crop") / fm_tau1995(h2)) - 1)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| *** | (C) 2008-2026 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: magpie@pik-potsdam.de | ||
|
|
||
| $setglobal c14_yields_scenario cc | ||
| * options: cc (climate change) | ||
| * nocc (no climate change) | ||
| * nocc_hist (no climate change after year defined by sm_fix_cc) | ||
|
|
||
|
|
||
| scalars | ||
| s14_limit_calib Relative managament calibration switch (1=limited 0=pure relative) / 1 / | ||
| s14_calib_ir2rf Switch to calibrate rainfed to irrigated yield ratios (1=calib 0=not calib) / 1 / | ||
| s14_degradation Switch to include yield impacts of land degradation(0=no degradation 1=with degradation) / 0 / | ||
| s14_use_yield_calib Switch for using or not using yield calibration factors from the preprocessing (1=use facs 0=not use facs) / 0 / | ||
| s14_minimum_growing_stock Minimum growing stock for timber harvest in natural vegetation (tDM per ha) / 5 / | ||
| s14_yld_reduction_soil_loss Decline of land productivity in areas with severe soil loss (1) / 0.08 / | ||
| sm_carbon_fraction Carbon fraction of dry matter (tC per tDM) / 0.5 / | ||
| ; | ||
|
|
||
|
|
||
| ******* Calibration factor | ||
| $onEmpty | ||
| table f14_yld_calib(i,ltype14) Calibration factor for the LPJmL yields (1) | ||
| $ondelim | ||
| $if exist "./modules/14_yields/input/f14_yld_calib.csv" $include "./modules/14_yields/input/f14_yld_calib.csv" | ||
| $offdelim | ||
| ; | ||
| $offEmpty | ||
|
|
||
| table f14_yields(t_all,j,kve,w) LPJmL potential yields per cell (rainfed and irrigated) (tDM per ha per yr) | ||
| $ondelim | ||
| $include "./modules/14_yields/input/lpj_yields.cs3" | ||
| $offdelim | ||
| ; | ||
| * set values to 1995 if nocc scenario is used, or to sm_fix_cc after sm_fix_cc if nocc_hist is used | ||
| $if "%c14_yields_scenario%" == "nocc" f14_yields(t_all,j,kve,w) = f14_yields("y1995",j,kve,w); | ||
| $if "%c14_yields_scenario%" == "nocc_hist" f14_yields(t_all,j,kve,w)$(m_year(t_all) > sm_fix_cc) = f14_yields(t_all,j,kve,w)$(m_year(t_all) = sm_fix_cc); | ||
| m_fillmissingyears(f14_yields,"j,kve,w"); | ||
|
|
||
| table f14_pyld_hist(t_all,i) Modelled regional pasture yields in the past (tDM per ha per yr) | ||
| $ondelim | ||
| $include "./modules/14_yields/input/f14_pasture_yields_hist.csv" | ||
| $offdelim; | ||
|
|
||
| table f14_yld_past_switch(t_all,i) Pasture yield spillover factor from crop-sector TC by region (1) | ||
| $ondelim | ||
| $include "./modules/14_yields/dynRegPastrTau_apr26/input/f14_yld_past_switch.csv" | ||
| $offdelim | ||
| ; | ||
| m_fillmissingyears(f14_yld_past_switch,"i"); | ||
|
|
||
| table f14_fao_yields_hist(t_all,i,kcr) FAO yields per region (tDM per ha per yr) | ||
| $ondelim | ||
| $include "./modules/14_yields/dynRegPastrTau_apr26/input/f14_region_yields.cs3" | ||
| $offdelim | ||
| ; | ||
| m_fillmissingyears(f14_fao_yields_hist,"i,kcr"); | ||
|
|
||
| parameter f14_ir2rf_ratio(i) AQUASTAT ratio of irrigated to rainfed yields per region (1) | ||
| / | ||
| $ondelim | ||
| $include "./modules/14_yields/dynRegPastrTau_apr26/input/f14_ir2rf_ratio.cs4" | ||
| $offdelim | ||
| / | ||
| ; | ||
|
|
||
| parameter fm_ipcc_bef(clcl) IPCC biomass expansion factor BEF (1) | ||
| / | ||
| $ondelim | ||
| $include "./modules/14_yields/input/f14_ipcc_bef.cs3" | ||
| $offdelim | ||
| / | ||
| ; | ||
|
|
||
| parameter fm_aboveground_fraction(land_timber) Aboveground fraction of total biomass (1) | ||
| / | ||
| $ondelim | ||
| $include "./modules/14_yields/input/f14_aboveground_fraction.csv" | ||
| $offdelim | ||
| / | ||
| ; | ||
|
|
||
| $onEmpty | ||
| table f14_yld_ncp_report(t_all,j,ncp_type14) Share of land with intact natures contributions to people (NCP) (1) | ||
| $ondelim | ||
| $if exist "./modules/14_yields/input/f14_yld_ncp_report.cs3" $include "./modules/14_yields/input/f14_yld_ncp_report.cs3" | ||
| $offdelim | ||
| ; | ||
| $offEmpty | ||
|
|
||
| parameter f14_kcr_pollinator_dependence(kcr) Share of total yield dependent on biotic pollination (1) | ||
| / | ||
| $ondelim | ||
| $include "./modules/14_yields/input/f14_kcr_pollinator_dependence.csv" | ||
| $offdelim | ||
| / | ||
| ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| * list of files that are required here | ||
| f14_region_yields.cs3 | ||
| f14_ir2rf_ratio.cs4 | ||
| f14_yld_past_switch.csv | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| *** | (C) 2008-2026 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: magpie@pik-potsdam.de | ||
|
|
||
| * ### nl_fix ### | ||
|
|
||
| vm_yld.fx(j,kcr,w) = sum(ct,i14_yields_calib(ct,j,kcr,w)) * sum((cell(i,j), supreg(h,i)),vm_tau.l(h, "crop") / fm_tau1995(h)); | ||
| vm_yld.fx(j,"pasture",w) = sum(ct,(i14_yields_calib(ct,j,"pasture",w)) * sum(cell(i,j), pm_past_mngmnt_factor(ct,i))) * (1 + sum(ct, sum(cell(i,j), f14_yld_past_switch(ct,i))) * (sum((cell(i,j), supreg(h,i)), pcm_tau(h, "crop") / fm_tau1995(h)) - 1)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| *** | (C) 2008-2026 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: magpie@pik-potsdam.de | ||
|
|
||
| * ### nl_release ### | ||
|
|
||
| vm_yld.lo(j,kve,w) = 0; | ||
| vm_yld.up(j,kve,w) = Inf; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| *** | (C) 2008-2026 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: magpie@pik-potsdam.de | ||
|
|
||
|
|
||
|
|
||
|
|
||
| *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### | ||
| ov_yld(t,j,kve,w,"marginal") = vm_yld.m(j,kve,w); | ||
| oq14_yield_crop(t,j,kcr,w,"marginal") = q14_yield_crop.m(j,kcr,w); | ||
| oq14_yield_past(t,j,w,"marginal") = q14_yield_past.m(j,w); | ||
| ov_yld(t,j,kve,w,"level") = vm_yld.l(j,kve,w); | ||
| oq14_yield_crop(t,j,kcr,w,"level") = q14_yield_crop.l(j,kcr,w); | ||
| oq14_yield_past(t,j,w,"level") = q14_yield_past.l(j,w); | ||
| ov_yld(t,j,kve,w,"upper") = vm_yld.up(j,kve,w); | ||
| oq14_yield_crop(t,j,kcr,w,"upper") = q14_yield_crop.up(j,kcr,w); | ||
| oq14_yield_past(t,j,w,"upper") = q14_yield_past.up(j,w); | ||
| ov_yld(t,j,kve,w,"lower") = vm_yld.lo(j,kve,w); | ||
| oq14_yield_crop(t,j,kcr,w,"lower") = q14_yield_crop.lo(j,kcr,w); | ||
| oq14_yield_past(t,j,w,"lower") = q14_yield_past.lo(j,w); | ||
| *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.