Skip to content

coupling prom and magpie implemented#97

Open
SongminYu wants to merge 18 commits into
mainfrom
auto-prom-magpie
Open

coupling prom and magpie implemented#97
SongminYu wants to merge 18 commits into
mainfrom
auto-prom-magpie

Conversation

@SongminYu
Copy link
Copy Markdown
Contributor

introduced in the open-prom PR

@SongminYu SongminYu requested a review from giannou April 23, 2026 13:54
@SongminYu SongminYu requested a review from alextsimp April 30, 2026 05:49
Comment thread R/couplePromWithMagpie.R Outdated
# ├── Secondary Forest
# └── Timber Plantations
# ============================================================================
emi_vars <- c(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

All these variables it is better to have it in csv file that we can easily alter instead of being hardcoded.

Copy link
Copy Markdown
Contributor Author

@SongminYu SongminYu Apr 30, 2026

Choose a reason for hiding this comment

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

agree, shall I create a csv file including the variable names in postprom/inst/extdata? Is that the place to save such info?

Copy link
Copy Markdown
Member

@alextsimp alextsimp left a comment

Choose a reason for hiding this comment

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

Please use camelCase in all R scripts. It is the coding standard.

@SongminYu SongminYu requested review from mmadianos and removed request for giannou May 6, 2026 05:02
@mmadianos
Copy link
Copy Markdown
Collaborator

Looks good. I have a few suggestions:

  1. In build_climatewatch_eu28_weights.R, the output path is hard‑coded. Since this CSV is currently limited in scope, would it make sense to embed it directly in the script? Alternatively, if we expect this to be extended in the future, perhaps it should be incorporated into mrprom instead of living in postprom.
  2. I noticed several repeated blocks like if (file.exists(iEmissions_magpie)). This looks like a good candidate for refactoring. One option could be to perform this check once upfront and use it to prepare the afolu object (depending on whether the file exists or not). If the downstream logic operates the same way regardless of the source of afolu, the subsequent file.exists() checks may no longer be necessary. This would reduce duplication and simplify the control flow.

@alextsimp alextsimp closed this May 11, 2026
@alextsimp alextsimp reopened this May 11, 2026
@SongminYu
Copy link
Copy Markdown
Contributor Author

Thanks @mmadianos ! I have improved the script following your first comment. Now the weights are hard-coded in the script since it is not long. It is better in this way, expecially for external users, that the script doesn't depend on the access of Climate Watch data. I also kept the script to generate these values, in case we want to change the methodology and refresh it. Furthermore, I also improved the disaggregation methodology by taking into account the cluster heterogeneity in MAgPIE, but you don't need to review this. I have tested.

Once @alextsimp and you have an agreement on the second comment, you can close the PR and I will merge it. Thanks a lot!

…nd introduce prepareMagpieAfolu helper function
@alextsimp
Copy link
Copy Markdown
Member

I made it a bit more cleaner so I think now we can merge it. @SongminYu @mmadianos

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants