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

Creation of FSDP_process & revision of FSDP_collect #450

Merged
merged 20 commits into from
Sep 16, 2022

Conversation

mscrawford
Copy link
Contributor

🐦 Purpose of this PR 🐦

This PR creates an intermediate step in the output generation for the FSEC project, FSDP_process. This is necessary because external researchers need results from the FSEC scenarios, and the FSDP_collect function can only fully execute once these datasets have been processed and the researchers' outputs returned. Therefore, this function produces these intermediate outputs. Afterwards, this PR adds functionality to the FSDP_collect function, so that it is able to read these external researchers' outputs and integrate them into the FSEC datasets (and subsequently the FSDP plots).

🔧 Checklist for PR creator 🔧

  • Low risk : Simple bugfixes (missing files, updated documentation, typos) or Start/output scripts
  • Medium risk : New realization / Changes to existing realization / Other changes which don't modify default.cfg
  • High risk : New input files (if cfg$input is changed in default.cfg) / Modification to core model (eg. changes in equations, calculations, introduction of new sets etc.) / Other changes in default.cfg
  • Providing additional information based on PR label
  • Low risk : No new model run needed.
  • Medium risk : Default run based on the current version of the fork from which PR is made
  • High risk
    • Default run from the current develop branch
    • Default run based on the current version of the fork from which PR is made
  • 📉 Performance loss/gain from current default behavior 📈

    • Current develop branch default : ** mins
    • This PR's default : ** mins
  • Added changes to CHANGELOG.md

  • Compilation check (model starts without compilation errors - use gams main.gms action=c in model folder for testing).

  • No hard coded numbers and cluster/country/region names.

  • The new code doesn't contain declared but unused parameters or variables.

  • Where relevant, In-code comments added including documentation comments.

  • Made sure that documentation created with goxygen is okay (use goxygen::goxygen() for testing).

  • Changes to magpie4 R library for post processing of model output (ideally backward compatible).

  • Self-review of my own code.

  • In case of updated cellular input tgz file in default.cfg: scenario_config.csv has been updated accordingly (rcp1p9, rcp2p6 etc)

  • For high risk runs: validation of major model indicators - Land-use, emissions, food prices, Tau. %Delete this line in case it is not a high risk run%

⚠️ Additional notes or warnings ⚠️

NA

🚨 Checklist for RSE reviewer 🚨

  • PR is labeled correctly.
  • CHANGELOG is updated correctly
  • No hard coded numbers and cluster/country/region names.
  • No unnecessary increase in module interfaces
  • All required updates in interfaces (if any) have been properly adressed in the module contracts
  • In-code comments and documentation comments are satisfactory.
  • model behavior/performance is satisfactory.
  • Requested changes (if any) were applied correctly

🚨 Checklist for MAgPIE reviewer 🚨

  • PR is labeled correctly.
  • CHANGELOG is updated correctly
  • No hard coded numbers and cluster/country/region names.
  • Changes to the model are scientifically sound
  • In-code comments and documentation comments are satisfactory.
  • model behavior/performance is satisfactory.
  • Requested changes (if any) were applied correctly

@mscrawford mscrawford added enhancement New feature or request Low risk Low risk labels Sep 13, 2022
scripts/output/projects/FSDP_collect.R Show resolved Hide resolved
quote = TRUE, sep = ",", row.names = FALSE, col.names = FALSE)
} else {
# Otherwise simply append
write.table(dietaryIndicators, file = dietaryIndicators_mergePath,
Copy link
Member

Choose a reason for hiding this comment

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

in principle, i recommend using our write.magpie and write.report functions as they have a more standardized format. but now, i would keep it as is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The difficulty is that I need to run csv2gdx on it, so the .mif format would have been clunkier. Unless write.report can do more than .mifs?

Copy link
Member

@tscheypidi tscheypidi Sep 15, 2022

Choose a reason for hiding this comment

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

wouldn't it be an option to use writeGDX if the aim is to write the data to a gdx file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I slept on this suggestion, and I think that - although it would greatly improve this entire workflow - I'm going to say that for now I would prefer to leave the code as-is. To do this properly, I would need to re-write the magpie4 function in addition to this function. When we port this code to future projects, I'll do the work of revising it properly. For now we have a working solution. I feel quite silly for not using this in the first place. I guess way back then I wanted to use .csvs because I thought it would be simpler for me and then got locked-in.

scripts/output/projects/FSDP_process.R Outdated Show resolved Hide resolved
Copy link
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.

Just some suggestion, but looks ok overall

scripts/output/projects/FSDP_collect.R Show resolved Hide resolved
scripts/output/projects/FSDP_process.R Outdated Show resolved Hide resolved
@mscrawford mscrawford merged commit 9777258 into magpiemodel:develop Sep 16, 2022
@mscrawford mscrawford deleted the FSDP_process branch September 16, 2022 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Low risk Low risk
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants