Skip to content

Add realization to 14_yields with regional and time-varying pasture Tau spillover values#882

Draft
alexkoberle wants to merge 5 commits into
magpiemodel:developfrom
alexkoberle:dyn_reg_tau
Draft

Add realization to 14_yields with regional and time-varying pasture Tau spillover values#882
alexkoberle wants to merge 5 commits into
magpiemodel:developfrom
alexkoberle:dyn_reg_tau

Conversation

@alexkoberle
Copy link
Copy Markdown
Contributor

🐦 Description of this PR 🐦

  • Briefly explain the purpose of this pull request

🔧 Checklist for PR creator 🔧

If a point is not applicable, check the checkbox anyway and write "non-applicable" next to the checkbox.

  • Label pull request from the label list.

    • Low risk: Simple bugfixes (missing files, updated documentation, typos) or changes in start or output scripts
    • Medium risk: Uncritical changes in the model core (e.g. moderate modifications in non-default realizations)
    • High risk: Critical changes in model core or default settings (e.g. changing a model default or adjusting a core mechanic in the model)
  • Self-review own code

    • No hard coded numbers and cluster/country/region names.
    • The new code doesn't contain declared but unused parameters or variables.
    • magpie4 R library has been updated accordingly and backwards compatible where necessary.
    • scenario_config.csv has been updated accordingly (important if default.cfg has been updated)
  • Document changes

    • Add changes to CHANGELOG.md
    • Where relevant, put In-code documentation comments
    • Properly address updates in interfaces in the module documentations
    • run goxygen::goxygen() and verify the modified code is properly documented
  • Perform test runs

    • Low risk:
      • Run a compilation check via Rscript start.R --> "compilation check"
    • Medium risk:
      • Run default run via Rscript start.R --> "default"
      • Check logs for errors/warnings
      • Fill in performance section below
    • High risk:
      • Run test runs via Rscript start.R --> "test runs"
      • Check logs for errors/warnings
      • Default run from the PR target branch for comparison
      • Provide relevant comparison plots (land-use, emissions, food prices, land-use intensity,...)
      • Fill in performance section below
  • Reporting produces no errors and no new warnings

  • Get two approving reviews (at least one from RSE)

📉 Performance 📈

  • This PR's default : ** mins
  • For comparison: runtimes of weekly test

🚨 Checklist for reviewer 🚨

  • PR is labeled correctly
  • Code changes look reasonable
    • No hard coded numbers and cluster/country/region names.
    • No unnecessary increase in module interfaces
    • model behavior/performance is satisfactory.
  • Changes are properly documented
    • CHANGELOG is updated correctly
    • Updates in interfaces have been properly addressed in the module documentations
    • In-code documentation looks appropriate

@alexkoberle alexkoberle requested review from tscheypidi and weindl May 8, 2026 08:20
@alexkoberle alexkoberle added enhancement New feature or request Medium risk labels May 8, 2026
Copy link
Copy Markdown
Member

@tscheypidi tscheypidi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GAMS implementation looks good, but there is no new input data revision. Please make sure that the new file is also part of the data inputs via madrat, otherwise the new realization will not work without additional input.

Copy link
Copy Markdown
Contributor

@weindl weindl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the new realization. Looks good in general, only a few minor issues (see comments).

Comment on lines +18 to +21
p14_pyield_corr(t,i) = (f14_pyld_hist(t,i)/p14_pyield_LPJ_reg(t,i))$(sum(sameas(t_past,t),1) = 1)
+ sum(t_past,(f14_pyld_hist(t_past,i)/(p14_pyield_LPJ_reg(t_past,i)+0.000001))$(ord(t_past)=card(t_past)))$(sum(sameas(t_past,t),1) <> 1);
i14_yields_calib(t,j,"pasture",w) = i14_yields_calib(t,j,"pasture",w) * sum(cell(i,j),p14_pyield_corr(t,i));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines seem to be a code improvement that is not directly linked to the regional pasture spill over. Could you therefore also revise the original managementcalib_aug19 realization accordingly, such that the 2 realizations only differ regarding the new content (spill-over implementation)?

*'
*' The parameter `f14_yld_past_switch(t_all,i)` scales the fraction of
*' crop-sector technological change (tau) that spills over to pasture yields,
*' and can vary across the 12 MAgPIE world regions and across 5-year model
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As MAgPIE regions, time step length and simulation period can be adapted to specific applications, I recommend to remove the numbers.

*' and can vary across the 12 MAgPIE world regions and across 5-year model
*' time steps from 1965 to 2150. A value of 0 implies no spillover; a value
*' of 1 implies full spillover equal to the crop-sector intensification rate.
*' The default input file populates all regions and time steps with 0.25,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that also the information about current default numbers should better be removed to avoid future inconsistencies when input data changes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can still write, independently from the specific content of the input file, that the described set-up (all regions and time steps with 0.25) is in principal able to reproduce the behaviour of managementcalib_aug19.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Medium risk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants