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

Reporting and plots of renovation and construction flows #10

Merged
merged 6 commits into from
Oct 9, 2024

Conversation

ricardarosemann
Copy link
Contributor

Implement reporting renovation flow to mif, add plots for construction and renovation flows.

Addresses issue #9 .

Comment on lines 132 to 146
#### by Space heating (initial state)
```{r Renovation-Residential-(heatingBefore)}
showAreaAndBarPlots(data, vars = heatingResBefore, tot = totBefore, orderVars = "user", scales = "fixed")
walk(heatingResBefore, showLinePlots, data = data)
```

#### by Space heating (final state)
```{r Renovation-Residential-(heatingAfter)}
showAreaAndBarPlots(data, vars = heatingResAfter, tot = totAfter, orderVars = "user", scales = "fixed")
```

#### by Space heating (final state, with zero renovation)
```{r Renovation-Residential-(heatingAfter)}
showAreaAndBarPlots(data, vars = heatingResAfterZero, tot = totAfterZero, orderVars = "user", scales = "fixed")
walk(heatingResAfterZero, showLinePlots, data = data)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here the current variable naming means that the total is not shown in the plot, as the variables defined above actually do not exist. The total was still named in this way to preserve the coloring from mip.
Eventually this will require changes in mip to solve the issue:

  • either add the variable names of the form "Initial|{hs}" to the mip plotstyle.csv
  • or modify mip such that additional tags can be cut from the variable name - or such that the shared part of the variable name is removed (This can potentially change the behavior of mip for many other users!)

Copy link
Contributor Author

@ricardarosemann ricardarosemann Aug 23, 2024

Choose a reason for hiding this comment

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

I found an easy (albeit not perfect) fix for this: If tot is not specified in the call to showAreaAndBarPlots, then the variable names are shortened by removing their common part, while said common part is considered to be the variable name of the total. However, the values of the total are computed simply as the sum of the plotted variables. So as a result, the area plots display the total and are colored correctly, but the total is not given by the variable Renovation|Residential. but computed as the sum of e.g. Renovation|Residential|Initial|{hs}

To obtain a solution where the variable naming is provided by removing the common part, but the total is given by the respective variable, we'd need a change in mip. The core problem here is that our variable name contains a tag (Initial or Final) that is meaningless without the tag following it (i.e. the specification of the heating system).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Then let's go without the specific tot and let's see if RSE can look into a mip change.

@ricardarosemann ricardarosemann force-pushed the flow-plots branch 2 times, most recently from d9bcf71 to df5dd50 Compare August 23, 2024 10:18
@ricardarosemann
Copy link
Contributor Author

Still missing in reportRenovation: The reporting of identical replacement, because this cannot be computed directly by reportAgg.

R/reportRenovation.R Outdated Show resolved Hide resolved
R/reportRenovation.R Outdated Show resolved Hide resolved
@ricardarosemann
Copy link
Contributor Author

I now adapted the bsr / hsr sets to aggregate over in renovation plots and now identical replacements and changes of the heating system are reported. An example pdf of the results can be found here:
/p/tmp/ricardar/brick/output/fullTestRun_2024-09-06_17.27.21/compScen.pdf.

@ricardarosemann ricardarosemann marked this pull request as ready for review September 6, 2024 16:01
R/reportRenovation.R Show resolved Hide resolved
R/reportRenovation.R Outdated Show resolved Hide resolved
R/reportRenovation.R Outdated Show resolved Hide resolved
R/reportRenovation.R Show resolved Hide resolved
R/reportRenovation.R Outdated Show resolved Hide resolved
@ricardarosemann
Copy link
Contributor Author

ricardarosemann commented Oct 8, 2024

I included the requested and suggested changes, but I struggled a bit to come up with a meaningful variable naming. The logic I followed was to be concise but also as short as possible. For instance, we then have a variable Renovation|Residential|Heating|Identical replacement and a variable Renovation|Residential|Change of heating system. The latter could alternatively be Renovation|Residential|Heating|Change of heating system. I decided against this name, as it does not really add information and only makes it longer. But I'm very open to follow a different logic and rename this variable (and others) accordingly.
Moreover, the issue with the totals is not resolved yet - I don't know if we want to fix that in this PR or if we can also shift it to later.

@robinhasse
Copy link
Collaborator

But I'm very open to follow a different logic and rename this variable (and others) accordingly.

I'd suggest to leave it as you suggested for now. In future, we could think about Renovation|Residential|Heating|Technology switch or so.

@ricardarosemann ricardarosemann merged commit 0891ea2 into pik-piam:main Oct 9, 2024
2 checks passed
@ricardarosemann ricardarosemann deleted the flow-plots branch October 15, 2024 08:09
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.

2 participants