diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 38b9cc072..ce5bf4ff8 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,13 +1,44 @@ + + + + **Required:** write a single sentence here describing the changes made by this PR. -(Optional: write a longer description here to help a reviewer understand the PR in 3–5 minutes.) + + +## How to review + +**Required:** describe specific things that reviewer(s) need to do to, in order +to ensure that the PR does what it intends. + + + +## PR checklist + + - [ ] Tests added. - [ ] Documentation added. -- [ ] Release notes updated. Add a single line at the top of `RELEASE_NOTES.md` similar to… - ``` - - [#999](https://github.com/iiasa/message_ix/pull/999) Description from above. - ``` - …then, delete this sentence to confirm you've understood the instructions. +- [ ] Release notes updated. + diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 9b41540ce..7e82c8224 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -13,16 +13,17 @@ Filing issues for bugs and enhancements We use Github **issues** for several purposes: -- Ask and answer questions about intended behaviour or issues running the framework or related models. -- Report bugs, i.e. unintended or undocumented behaviour. -- Request changes to behaviour. -- Request specific enhancements and new features, both urgent and long-term/low-priority. +- Ask and answer *questions* about intended behaviour or issues running the framework or related models. +- Report *bugs*, i.e. unintended or undocumented behaviour. +- Request *changes* to exiting behaviour. +- Request specific *enhancements* and *new features*, both urgent and long-term/low-priority. - Discuss and design of other improvements. -Please search through open *and* closed issues for *both* the `message_ix `_ and `ixmp `_ repositories. +Please search through open *and* closed issues for *both* the `message_ix`__ and `ixmp `_ repositories. Review any related issues. Then, if your issue is not found, `open a new one `_. +__ https://github.com/iiasa/message_ix/issues?q=is:issue Contributing code via Github PRs -------------------------------- @@ -34,18 +35,20 @@ Register a Github account, if you do not already have one. 1. Choose a repository ~~~~~~~~~~~~~~~~~~~~~~ -Decide: to which part of the |MESSAGEix| software stack should your code be added? +Decide which part of the |MESSAGEix| software stack is the appropriate location for your code: -``ixmp`` +:mod:`ixmp` Contributions not specific to |MESSAGEix| model framework, e.g. that could be used for other, non-MESSAGE models. -``message_ix`` + + :mod:`ixmp_source` + Java / JDBC backend for ``ixmp``. + +:mod:`message_ix` Contributions not specific to *any particular MESSAGEix* model instance. Additions to ``message_ix`` should be usable in any MESSAGE-scheme model. -``message_data`` or ``message_doc`` +:mod:`message_data` or :mod:`message_doc` Contributions to the MESSAGE-GLOBIOM family of models, including the global model; and its documentation, respectively. -``ixmp_source`` - Java / JDBC backend for ``ixmp``. 2. Fork, branch, and open a pull request ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -57,9 +60,11 @@ Create a branch with an appropriate name: - ``issue/1234`` if you are addressing a specific issue. - ``feature/do-something`` if you are adding a new feature. -Open a PR (e.g. on `message_ix `_) to merge your code into the ``master`` branch. +Open a PR (e.g. on `message_ix`__) to merge your code into the ``master`` branch. The ``message_ix`` and ``ixmp`` repositories each have a template for the text of the PR, including the minimum requirements: +__ https://github.com/iiasa/message_ix/pulls + - A title and one-sentence summary of the change. This is like the abstract of a publication: it should help a developer/reviewer/user quickly learn what the PR is about. - Confirm that unit or integration tests have been added or revised to cover the changed code, and that the tests pass (see below). @@ -69,9 +74,11 @@ The ``message_ix`` and ``ixmp`` repositories each have a template for the text o Optionally: - Include a longer description of the design, or any changes whose purpose is not clear by inspecting code. -- Put “WIP:” at the start of the PR title to indicate “work in progress” while you continue to add commits. +- Put “WIP:” or the construction sign Unicode character (🚧) at the start of the PR title to indicate “work in progress” while you continue to add commits; or use GitHub's `'draft' pull requests`__. This is good development practice: it ensures the automatic checks pass as you add to the code on your branch. +__ https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests#draft-pull-requests + 3. Ensure checks pass ~~~~~~~~~~~~~~~~~~~~~ @@ -125,7 +132,7 @@ Versions and releases --------------------- - We use `semantic versioning `_. -- We keep at least two active milestones on each of the ``message_ix`` and ``ixmp`` repositories: +- We keep at least two active milestones on each of the message_ix and ixmp repositories: - The next minor version. E.g. if the latest release was 3.5, the next minor release/milestone is 3.6. - The next major version. E.g. 4.0. @@ -142,9 +149,9 @@ Contributing tutorials ---------------------- Developers *and users* of the |MESSAGEix| framework are welcome to contribute **tutorials**, according to the following guidelines. -Per the license and CLA, tutorials will become part of the ``message_ix`` test suite and will be publicly available. +Per the license and CLA, tutorials will become part of the message_ix test suite and will be publicly available. -Developers **must** ensure new features (including ``message_ix.tools`` submodules) are fully documented. +Developers **must** ensure new features (including :mod:`message_ix.tools` submodules) are fully documented. This can be done via the API documentation (this site) and, optionally, a tutorial. These have complementary purposes: diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md deleted file mode 100644 index 9bcd53798..000000000 --- a/RELEASE_NOTES.md +++ /dev/null @@ -1,175 +0,0 @@ - -# Next Release - -## Migrating - -**Support for Python 2.7 is dropped** as it has reached end-of-life, meaning no further releases will be made even to fix bugs. -See [PEP-0373](https://legacy.python.org/dev/peps/pep-0373/) and https://python3statement.org. -``message_ix`` users must upgrade to Python 3. - -**Command-line interface (CLI).** Use `message-ix` as the program for all command-line operations: -- `message-ix copy-model` replaces `messageix-config`. -- `message-ix dl` replaces `messageix-dl`. -- `message-ix` also provides all the features of the :mod:`ixmp` CLI. - -## All changes - -- [#285](https://github.com/iiasa/message_ix/pull/285): Drop support for Python 2. -- [#284](https://github.com/iiasa/message_ix/pull/284): Add a suggested sequence/structure to how to run the Westeros tutorials. -- [#281](https://github.com/iiasa/message_ix/pull/281): Test and improve logic of `years_active` and `vintage_and_active_years`. -- [#269](https://github.com/iiasa/message_ix/pull/269): Enforce 'year'-indexed columns as integers. -- [#256](https://github.com/iiasa/message_ix/pull/256): Update to use :obj:`ixmp.config` and improve CLI. -- [#255](https://github.com/iiasa/message_ix/pull/249): Add :mod:`message_ix.testing.nightly` and `nightly` CLI command group for slow-running tests. -- [#249](https://github.com/iiasa/message_ix/pull/249), - [#259](https://github.com/iiasa/message_ix/pull/259): Build MESSAGE and MESSAGE_MACRO classes on ixmp model API; adjust Scenario. -- [#235](https://github.com/iiasa/message_ix/pull/236): Add a reporting tutorial. -- [#236](https://github.com/iiasa/message_ix/pull/236), - [#242](https://github.com/iiasa/message_ix/pull/242), - [#263](https://github.com/iiasa/message_ix/pull/263): Enhance reporting. -- [#232](https://github.com/iiasa/message_ix/pull/232): Add Westeros tutorial for modelling seasonality, update existing tutorials. -- [#276](https://github.com/iiasa/message_ix/pull/276): Improving add_year for bounds and code cleanup -# v1.2.0 - -MESSAGEix 1.2.0 adds an option to set the commodity balance to strict equality, -rather than a supply > demand inequality. It also improves the support for -models with non-equidistant years. - -Other improvements include an experimental reporting module, support for CPLEX -solver options via `Scenario.solve()`, and a reusable `message_ix.testing` -module. - -Release 1.2.0 coincides with ixmp -[release 0.2.0](https://github.com/iiasa/ixmp/releases/tag/v0.2.0), which -provides full support for `Scenario.clone()` across platforms (database -instances), e.g. from a remote database to a local HSQL database; as well as -other improvements. See the ixmp release notes for further details. - -## All changes - -- [#161](https://github.com/iiasa/message_ix/pull/161): A feature for adding new periods to a scenario. -- [#205](https://github.com/iiasa/message_ix/pull/205): Implement required changes related to timeseries-support and cloning across platforms (see [ixmp:#142](https://github.com/iiasa/ixmp/pull/142)). -- [#196](https://github.com/iiasa/message_ix/pull/196): Improve testing by re-using :mod:`ixmp` apparatus. -- [#187](https://github.com/iiasa/message_ix/pull/187): Test for cumulative bound on emissions. -- [#182](https://github.com/iiasa/message_ix/pull/182): Fix cross-platform cloning. -- [#178](https://github.com/iiasa/message_ix/pull/178): Bugfix of the `PRICE_EMISSION` variable in models with non-equidistant period durations (#167)._ -- [#176](https://github.com/iiasa/message_ix/pull/176): Add `message_ix.reporting` module. -- [#173](https://github.com/iiasa/message_ix/pull/173): The `solve` command now takes additional arguments when solving with CPLEX. The `cplex.opt` file is now generated on the fly during the solve command and removed after successfully solving. -- [#172](https://github.com/iiasa/message_ix/pull/172): Add option to set `COMMODITY_BALANCE` to equality. -- [#154](https://github.com/iiasa/message_ix/pull/154): Enable documentation build on ReadTheDocs. -- [#138](https://github.com/iiasa/message_ix/pull/138): Update documentation and tutorials. -- [#131](https://github.com/iiasa/message_ix/pull/131): Update clone function argument `scen` to `scenario` with planned deprecation of the former. - - -# v1.1.0 - -## Warnings - -This patch introduces a few backwards-incompatible changes to database -management. - -### Database Migration - -If you see an error message like: - -``` -_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ -usr/local/lib/python2.7/site-packages/ixmp/core.py:81: in __init__ - self._jobj = java.ixmp.Platform("Python", dbprops) -_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - -self = -args = ('Python', '/tmp/kH07wz/test.properties') - - def _javaInit(self, *args): - object.__init__(self) - - if len(args) == 1 and isinstance(args[0], tuple) \ - and args[0][0] is _SPECIAL_CONSTRUCTOR_KEY: - self.__javaobject__ = args[0][1] - else: - self.__javaobject__ = self.__class__.__javaclass__.newClassInstance( -> *args) -E org.flywaydb.core.api.FlywayExceptionPyRaisable: org.flywaydb.core.api.FlywayException: Validate failed: Migration checksum mismatch for migration 1 -E -> Applied to database : 1588531206 -E -> Resolved locally : 822227094 -``` - -Then you need to update your local database. There are two methods to do so: - -1. Delete it (you will lose all data and need to regenerate it). The default - location is `~/.local/ixmp/localdb/`. -2. Manually apply the underlying migrations. This is not particularly easy, but - allows you to save all your data. If you want help, feel free to get in - contact on the - [listserv](https://groups.google.com/forum/#!forum/message_ix). - - -### New Property File Layout - -If you see an error message like: - -``` -usr/local/lib/python2.7/site-packages/jpype/_jclass.py:111: at.ac.iiasa.ixmp.exceptions.IxExceptionPyRaisable ----------------------------- Captured stdout setup ----------------------------- -2018-11-13 08:15:17,410 ERROR at.ac.iiasa.ixmp.database.DbConfig:357 - missing property 'config.server.config' in /tmp/hhvE1o/test.properties -2018-11-13 08:15:17,412 ERROR at.ac.iiasa.ixmp.database.DbConfig:357 - missing property 'config.server.password' in /tmp/hhvE1o/test.properties -2018-11-13 08:15:17,412 ERROR at.ac.iiasa.ixmp.database.DbConfig:357 - missing property 'config.server.username' in /tmp/hhvE1o/test.properties -2018-11-13 08:15:17,413 ERROR at.ac.iiasa.ixmp.database.DbConfig:357 - missing property 'config.server.url' in /tmp/hhvE1o/test.properties ------------------------------- Captured log setup ------------------------------ -core.py 80 INFO launching ixmp.Platform using config file at '/tmp/hhvE1o/test.properties' -_________________ ERROR at setup of test_add_spatial_multiple __________________ - - @pytest.fixture(scope="session") - def test_mp(): - test_props = create_local_testdb() - - # start jvm - ixmp.start_jvm() - - # launch Platform and connect to testdb (reconnect if closed) -> mp = ixmp.Platform(test_props) -``` - -Then you need to update your property configuration file. The old file looks like - -``` -config.name = message_ix_test_db@local -jdbc.driver.1 = org.hsqldb.jdbcDriver -jdbc.url.1 = jdbc:hsqldb:file:/path/to/database -jdbc.user.1 = ixmp -jdbc.pwd.1 = ixmp -jdbc.driver.2 = org.hsqldb.jdbcDriver -jdbc.url.2 = jdbc:hsqldb:file:/path/to/database -jdbc.user.2 = ixmp -jdbc.pwd.2 = ixmp -``` - -The new file should look like - -``` -config.name = message_ix_test_db@local -jdbc.driver = org.hsqldb.jdbcDriver -jdbc.url = jdbc:hsqldb:file:/path/to/database -jdbc.user = ixmp -jdbc.pwd = ixmp -``` - -## Updates - -- [#202](https://github.com/iiasa/message_ix/pull/202): Added the "Development rule of thumb" section from the wiki and the Tutorial style guide to the Contributor guidelines. Tweaked some formatting to improve readibility -- [#113](https://github.com/iiasa/message_ix/pull/113): Upgrading to MESSAGEix 1.1: improved representation of renewables, share constraints, etc. -- [#109](https://github.com/iiasa/message_ix/pull/109): MACRO module added for initializing models to be solved with MACRO. Added scenario-based CI on circleci. -- [#99](https://github.com/iiasa/message_ix/pull/99): Fixing an error in the compuation of the auxiliary GAMS reporting variable `PRICE_EMISSION` -- [#89](https://github.com/iiasa/message_ix/pull/89): Fully implementing system reliability and flexibity considerations (cf. Sullivan) -- [#88](https://github.com/iiasa/message_ix/pull/88): Reformulated capacity maintainance constraint to ensure that newly installed capacity cannot be decommissioned within the same model period as it is built in -- [#84](https://github.com/iiasa/message_ix/pull/84): `message_ix.Scenariovintage_active_years()` now limits active years to those after the first model year or the years of a certain technology vintage -- [#82](https://github.com/iiasa/message_ix/pull/82): Introducing "add-on technologies" for mitigation options, etc. -- [#81](https://github.com/iiasa/message_ix/pull/81): Share constraints by mode added. -- [#80](https://github.com/iiasa/message_ix/pull/80): Share constraints by commodity/level added. -- [#78](https://github.com/iiasa/message_ix/pull/78): Bugfix: `message_ix.Scenario.solve()` uses 'MESSAGE' by default, but can be provided other model names -- [#77](https://github.com/iiasa/message_ix/pull/77): `rename()` function can optionally keep old values in the model (i.e., copy vs. copy-with-replace) -- [#74](https://github.com/iiasa/message_ix/pull/74): Activity upper and lower bounds can now be applied to all modes of a technology -- [#67](https://github.com/iiasa/message_ix/pull/67): Use of advanced basis in cplex.opt turned off by default to avoid conflicts with barrier method. -- [#65](https://github.com/iiasa/message_ix/pull/65): Bugfix for downloading tutorials. Now downloads current installed version by default. -- [#60](https://github.com/iiasa/message_ix/pull/60): Add basic ability to write and read model input to/from Excel -- [#59](https://github.com/iiasa/message_ix/pull/59): Added MacOSX CI support diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst new file mode 100644 index 000000000..34afeae16 --- /dev/null +++ b/RELEASE_NOTES.rst @@ -0,0 +1,183 @@ + +v2.0.0 (2020-01-14) +=================== + +message_ix v2.0.0 coincides with ixmp v2.0.0. + +Migration notes +--------------- + +Support for **Python 2.7 is dropped** as it has reached end-of-life, meaning no further releases will be made even to fix bugs. +See `PEP-0373 `_ and https://python3statement.org. +``message_ix`` users must upgrade to Python 3. + +**Command-line interface (CLI).** Use ``message-ix`` as the program for all command-line operations: + +- ``message-ix copy-model`` replaces ``messageix-config``. +- ``message-ix dl`` replaces ``messageix-dl``. +- ``message-ix`` also provides all the features of the :mod:`ixmp` CLI. + +**Configuration.** ixmp adds a streamlined system for storing information about different platforms, backends, and databases that store Scenario data. +See the :doc:`ixmp release notes ` for migration notes. + +All changes +----------- + +- `#285 `_: Drop support for Python 2. +- `#284 `_: Add a suggested sequence/structure to how to run the Westeros tutorials. +- `#281 `_: Test and improve logic of :meth:`.years_active` and :meth:`.vintage_and_active_years`. +- `#269 `_: Enforce ``year``-indexed columns as integers. +- `#256 `_: Update to use :obj:`ixmp.config` and improve CLI. +- `#255 `_: Add :mod:`message_ix.testing.nightly` and ``message-ix nightly`` CLI command group for slow-running tests. +- `#249 `_, + `#259 `_: Build MESSAGE and MESSAGE_MACRO classes on ixmp model API; adjust Scenario. +- `#235 `_: Add a reporting tutorial. +- `#236 `_, + `#242 `_, + `#263 `_: Enhance reporting. +- `#232 `_: Add Westeros tutorial for modelling seasonality, update existing tutorials. +- `#276 `_: Improve add_year for bounds and code cleanup + + +v1.2.0 (2019-06-25) +=================== + +MESSAGEix 1.2.0 adds an option to set the commodity balance to strict equality, +rather than a supply > demand inequality. It also improves the support for +models with non-equidistant years. + +Other improvements include an experimental reporting module, support for CPLEX +solver options via :meth:`~.Scenario.solve`, and a reusable :mod:`message_ix.testing` +module. + +Release 1.2.0 coincides with ixmp +`release 0.2.0 `_, which +provides full support for :meth:`~.Scenario.clone` across platforms (database +instances), e.g. from a remote database to a local HSQL database; as well as +other improvements. See the ixmp release notes for further details. + +All changes +----------- + +- `#161 `_: A feature for adding new periods to a scenario. +- `#205 `_: Implement required changes related to timeseries-support and cloning across platforms (see `ixmp#142 `_). +- `#196 `_: Improve testing by re-using :mod:`ixmp` apparatus. +- `#187 `_: Test for cumulative bound on emissions. +- `#182 `_: Fix cross-platform cloning. +- `#178 `_: Bugfix of the ``PRICE_EMISSION`` variable in models with non-equidistant period durations. +- `#176 `_: Add :mod:`message_ix.reporting` module. +- `#173 `_: The meth:`~.Scenario.solve` command now takes additional arguments when solving with CPLEX. The cplex.opt file is now generated on the fly during the solve command and removed after successfully solving. +- `#172 `_: Add option to set ``COMMODITY_BALANCE`` to equality. +- `#154 `_: Enable documentation build on ReadTheDocs. +- `#138 `_: Update documentation and tutorials. +- `#131 `_: Update clone function argument `scen` to `scenario` with planned deprecation of the former. + + +v1.1.0 (2018-11-21) +=================== + +Migration notes +--------------- + +This patch introduces a few backwards-incompatible changes to database management. + +Database Migration +~~~~~~~~~~~~~~~~~~ + +If you see an error message like:: + + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + usr/local/lib/python2.7/site-packages/ixmp/core.py:81: in __init__ + self._jobj = java.ixmp.Platform("Python", dbprops) + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + + self = + args = ('Python', '/tmp/kH07wz/test.properties') + + def _javaInit(self, *args): + object.__init__(self) + + if len(args) == 1 and isinstance(args[0], tuple) \ + and args[0][0] is _SPECIAL_CONSTRUCTOR_KEY: + self.__javaobject__ = args[0][1] + else: + self.__javaobject__ = self.__class__.__javaclass__.newClassInstance( + > *args) + E org.flywaydb.core.api.FlywayExceptionPyRaisable: org.flywaydb.core.api.FlywayException: Validate failed: Migration checksum mismatch for migration 1 + E -> Applied to database : 1588531206 + E -> Resolved locally : 822227094 + +Then you need to update your local database. There are two methods to do so: + +1. Delete it (you will lose all data and need to regenerate it). The default + location is ~/.local/ixmp/localdb/. +2. Manually apply the underlying migrations. This is not particularly easy, but + allows you to save all your data. If you want help, feel free to get in + contact on the + `listserv `_. + +New Property File Layout +~~~~~~~~~~~~~~~~~~~~~~~~ + +If you see an error message like:: + + usr/local/lib/python2.7/site-packages/jpype/_jclass.py:111: at.ac.iiasa.ixmp.exceptions.IxExceptionPyRaisable + ---------------------------- Captured stdout setup ----------------------------- + 2018-11-13 08:15:17,410 ERROR at.ac.iiasa.ixmp.database.DbConfig:357 - missing property 'config.server.config' in /tmp/hhvE1o/test.properties + 2018-11-13 08:15:17,412 ERROR at.ac.iiasa.ixmp.database.DbConfig:357 - missing property 'config.server.password' in /tmp/hhvE1o/test.properties + 2018-11-13 08:15:17,412 ERROR at.ac.iiasa.ixmp.database.DbConfig:357 - missing property 'config.server.username' in /tmp/hhvE1o/test.properties + 2018-11-13 08:15:17,413 ERROR at.ac.iiasa.ixmp.database.DbConfig:357 - missing property 'config.server.url' in /tmp/hhvE1o/test.properties + ------------------------------ Captured log setup ------------------------------ + core.py 80 INFO launching ixmp.Platform using config file at '/tmp/hhvE1o/test.properties' + _________________ ERROR at setup of test_add_spatial_multiple __________________ + + @pytest.fixture(scope="session") + def test_mp(): + test_props = create_local_testdb() + + # start jvm + ixmp.start_jvm() + + # launch Platform and connect to testdb (reconnect if closed) + > mp = ixmp.Platform(test_props) + +Then you need to update your property configuration file. The old file looks like:: + + config.name = message_ix_test_db@local + jdbc.driver.1 = org.hsqldb.jdbcDriver + jdbc.url.1 = jdbc:hsqldb:file:/path/to/database + jdbc.user.1 = ixmp + jdbc.pwd.1 = ixmp + jdbc.driver.2 = org.hsqldb.jdbcDriver + jdbc.url.2 = jdbc:hsqldb:file:/path/to/database + jdbc.user.2 = ixmp + jdbc.pwd.2 = ixmp + +The new file should look like:: + + config.name = message_ix_test_db@local + jdbc.driver = org.hsqldb.jdbcDriver + jdbc.url = jdbc:hsqldb:file:/path/to/database + jdbc.user = ixmp + jdbc.pwd = ixmp + +All changes +----------- + +- `#202 `_: Added the "Development rule of thumb" section from the wiki and the Tutorial style guide to the Contributor guidelines. Tweaked some formatting to improve readibility. +- `#113 `_: Upgrading to MESSAGEix 1.1: improved representation of renewables, share constraints, etc. +- `#109 `_: MACRO module added for initializing models to be solved with MACRO. Added scenario-based CI on circleci. +- `#99 `_: Fixing an error in the compuation of the auxiliary GAMS reporting variable ``PRICE_EMISSION``. +- `#89 `_: Fully implementing system reliability and flexibity considerations (cf. Sullivan). +- `#88 `_: Reformulated capacity maintainance constraint to ensure that newly installed capacity cannot be decommissioned within the same model period as it is built in. +- `#84 `_: ``message_ix.Scenario.vintage_active_years()`` now limits active years to those after the first model year or the years of a certain technology vintage. +- `#82 `_: Introducing "add-on technologies" for mitigation options, etc. +- `#81 `_: Share constraints by mode added. +- `#80 `_: Share constraints by commodity/level added. +- `#78 `_: Bugfix: ``message_ix.Scenario.solve()`` uses 'MESSAGE' by default, but can be provided other model names. +- `#77 `_: ``rename()`` function can optionally keep old values in the model (i.e., copy vs. copy-with-replace). +- `#74 `_: Activity upper and lower bounds can now be applied to all modes of a technology. +- `#67 `_: Use of advanced basis in cplex.opt turned off by default to avoid conflicts with barrier method. +- `#65 `_: Bugfix for downloading tutorials. Now downloads current installed version by default. +- `#60 `_: Add basic ability to write and read model input to/from Excel. +- `#59 `_: Added MacOSX CI support. diff --git a/doc/source/index.rst b/doc/source/index.rst index 4ee1f39a2..c20bca63d 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -65,6 +65,7 @@ Anyone is encouraged to use the framework to develop energy system and integrate .. toctree:: :maxdepth: 1 + whatsnew notice contributing diff --git a/doc/source/reporting.rst b/doc/source/reporting.rst index 7cd7b32dc..d05aba87a 100644 --- a/doc/source/reporting.rst +++ b/doc/source/reporting.rst @@ -3,9 +3,8 @@ Postprocessing and reporting .. warning:: - :mod:`message_ix.reporting` is **experimental** in message_ix 1.2 and only - supports Python 3. The API and functionality may change without advance - notice or a deprecation period in subsequent releases. + :mod:`message_ix.reporting` is **experimental** in message_ix 2.0. + The API and functionality may change without advance notice or a deprecation period in subsequent releases. The |ixmp| provides powerful features to perform calculations and other postprocessing after a :class:`message_ix.Scenario` has been solved by the associated model. The |MESSAGEix| framework uses these features to provide zero-configuration reporting of models built on the framework. diff --git a/doc/source/whatsnew.rst b/doc/source/whatsnew.rst new file mode 100644 index 000000000..0ad76d891 --- /dev/null +++ b/doc/source/whatsnew.rst @@ -0,0 +1,4 @@ +What's New +********** + +.. include:: ../../RELEASE_NOTES.rst diff --git a/message_ix/core.py b/message_ix/core.py index 751808cd4..25fcace3b 100755 --- a/message_ix/core.py +++ b/message_ix/core.py @@ -387,7 +387,7 @@ def clone(self, *args, **kwargs): ---------- keep_solution : bool, optional If :py:const:`True`, include all timeseries data and the solution - (vars and equs) from the source scenario in the clone. + (vars and equs) from the source Scenario in the clone. Otherwise, only timeseries data marked as `meta=True` (see :meth:`TimeSeries.add_timeseries`) or prior to `first_model_year` (see :meth:`TimeSeries.add_timeseries`) are cloned. diff --git a/message_ix/model/version.gms b/message_ix/model/version.gms index 08b1af30e..6e986928e 100644 --- a/message_ix/model/version.gms +++ b/message_ix/model/version.gms @@ -9,8 +9,8 @@ * or by updating the `message_ix` package * using `conda update -c conda-forge message-ix`. -$SETGLOBAL VERSION_MAJOR "1" -$SETGLOBAL VERSION_MINOR "2" +$SETGLOBAL VERSION_MAJOR "2" +$SETGLOBAL VERSION_MINOR "0" $SETGLOBAL VERSION_PATCH "0" * This file is imported by `message_ix/__init__.py`. diff --git a/tests/test_cli.py b/tests/test_cli.py index e5a12843d..9bad4df47 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -28,7 +28,15 @@ def test_copy_model(message_ix_cli, tmp_path, tmp_env): assert config.get('message model dir') == tmp_path -@pytest.mark.parametrize('opts', ['', '--branch=master', '--tag=1.2.0']) +@pytest.mark.parametrize('opts', [ + # During release prep, 'dl' will try to download e.g. v2.0.0, which does + # not yet exist; so the test fails. Use this line: + pytest.param('', marks=pytest.mark.xfail), + # Otherwise (normal state on master), use this line: + # '', + '--branch=master', + '--tag=1.2.0', +]) def test_dl(message_ix_cli, opts, tmp_path): r = message_ix_cli('dl', opts, str(tmp_path)) if r.exit_code != 0: diff --git a/tutorial/Austrian_energy_system/austria.ipynb b/tutorial/Austrian_energy_system/austria.ipynb index 48328dce1..6dd966ff9 100644 --- a/tutorial/Austrian_energy_system/austria.ipynb +++ b/tutorial/Austrian_energy_system/austria.ipynb @@ -187,9 +187,7 @@ "metadata": {}, "outputs": [], "source": [ - "rate = [0.05] * len(horizon)\n", - "unit = ['-'] * len(horizon)\n", - "scenario.add_par(\"interestrate\", key=horizon, val=rate, unit=unit)" + "scenario.add_par(\"interestrate\", horizon, value=0.05, unit='-')" ] }, { diff --git a/tutorial/Austrian_energy_system/austria_multiple_policies-answers.ipynb b/tutorial/Austrian_energy_system/austria_multiple_policies-answers.ipynb index 27f88175a..6f29eeded 100644 --- a/tutorial/Austrian_energy_system/austria_multiple_policies-answers.ipynb +++ b/tutorial/Austrian_energy_system/austria_multiple_policies-answers.ipynb @@ -317,7 +317,7 @@ "new_scen = 'interest_rate_.1'\n", "\n", "with make_scenario(mp, country, name, base_scen, new_scen) as scenario:\n", - " scenario.add_par(\"interestrate\", key=horizon, val=[.1] * len(horizon), unit=['%'] * len(horizon))" + " scenario.add_par(\"interestrate\", horizon, value=.1, unit='%')" ] }, { diff --git a/tutorial/Austrian_energy_system/austria_reticulate.ipynb b/tutorial/Austrian_energy_system/austria_reticulate.ipynb index fa63c562f..3c8ccaed4 100644 --- a/tutorial/Austrian_energy_system/austria_reticulate.ipynb +++ b/tutorial/Austrian_energy_system/austria_reticulate.ipynb @@ -199,9 +199,7 @@ }, "outputs": [], "source": [ - "rate = as.numeric(rep(0.05 , length(horizon) ))\n", - "unit = rep('%' , length(horizon) )\n", - "scenario$add_par(\"interestrate\", key=horizon, val=rate, unit=unit)" + "scenario$add_par(\"interestrate\", horizon, value=0.05, unit='%')" ] }, { diff --git a/tutorial/README.rst b/tutorial/README.rst index 09756a089..214fe73a6 100644 --- a/tutorial/README.rst +++ b/tutorial/README.rst @@ -69,23 +69,23 @@ Westeros Electrified This tutorial demonstrates how to model a very simple energy system, and then uses it to illustrate a range of framework features. -#. `Build the baseline model `_ (``westeros_baseline.ipynb``). +#. `Build the baseline model `_ (``westeros_baseline.ipynb``). #. Add extra detail and constraints to the model #. Emissions - #. `Introduce emissions `_ and a bound on the emissions (`westeros_emissions_bounds.ipynb`). + #. `Introduce emissions `_ and a bound on the emissions (`westeros_emissions_bounds.ipynb`). - #. `Introducing taxes on emissions `_ (`westeros_emissions_taxes.ipynb`). + #. `Introducing taxes on emissions `_ (`westeros_emissions_taxes.ipynb`). - #. `Represent both coal and wind electricity `_, using a “firm capacity” formulation: each generation technology can supply some firm capacity, but the variable, renewable technology (wind) supplies less than coal (``westeros_firm_capacity.ipynb``). + #. `Represent both coal and wind electricity `_, using a “firm capacity” formulation: each generation technology can supply some firm capacity, but the variable, renewable technology (wind) supplies less than coal (``westeros_firm_capacity.ipynb``). - #. Represent coal and wind electricity using a different, `“flexibility requirement” formulation `_, wherein wind *requires* and coal *supplies* flexibility (``westeros_flexible_generation.ipynb``). + #. Represent coal and wind electricity using a different, `“flexibility requirement” formulation `_, wherein wind *requires* and coal *supplies* flexibility (``westeros_flexible_generation.ipynb``). - #. `Variablity in energy supply and demand `_, by adding sub-annual time steps - winter and summer (``westeros_seasonality.ipynb``). + #. `Variablity in energy supply and demand `_, by adding sub-annual time steps - winter and summer (``westeros_seasonality.ipynb``). -#. Post-processing: `learn how to use ixmp and message_ix reporting features _after_ the MESSAGE model has run `_ (``westeros_report.ipynb``). +#. Post-processing: `learn how to use ixmp and message_ix reporting features _after_ the MESSAGE model has run `_ (``westeros_report.ipynb``). Austrian energy system ---------------------- @@ -93,7 +93,7 @@ Austrian energy system This tutorial demonstrates a stylized representation of a national electricity sector model, with several fossil and renewable power plant types. -#. Prepare the base model version, in `Python `__ or in `R `__. -#. Plot results, in `Python `__ or in `R `__. -#. `Run a single policy scenario `_. -#. Run multiple policy scenarios. This tutorial has two notebooks: `an introduction with some exercises `_ and `completed code for the exercises `_. +#. Prepare the base model version, in `Python `__ or in `R `__. +#. Plot results, in `Python `__ or in `R `__. +#. `Run a single policy scenario `_. +#. Run multiple policy scenarios. This tutorial has two notebooks: `an introduction with some exercises `_ and `completed code for the exercises `_. diff --git a/tutorial/westeros/westeros_baseline.ipynb b/tutorial/westeros/westeros_baseline.ipynb index ed2025d3a..c898c7b5f 100644 --- a/tutorial/westeros/westeros_baseline.ipynb +++ b/tutorial/westeros/westeros_baseline.ipynb @@ -969,9 +969,7 @@ }, "outputs": [], "source": [ - "rate = [0.05] * len(model_horizon)\n", - "unit = ['-'] * len(model_horizon)\n", - "scenario.add_par(\"interestrate\", key=model_horizon, val=rate, unit=unit)" + "scenario.add_par(\"interestrate\", model_horizon, value=0.05, unit='-')" ] }, { diff --git a/tutorial/westeros/westeros_emissions_bounds.ipynb b/tutorial/westeros/westeros_emissions_bounds.ipynb index a5b0b8743..58aa5ffd3 100644 --- a/tutorial/westeros/westeros_emissions_bounds.ipynb +++ b/tutorial/westeros/westeros_emissions_bounds.ipynb @@ -112,8 +112,8 @@ "metadata": {}, "outputs": [], "source": [ - "scen.add_par('bound_emission', key=[country, 'GHG', 'all', 'cumulative'],\n", - " val=500., unit='MtCO2')" + "scen.add_par('bound_emission', [country, 'GHG', 'all', 'cumulative'],\n", + " value=500., unit='MtCO2')" ] }, {