Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable populate_test_platform() with IXMP4Backend #560

Open
wants to merge 4 commits into
base: enh/ixmp4-gams-io
Choose a base branch
from

Conversation

glatterf42
Copy link
Member

This PR adds a little more functionality to the IXMP4Backend, which is enough to make populate_test_platform() pass. In turn, this includes make_dantzig(solve=True), so this feels like quite a significant milestone. Enough, at least, to now turn to message_ix and see if I can't get westeros_baseline to run. After all, everything making that more fancy than the transport tutorial should be handled in message_ix, I think.

One item deserves special attention, maybe: the JDBCBackend has certain units pre-defined, it seems. For make_dantzig(), I've included a check for now: when we're on an IXMP4Backend, we quickly add the required units. However, this only covers this one test function and we probably want to come up with a solution that covers all cases. Which likely means:

  1. Figure out which units are pre-defined
  2. Set up a check in Platform.__init__() that defines all these units on an IXMP4Backend

How to review

  • Read the diff and note that the CI checks all pass.

PR checklist

  • Continuous integration checks all ✅
  • Add or expand tests; coverage checks both ✅
  • Add, expand, or update documentation.
  • Update release notes.

@glatterf42 glatterf42 added the enh New features & functionality label Mar 3, 2025
@glatterf42 glatterf42 requested a review from khaeru March 3, 2025 11:43
@glatterf42 glatterf42 self-assigned this Mar 3, 2025
@glatterf42 glatterf42 changed the base branch from main to enh/ixmp4-gams-io March 3, 2025 11:43
platform_dest,
model,
scenario,
version=cloned_run.version,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this result in the clone having the same version number as the original?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It only means that the cloned Scenario object has the same version as the cloned Run object. I'm not sure how ixmp4 handles/changes versions upon cloning, but there was some test that failed with the previous version of the code because the version of the cloned Scenario object was set incorrectly (not to the version of the cloned Run).

@khaeru
Copy link
Member

khaeru commented Mar 3, 2025

Great progress 🚀

The JDBCBackend has certain units pre-defined, it seems. For make_dantzig(), I've included a check for now: when we're on an IXMP4Backend, we quickly add the required units. However, this only covers this one test function and we probably want to come up with a solution that covers all cases. Which likely means:

  1. Figure out which units are pre-defined
  2. Set up a check in Platform.__init__() that defines all these units on an IXMP4Backend

Yes, agreed this is the right approach. We can imagine a migration/deprecation path:

  1. For now, silently and always add these to any Platform on an IXMP4Backend.
  2. Later, code can notice when users try add data with these unit-strings to an IXMP4Backend-backed platform; make a noisy warning; and then automatically populate the units; but otherwise not do so.
  3. Later than (2), the auto-population can be dropped, and it becomes the responsibility of user code (e.g. message-ix-models) to populate the units it intends to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enh New features & functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants