message_ix icon indicating copy to clipboard operation
message_ix copied to clipboard

Check the existing historical GDP parameter first

Open Jihoon opened this issue 3 years ago • 2 comments

I find the line in read_data() below checks whether gdp_calibrate (imported from external excel input files) has at least 2 periods before the model horizon.

https://github.com/iiasa/message_ix/blob/2045b07c13322ce0224ce809ca1c64c1e5f64398/message_ix/macro.py#L275-L286

But this can be also imported from self.s.par("historical_activity", {"technology":"GDP"}). So the condition can first check the parameter and, if so, import historical values directly. If not, then it can ask for external historical GDP inputs.

Jihoon avatar Mar 31 '22 08:03 Jihoon

Good idea!

self.s.par("historical_activity", {"technology":"GDP"})

Is having a specific "technology" set element with the ID "GDP" a generic feature of message_ix/MESSAGE-MACRO, or something particular to the MESSAGEix-GLOBIOM model family? The latter case would make it a little harder (not impossible) to have a generic implementation.

khaeru avatar Mar 31 '22 09:03 khaeru

Working on #719, I think the solution here is to provide an example in the docs and maybe a test. The example code should essentially:

  • Load MACRO calibration data, e.g. from a file.
  • data["historical_gdp"] = scenario.par("historical_activity", filters={"technology": "GDP"}) —and mention that the user is free to create a "historical_gdp" parameter or retrieve this from wherever else they like.
  • scenario.add_macro(data).

khaeru avatar Jun 15 '23 13:06 khaeru