Skip to content

Commit

Permalink
adding HAS_MESSAGE_DATA to call the legacy reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
adrivinca authored and glatterf42 committed Apr 2, 2024
1 parent 1db0a77 commit 462d569
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
2 changes: 0 additions & 2 deletions message_ix_models/model/water/data/water_supply.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,6 @@ def add_water_supply(context: "Context"):
.pipe(same_time)
)

# FIXME pd.DataFrames don't have append(), please choose another way!
# input data frame for slack technology balancing equality with demands
inp = pd.concat(
[
inp,
Expand Down
17 changes: 7 additions & 10 deletions message_ix_models/model/water/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,12 @@
import pyam
from message_ix import Reporter, Scenario

from message_ix_models.util import package_data_path
from message_ix_models.util import HAS_MESSAGE_DATA, package_data_path

# FIXME This is not how things are supposed to work! Your code always requires
# message_data to be present, which is not allowed in message-ix-models! If
# legacy_reporting truly remained None, your code would fail, as mypy already points
# out!
try:
if HAS_MESSAGE_DATA:
from message_data.tools.post_processing.iamc_report_hackathon import (
report as legacy_reporting,
)
except ImportError: # message_data not installed
legacy_reporting = None

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -1399,8 +1393,11 @@ def report_full(sc: Scenario, reg: str, sdgs=False):
log.info("Finished removing timeseries, now commit..")
sc.commit("Remove existing timeseries")

run_old_reporting(sc)
log.info("First part of reporting completed, now procede with the water variables")
if HAS_MESSAGE_DATA:
run_old_reporting(sc)
log.info(
"First part of reporting completed, now procede with the water variables"
)

report(sc, reg, sdgs)
log.info("overall NAVIGATE reporting completed")
Expand Down

0 comments on commit 462d569

Please sign in to comment.