Skip to content
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

New EAT Lancet Diet Implementation #625

Merged
merged 88 commits into from
Feb 24, 2024

Conversation

FelicitasBeier
Copy link
Member

@FelicitasBeier FelicitasBeier commented Jan 18, 2024

🐦 Description of this PR 🐦

  • New EATLancet diet implementation (required as part of the EAT2.0 project)
  • The previous EATLancet (EAT 1.0) implementation was not a direct implementation of EAT targets, but based on scenario runs from IMPACT which in turn used the EAT Lancet targets. Now, the EAT targets (transformed to kcal) constrain p15_intake_detail directly in MAgPIE
  • Currently, this new implementation can be selected via cfg$gms$s15_exo_diet <- 3, but the goal is to replace the old implementation by this one, i.e. delete code of cfg$gms$s15_exo_diet <- 1 to have no parallel implementations. Note is included in default.cfg for the switch
  • Changes in the old diet implementation / default:
  1. alcohol is reduced to zero by default when EATLancet diet is activated. This is in line with the EATLancet definition. If for a project, you would like to divert from this recommendation, you have to set the switch s15_exo_alcohol to 1.
  2. brans does not have a target in EATLancet. It stays at its current level by default. If a reduction to 0 is wanted, s15_exo_brans has to be activated (set to 1) now.
  • Differences between EAT1.0 and EAT2.0 (beyond technical implementation differences):
  1. Starchy fruit didn’t have max. target
  2. Roots didn’t have separate target (were parts of staples)
  3. Soybean does not have separate target anymore. It’s combined with the legumes target
  4. Peanuts does not have separate target anymore. It’s combined with nuts & seeds.
  • Special treatment of EAT2.0 recommendation within MAgPIE:
  1. We do not use gram targets, but kcal targets because MAgPIE calculates with kcal and treats the food products as homogenous good. We used the conversion from the Willet et al. paper
  2. We do not scale up nuts in others following the EAT nut target, but they are scaled together with the fruits and vegetables because “other” is a homogenous good. “Fruits and Vegetables” together with “Bananas & plantains” have to meet EAT Fruit + Veggie target (with bananas & plantains having a maximum for EAT starchy fruit). The “nuts in other” then count towards the nut target and rapeseed and sunflower are scaled accordingly. The respective shares (of nuts in other and of bananas in cassav_sp) are country-specific because especially the bananas in cassav_sp vary by country. This is in line with EAT2.0 idea of regionalized diets and is consistent with iso-level food intake calculations

🔧 Checklist for PR creator 🔧

  • 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 test runs via Rscript start.R --> "test runs"
      • Check logs for errors/warnings
    • 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,...)

Nutrition_Calorie_Intake (1)

Nutrition_Calorie_Intake_Crops_Other_crops_Fruits_Vegetables_Nuts
Nutrition_Calorie_Intake_Crops_Oil_crops_Other_oil_crops_incl_rapeseed
Nutrition_Calorie_Intake_Crops_Oil_crops_Groundnuts

Nutrition_Calorie_Intake_Fish

Nutrition_Calorie_Intake_Livestock_products_Poultry_meat
Nutrition_Calorie_Intake_Livestock_products_Ruminant_meat

Labor_Employment_Agricultural_employment
Biodiversity_Shannon_crop_area_diversity_index
Emissions_CH4_Land_Agriculture
Emissions_CO2_Land_Land_use_Change
Productivity_Landuse_Intensity_Indicator_Tau
Resources_Land_Cover_Cropland

📉 Performance changes 📈

  • Current develop branch default : ** mins
  • This PR's default : ** mins

🚨 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
  • content review done (at least 1)
  • RSE review done (at least 1)

FelicitasBeier and others added 30 commits August 10, 2023 16:08
Copy link
Member

@bodirsky bodirsky left a comment

Choose a reason for hiding this comment

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

Mostly minor changes. Please separate fruitvegnuts and roots switch

config/default.cfg Outdated Show resolved Hide resolved
modules/15_food/anthro_iso_jun22/preloop.gms Outdated Show resolved Hide resolved
modules/15_food/anthro_iso_jun22/exodietmacro.gms Outdated Show resolved Hide resolved
modules/15_food/anthro_iso_jun22/exodietmacro.gms Outdated Show resolved Hide resolved
modules/15_food/anthro_iso_jun22/exodietmacro.gms Outdated Show resolved Hide resolved
modules/15_food/anthro_iso_jun22/exodietmacro.gms Outdated Show resolved Hide resolved
Copy link
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.

Looks good in general. For more details, see comments.

CHANGELOG.md Outdated Show resolved Hide resolved
config/default.cfg Show resolved Hide resolved
config/default.cfg Show resolved Hide resolved
# * options: BMK, FLX, PSC, VEG, VGN, FLX_hmilk, FLX_hredmeat
cfg$gms$c15_EAT_scen <- "FLX" # def = FLX

# * Subspecifications: Which commodities shall be included in the diet shift
# * Sub-specifications: Which commodities shall be included in the diet shift
# * towards cfg$gms$c15_EAT_scen ? Only selected (1) commodities will be
Copy link
Contributor

Choose a reason for hiding this comment

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

replace "included in the diet shift towards cfg$gms$c15_EAT_scen" with
"included in the shift towards the selected scenario diet"

config/default.cfg Outdated Show resolved Hide resolved

*' Extract fruits and vegetables that are part of others category
* Note that starchy fruits are kept at the previously assigned maximum level
* and their amount has been added to cassav_sp already.
Copy link
Contributor

Choose a reason for hiding this comment

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

"their amount has been added to cassav_sp already". Here I am not sure. I think their amount will be added, in line 551.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is part of p15_intake_detail_fruitveg and p15_intake_detailed_scen_fruitveg already

modules/15_food/anthro_iso_jun22/exodietmacro.gms Outdated Show resolved Hide resolved
* (i15_rec_EATLancet(iso,"t_nutseeds","min") - i15_intake_detailed_scen_nuts(t,iso))
;

*** ISABELLE: Please double-check whether I can remove the if condition from the nuts target equations
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you mean the condition $(sum(kfo_ns2, p15_intake_detail(t,iso,kfo_ns2)) < (f15_rec_EATLancet(iso,"t_nutseeds","min") - i15_intake_detailed_scen_nuts(t,iso))?

I think it is a good idea to avoid that i15_intake_detailed_scen_nuts over-fulfill the nuts and seeds target. However, your solution would not work in the case, that even without the scaling-up of the i15_intake_detailed_scen_nuts, the sum of the old "others-nuts" plus remaining nuts would be above the target. In this case, the current implementation would correct this unnecessarily down.

Maybe one can first substract i15_intake_detailed_scen_nuts from sum(kfo_ns2, p15_intake_detail(t,iso,kfo_ns2)):

p15_intake_detailed_scen_target(t,iso,kfo_ns)$(...)
= p15_intake_detail(t,iso,kfo_ns) / sum(kfo_ns2, p15_intake_detail(t,iso,kfo_ns2))
* (sum(kfo_ns2, p15_intake_detail(t,iso,kfo_ns2)) - i15_intake_detailed_scen_nuts(t,iso))
;
and then apply the constraint:

p15_intake_detailed_scen_target(t,iso,kfo_ns)$(sum(kfo_ns2, p15_intake_detailed_scen_targett,iso,kfo_ns)) < (f15_rec_EATLancet(iso,"t_nutseeds","min") - i15_intake_detailed_scen_nuts(t,iso)) = p15_intake_detailed_scen_target(t,iso,kfo_ns) / sum(kfo_ns2, p15_intake_detailed_scen_target((t,iso,kfo_ns2))
* (f15_rec_EATLancet(iso,"t_nutseeds","min") - i15_intake_detailed_scen_nuts(t,iso))
;

modules/15_food/anthro_iso_jun22/exodietmacro.gms Outdated Show resolved Hide resolved
modules/15_food/anthro_iso_jun22/input.gms Show resolved Hide resolved
Copy link
Member

@bodirsky bodirsky left a comment

Choose a reason for hiding this comment

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

super feli!

@FelicitasBeier
Copy link
Member Author

Thank you, @bodirsky and @weindl for this extensive review and discussions!

@FelicitasBeier FelicitasBeier merged commit 6a9f24a into magpiemodel:develop Feb 24, 2024
1 check passed
@FelicitasBeier FelicitasBeier deleted the EATdietModel branch February 24, 2024 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request High risk Higher risk Medium risk
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants