iiasa / message_ix

The integrated assessment and energy systems model MESSAGEix
https://docs.messageix.org
Apache License 2.0
122 stars 154 forks source link

Add a module for implementing (sub-annual) time slices #852

Open glatterf42 opened 5 months ago

glatterf42 commented 5 months ago

This PR supersedes iiasa/message-ix-models#197 as @khaeru suggested this tool might be better placed in message_ix.

@behnam-zakeri Please take a look at the changes. Several things come to mind before merging this:

How to review

Check the above boxes plus:

PR checklist

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 0% with 255 lines in your changes missing coverage. Please review.

Project coverage is 90.3%. Comparing base (1125579) to head (baeb7f8). Report is 39 commits behind head on main.

Files with missing lines Patch % Lines
message_ix/tools/add_timeslice/add_timeslice.py 0.0% 255 Missing :warning:

:exclamation: There is a different number of reports uploaded between BASE (1125579) and HEAD (baeb7f8). Click for more details.

HEAD has 133 uploads less than BASE | Flag | BASE (1125579) | HEAD (baeb7f8) | |------|------|------| ||151|18|
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #852 +/- ## ======================================= - Coverage 95.6% 90.3% -5.4% ======================================= Files 46 47 +1 Lines 4333 4588 +255 ======================================= Hits 4143 4143 - Misses 190 445 +255 ``` | [Files with missing lines](https://app.codecov.io/gh/iiasa/message_ix/pull/852?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iiasa) | Coverage Δ | | |---|---|---| | [message\_ix/tools/add\_timeslice/add\_timeslice.py](https://app.codecov.io/gh/iiasa/message_ix/pull/852?src=pr&el=tree&filepath=message_ix%2Ftools%2Fadd_timeslice%2Fadd_timeslice.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iiasa#diff-bWVzc2FnZV9peC90b29scy9hZGRfdGltZXNsaWNlL2FkZF90aW1lc2xpY2UucHk=) | `0.0% <0.0%> (ø)` | |
glatterf42 commented 1 month ago

In the MESSAGE meeting just now, @behnam-zakeri mentioned that https://github.com/iiasa/message_ix/pull/680 might be related.

behnam-zakeri commented 3 weeks ago

@glatterf42 Related to the test, I have added an example of Westeros model via the Excel file, which is used by the code to create a Westeros scenario with time slices, exactly similar to the one we have in our published tutorials (Westeros_seasonality.ipynb). So, the only part missing will be to check if the output of these two models are the same or not.

  1. Running the new code with input data from Westeros_baseline scenario and config data from Excel. [done]
  2. Loading an already existing or running Westeros_Seasonality scenario (can be done easily).
  3. Comparing the results of 1 and 2, e.g.:
    • asserting if "time" related sets are the same ("time", "duration_time")
    • asserting OBJ.
    • asserting ACT of coal_ppl or wind_ppl in different times (winter or summer).