-
Notifications
You must be signed in to change notification settings - Fork 41
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
Convert prices to Moving Avg fixed for < cm_startyear to ref run; keep single-period marginals as |Rawdata #402
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Let a run have
cm_startyear = 2025
. Then, thePrice|*|Moving Avg
values that are used in the AR6 mapping for 2020 arep_average(2020) = (p(2015) + 2p(2020) + p(2025))/4
as calculated inremind2::reportPrices()
by usingmagclass::lowpass()
. And as the 2025 prices differ between the scenarios, so does the reported 2020 price, which it should not.
It might be that the 2020 prices in files using the AR6 mapping should not differ, but that is not the same as having Price|*|Moving Avg
variables not being a moving averages in 2020, but something else.
Where else are those moving averages used?
The only places the
So this is a variable added only for the database export. |
You cannot infer the reason something has been introduced for in the past from a limited view of what it is used for in the present.
So this change would affect at least all those other projects, and they should have a say in it. If memory serves, moving average prices where used instead of real prices because the latter where always weirdly spiky. That situation might have changed with remindmodel/remind#1238. Have you checked if you can use proper prices instead? |
I would be fine with / in favor of the approach "don't change values in time steps before cm_startyear, even if we are talking about moving averages that theoretically would have to be changed for 100% conceptual consistency". I have a hard time imagining somebody complaining that "your 2020 prices aren't real moving averages" |
FYI:
|
I am against changing the moving averages calculation to add special rules, as I stated in the mattermost message I sent before. If you want to post-process any model specific variable (not only prices), you should make very clear what your output reporting variable is doing. I started working on a more structured price variable reporting some time ago, following strict rules like:
Meanwhile something like this is not fully implemented, as it is on hold due to other priorities, I would recommend to avoid infringing those principles, and if you have a too specific case, just do any project specific post-processing in project specific scripts. |
FYI: In the coupling MAgPIE does not use moving average prices but "Price|Carbon (US$2005/t CO2)". The same for the other Kyoto gases. |
I think this discussion is all about energy prices, which tend to fluctuate in REMIND quite a bit. Carbon prices are (to my knowledge) never averaged |
This is true, but completely conditional on where in the function prices are averaged. Push that down by 100 lines and Carbon prices get their |
It was just a reaction to Olli's question at the top. |
To me, it looks like:
I think we can:
Given the three options I could imagine, my preference would be 1 or 2. |
May I ask why you ignored in your possible options the structured rules that I mentioned above, and that makes use of the already existent I would say that the best alternative instead would be to follow the already started process of:
This proposed solution follow the structure already in place, do not break existent mappings that use the current moving average calculation, and make sure that in the future we can use price variable names close to the templates used in projects without the need for selecting prices with special tags. We would always have our "clean" price naming convention reserved for our best interpretation of what would be the correct prices to report externally. There is no need for a new special tag, named |
Sorry, @Renato-Rodrigues, I honestly don't know why my mind forgot about your comment when I was thinking about the alternatives. Weird. I actually think your proposal is the most convincing one. Did you already prepare something related to this process that I can build on? If not, I would suggest to rename all the |
I think the compScen should always at least show non-smoothed prices so we always see how spiky prices are currently. (if somebody wants to see the averaged as well, fine with me) |
Okay, implemented a first attempt of what I described above: Some statistics, comparing old and new results of
Doesn't look too bad. I think, in theory, the values below 2020 should not differ, if the fixing was perfect, but 100 data points is not too bad. If affects:
The difference is < 3% except for
If somebody wants to investigate, mif files and scripts are lying around in |
We have to check inside remind2:
outside remind2:
|
@dklein-pik wrote me about reportCosts:
|
After some discussion with Oliver I'd like to suggest a further addition to the price postprocessing: Issue: For non-SSP2 scenarios, we currently have wild FE price fluctuations in 2025 (sometimes several 100%), which are caused by the fixing of non-SSP2 scenarios to SSP2-NDC until 2020. We discussed it in more detail in the Macro channel: https://mattermost.pik-potsdam.de/rd3/pl/g156uh5mgt8upjcxmgzocug7fe As a temporary fix, while we come up with a new way of handling the fixing (hopefully as part of the switch to NPi calibrations), we could implement one of the following options:
In my view, Option A would be preferable, as it targets only the prices we know to be affected, and does so without having to specify an arbitrary threshold how much fluctuation is OK. @Renato-Rodrigues @0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q @LaviniaBaumstark any thoughts? |
@bs538: Another alternative would be to add something like that after this line.
So the fixing would not be in time, but rather you avoid diverging too much from the reference run. |
@orichters : thanks, interesting idea. But I think using the averaging in time domain would be more appropriate in this case, because we do actually expect a strong deviation from the reference run when the carbon price comes in in cm_startyear (especially for ambitious policy scenarios). I quickly looked at FE price changes from 2020 to 2025 in SSP2-PkBudg650 scenario (which has no fixing/adjustment issue), and here we also have price jumps of 50+ % for some FE|Sector|Carriers. |
I mean, that is the general problem: I don't think we can easily differentiate legitimate price jumps from the others. So indeed maybe the best temporary option is to identify from the gdx whether it is no SSP2 setting, and apply one of the options above. Modifying the weighting scheme seems tedious to me, so I would go with either A or B, depending on whether you actually like to keep part of the price changes or not. The question is whether this is best done here or in some sort of post-processing. I have no strong opinion on that. And I think we should put this issue high on the agenda to fix these problems at the root (if that is the root): remindmodel/remind#1068 |
Fully agree on the general problem. That's why any sort of threshold approach is problematic. So I would pick Option A (because we know that non-SSP2 scenarios have a price problem in 2025).
As we already fix price issues (such as negative prices, and smoothing out spikes) here, this seems to be the right place to add this further fix. If we do it in a separate post-processing, we need to go back to the Rawdata / Marginal prices, fix the problem there, and then re-apply the MovingAvg, so a lot of duplication.
Again fully agree. |
@orichters : thanks! @0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q @Renato-Rodrigues @fbenke-pik quick review would be appreciated as I would like to use this improvement to the price reporting (both general and in particular d3b1a54 ) for final project scenarios quickly. thanks! |
Sorry, I don't think I can be of help when it comes to validating rules for reporting variables. Whenever I extend the reporting (adding/adjusting reporting variables), it happens under supervision of felix, robert or renato. I just do the tech, but don't know anything about the logic behind the calculations. |
Find attached a number of plots where I compare
It all looks good from my side. (I moved the lines a bit left and right to make everything visible) |
You were right, I adapted the code such that Moving Avg are still moving averages, but the plain variables are now used for reporting.
cm_startyear = 2025
. Then, thePrice|*|Moving Avg
values that are used in the AR6 mapping for 2020 arep_average(2020) = (p(2015) + 2p(2020) + p(2025))/4
as calculated inremind2::reportPrices()
by usingmagclass::lowpass()
. And as the 2025 prices differ between the scenarios, so does the reported 2020 price, which it should not.Solution:
Price|…|Rawdata
. This is for example used in compareScenarios2Price|…|Moving Avg
as beforePrice|…
will get a cleaned-up version that should be used for reportingt < cm_startyear
, use the Price values from the referencegdx_ref
Minor improvements:
NA
,||
or something like that. There are still some variables with NA but I haven't figured out what the unit should beRes|Extraction|…|Cumulated
which was NAfegat
being reported asNA
, see reportPrices reports NA for fegat in transport #405For the record:
Moving Avg
by such a adapted calculation, but this was rejected because it would not be a moving average anymore and therefore confusing.reportPrices
with thegdx_ref
: I will figure out with @dklein-pik whether convGDX2MIF_REMIND2MAgPIE() as called in the REMIND reporting should also get that added. Not sure whether MAgPIE uses these averages prices…