Skip to content

Commit

Permalink
Remove workaround in MACRO.initialize()
Browse files Browse the repository at this point in the history
Fixed in iiasa/ixmp#500.
  • Loading branch information
khaeru committed Nov 17, 2023
1 parent f360dc7 commit 69a8875
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
11 changes: 2 additions & 9 deletions message_ix/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
from collections import ChainMap
from copy import copy, deepcopy
from copy import copy
from functools import lru_cache
from pathlib import Path
from warnings import warn
Expand Down Expand Up @@ -348,7 +348,6 @@ def run(self, scenario):
produce unexpected results.
"""
# Ensure the data in `scenario` is consistent with the MESSAGE formulation
# TODO move this call to ixmp.model.base.Model.run(); remove here
self.enforce(scenario)

# If two runs are kicked off simultaneously with the same self.model_dir, then
Expand Down Expand Up @@ -499,14 +498,8 @@ def initialize(cls, scenario, with_data=False):
# NB some scenarios already have these items. This method simply adds any
# missing items.

# FIXME the Java code under the JDBCBackend (ixmp_source) refuses to initialize
# these items with specified idx_sets—even if the sets are correct.
items = deepcopy(MACRO_ITEMS)
for name in "C", "COST_NODAL", "COST_NODAL_NET", "DEMAND", "GDP", "I":
items[name].pop("idx_sets")

# Initialize the ixmp items
cls.initialize_items(scenario, items)
cls.initialize_items(scenario, MACRO_ITEMS)


class MESSAGE_MACRO(MESSAGE, MACRO):
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ module = [
"dask.*",
"jpype",
"memory_profiler",
# TEMPORARY pending adjustment for iiasa/ixmp#500
"ixmp.reporting",
"ixmp.utils",
]
ignore_missing_imports = true

Expand Down

0 comments on commit 69a8875

Please sign in to comment.