refactor: iamc export - #158
Conversation
for more information, see https://pre-commit.ci
…ind-mfa into refactor_iamc_export
|
I added a vibecoded script plot_iamc_vs_validation.py that plots the iamc outputs of REMIND-MFA against the newly created validation.mif (see pik-piam/mrmfa#65). If you prefer not to merge this, let me know. |
bennet21
left a comment
There was a problem hiding this comment.
This is such great work Leonie. Thanks a lot! This will make documenting our model results (and their progression over time as the model improves) much easier! And it is one more important step towards aligning our materials and making material specifics easier to understand!
The comments I have are basically all optional and preference based. Some of them just reflect what would've helped me a bit to understand what's going on.
| def model_name(self) -> str: | ||
| """Model identifier for the IAMC "model" column, including the REMIND-MFA version.""" | ||
| try: | ||
| return f"REMIND-MFA {version('remind-mfa')}" |
There was a problem hiding this comment.
NB:
In some cases, we may want this to actually say "REMIND X.X.X".
We could then pass an optional parameter with the version in the config or so.
Nothing to worry about now :-)
| else: | ||
| df["variable"] = spec.variable | ||
| variables = list(dict.fromkeys(df["variable"])) | ||
| return pyam.IamDataFrame(df, unit=spec.unit, **constants), variables |
There was a problem hiding this comment.
I just notice that the export is called IAM and not IAMC df. Should we drop the "s" everywhere, too?
for more information, see https://pre-commit.ci
…ind-mfa into refactor_iamc_export
JakobBD
left a comment
There was a problem hiding this comment.
That's great stuff indeed!
As for which variables to include:
Sounds good to follow the Circomod template for new variables.
This might create inconsistencies with the current prisma variables. Maybe we add a source (i.e., which template we took each variable from) to at least keep track of that.
NB: The R package piamInterfaces is designed to convert REMIND mifs to project-specific templates. So if we create one comprehensive mif, we can add mappings to other variable nomenclatures over there.
Don't do all the work of adding variables yourself now.
Just add the ones you need, and maybe add instructions for future users how to add new variables (The circomod excel file isn't public, but we could upload it to gitlab or the cloud).
As for combining the three materials:
I wouldn't worry about that now.
It's just concatenating three files. Add a minimal script to the scripts folder, if you like.
NB: In the long run, we may want a script that also appends these to the REMIND mif. We may want to ask RSE about that.
| @@ -0,0 +1,240 @@ | |||
| """Plot a material model's IAMC outputs against the curated validation data. | |||
There was a problem hiding this comment.
I agree. Go wild in the scripts folder. Maybe add a note/warning in this doc string that it's un-reviewed vibe-coding.
NB: cs2 does the same job, just with different kinds of plots and manual selection/layout for each variable.
Also added functionality, e.g. stacked bars showing multiple variables in one plot.
I would still keep this light-weight script, though.
| def model_name(self) -> str: | ||
| """Model identifier for the IAMC "model" column, including the REMIND-MFA version.""" | ||
| try: | ||
| return f"REMIND-MFA {version('remind-mfa')}" |
There was a problem hiding this comment.
NB:
In some cases, we may want this to actually say "REMIND X.X.X".
We could then pass an optional parameter with the version in the config or so.
Nothing to worry about now :-)
I added both the circomod and prisma templates to our Cloud folder under data/iamc_nomenclature. Should I add instructions for future users how to add new variables to the remind-mfa docs or just add a note to the docstring? |
The latter! |
for more information, see https://pre-commit.ci
This PR aims to streamline the iamc export of the different material models and to make adding new variables easier. As much code as possible was moved to common_export.py, now only the mapping of flows to iamc variables is done in the material_export.py. The PR also addresses https://github.com/pik-piam/remind-mfa/issues/82
This PR aims to streamline the iamc export of the different material models and to make adding new variables easier.
As much code as possible was moved to common_export.py, now only the mapping of flows to iamc variables is done in the material_export.py. The PR also addresses https://github.com/pik-piam/remind-mfa/issues/82
What do you think? I am happy to hear your feedback :)
TODO