|
| 1 | +from typing import TYPE_CHECKING, Optional |
| 2 | + |
| 3 | +from message_ix_models.workflow import Workflow |
| 4 | + |
| 5 | +if TYPE_CHECKING: |
| 6 | + from message_ix_models import Context |
| 7 | + |
| 8 | + |
| 9 | +def step_01() -> None: |
| 10 | + """Clean Timeseries.""" |
| 11 | + raise NotImplementedError |
| 12 | + |
| 13 | + |
| 14 | +def step_02() -> None: |
| 15 | + """Add Land-use Emulator.""" |
| 16 | + raise NotImplementedError |
| 17 | + |
| 18 | + |
| 19 | +def step_03() -> None: |
| 20 | + """Add Biomass Trade.""" |
| 21 | + raise NotImplementedError |
| 22 | + |
| 23 | + |
| 24 | +def step_04() -> None: |
| 25 | + """Solve for Historic Reporting.""" |
| 26 | + raise NotImplementedError |
| 27 | + |
| 28 | + |
| 29 | +def step_05() -> None: |
| 30 | + """Build Materials.""" |
| 31 | + raise NotImplementedError |
| 32 | + |
| 33 | + |
| 34 | +def step_06() -> None: |
| 35 | + """Add DAC (Direct Air Capture).""" |
| 36 | + raise NotImplementedError |
| 37 | + |
| 38 | + |
| 39 | +def step_07() -> None: |
| 40 | + """Add Non-CO2 GHGs.""" |
| 41 | + raise NotImplementedError |
| 42 | + |
| 43 | + |
| 44 | +def step_08() -> None: |
| 45 | + """Add Water.""" |
| 46 | + raise NotImplementedError |
| 47 | + |
| 48 | + |
| 49 | +def step_09() -> None: |
| 50 | + """Add Techno-economic Parameters.""" |
| 51 | + raise NotImplementedError |
| 52 | + |
| 53 | + |
| 54 | +def step_10() -> None: |
| 55 | + """Add Balance Equalities (some petrochemical trade balances?).""" |
| 56 | + raise NotImplementedError |
| 57 | + |
| 58 | + |
| 59 | +def step_11() -> None: |
| 60 | + """OBSOLETE.""" |
| 61 | + raise NotImplementedError |
| 62 | + |
| 63 | + |
| 64 | +def step_12() -> None: |
| 65 | + """Gas Mix Limitations (constrain gas use in industries).""" |
| 66 | + raise NotImplementedError |
| 67 | + |
| 68 | + |
| 69 | +def step_13() -> None: |
| 70 | + """Add Slack and Constraints (so we need to update the slacks).""" |
| 71 | + raise NotImplementedError |
| 72 | + |
| 73 | + |
| 74 | +def step_14() -> None: |
| 75 | + """Add Shipping.""" |
| 76 | + raise NotImplementedError |
| 77 | + |
| 78 | + |
| 79 | +def step_15() -> None: |
| 80 | + """Prepare for Macro Calibration.""" |
| 81 | + raise NotImplementedError |
| 82 | + |
| 83 | + |
| 84 | +def step_16() -> None: |
| 85 | + """Calibrate Macro.""" |
| 86 | + raise NotImplementedError |
| 87 | + |
| 88 | + |
| 89 | +STEP_ORDER = [ |
| 90 | + step_01, |
| 91 | + step_02, |
| 92 | + step_03, |
| 93 | + step_04, |
| 94 | + step_05, |
| 95 | + step_06, |
| 96 | + step_07, |
| 97 | + step_08, |
| 98 | + step_09, |
| 99 | + step_10, |
| 100 | + step_11, |
| 101 | + step_12, |
| 102 | + step_13, |
| 103 | + step_14, |
| 104 | + step_15, |
| 105 | + step_16, |
| 106 | +] |
| 107 | + |
| 108 | + |
| 109 | +def generate_workflow( |
| 110 | + context: "Context", step_order: Optional[list] = None |
| 111 | +) -> "Workflow": |
| 112 | + """Generate the ScenarioMIP workflow.""" |
| 113 | + wf = Workflow(context) |
| 114 | + |
| 115 | + prev = wf.add_step("base", None) |
| 116 | + |
| 117 | + step_order = step_order or STEP_ORDER |
| 118 | + |
| 119 | + for i, func in enumerate(step_order, start=1): |
| 120 | + prev = wf.add_step(f"step_{i}", prev, func) |
| 121 | + |
| 122 | + # "all" is an alias for the last step, whatever it is |
| 123 | + wf.add("all", prev) |
| 124 | + |
| 125 | + return wf |
0 commit comments