Skip to content

Commit f580412

Browse files
authored
Merge pull request #423 from iiasa/doc/2025-w38
Consolidate docs contents from message_data
2 parents 937c49a + 14fb241 commit f580412

File tree

17 files changed

+881
-126
lines changed

17 files changed

+881
-126
lines changed

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def local_inv(name: str, *parts: str) -> Optional[str]:
211211
"m-data": (
212212
f"https://{_token}:@docs.messageix.org/projects/models-internal/en/latest/",
213213
# Use a local copy of objects.inv, if the user has one
214-
(local_inv("message_data"), None),
214+
local_inv("message_data"),
215215
),
216216
"pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),
217217
"pint": ("https://pint.readthedocs.io/en/stable/", None),

doc/develop.rst

Lines changed: 199 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ In the following, the bold-face words **required**, **optional**, etc. have spec
88
On other pages:
99

1010
- :doc:`message-ix:contributing` in the MESSAGEix docs.
11-
*All* of these apply to contributions to :mod:`message_ix_models` and :mod:`message_data`, including the :ref:`message-ix:code-style`.
12-
- :doc:`data`, for how to add and handle these.
11+
*All* of these apply to contributions to :mod:`message_ix_models`
12+
and :mod:`message_data`,
13+
in particular the :ref:`message-ix:code-style`.
14+
- :doc:`howto/index` including detailed guides for some development tasks.
15+
- :doc:`data` that explains types of data and how they are handled.
1316

1417
On this page:
1518

@@ -83,6 +86,171 @@ For :mod:`message_ix_models`, we use this to designate people who are capable an
8386

8487
- If code owners depart IIASA or are reassigned to other work, they or the :mod:`message_ix_models` maintainers **must** initiate a discussion to identify a new set of owners for their files.
8588

89+
Organization
90+
============
91+
92+
This section describes the organization or layout
93+
of the :mod:`message_ix_models` repository and Python package.
94+
The organization of :mod:`message_data` is roughly similar,
95+
with some differences as noted below.
96+
(See also :doc:`howto/migrate`
97+
for the relationship between this repo and :mod:`message_data`.)
98+
99+
.. _repo-org:
100+
101+
Repository
102+
----------
103+
104+
:file:`message_ix_models/`
105+
(or :file:`message_data/`)
106+
107+
This directory contains a Python package,
108+
thus *code* that creates or manipulates MESSAGE Scenarios,
109+
or handles data for these tasks.
110+
See :ref:`code-org` below.
111+
112+
:file:`message_ix_models/data/`
113+
This directory contains :doc:`data`,
114+
in particular metadata and input data used by code.
115+
No code is kept in this directory;
116+
code **must not** be added.
117+
Code **should not** write output data (for example, reporting output)
118+
to this directory.
119+
120+
Some of these files are packaged with the :mod:`message_ix_models` package
121+
that is published on PyPI,
122+
thus are available to any user who installs the package from this source.
123+
124+
In :mod:`message_data`,
125+
a directory :file:`data/` at the *top level* is used instead.
126+
Similarly, code cannot be kept in this directory;
127+
only code under :file:`message_data/` can be imported
128+
using :py:`from message_data.submodule.name import x, y, z`.
129+
130+
:file:`doc/`
131+
The source reStructuredText files for this **documentation**,
132+
and Sphinx configuration (:file:`doc/conf.py`) to build it.
133+
134+
:file:`reference/`
135+
(:mod:`message_data` only)
136+
137+
Static files not used *or* produced by the code,
138+
but provided for reference as a supplement to the documentation.
139+
140+
.. _code-org:
141+
142+
Code
143+
----
144+
145+
The code is organized into submodules.
146+
The following high-level overview
147+
explains how the organization relates to MESSAGEix-GLOBIOM modeling workflows.
148+
Some general-purpose modules, classes, and functions are not mentioned;
149+
for these, see the table of contents.
150+
See also :ref:`modindex` for an auto-generated list of all modules.
151+
152+
Models (:mod:`message_ix_model.model`)
153+
**Code that creates models or model variants.**
154+
MESSAGEix-GLOBIOM is a *family* of models
155+
in which the “reference energy system”
156+
(RES; with specific sets and populated parameter values)
157+
is similar, yet not identical.
158+
Many models in the family are defined as *derivatives* of other models.
159+
160+
For example: :mod:`message_ix_models.model.transport` does not create an RES
161+
in an empty :class:`.Scenario`, from scratch.
162+
Instead, it operates on a ‘base’ model
163+
and produces a new model
164+
—in this case, with additional transport sector technologies.
165+
166+
In the long run (see :ref:`Roadmap`),
167+
:mod:`message_ix_models.model` will contain a script
168+
that recreates a **‘main’** (single, authoritative) MESSAGEix-GLOBIOM RES,
169+
from scratch.
170+
Currently, this script does not exist,
171+
and this ‘main’ RES is itself derived from particular models and scenarios
172+
stored in the shared IIASA ECE database.
173+
These were previously from the CD-LINKS project,
174+
and more recently from the ENGAGE project.
175+
See :doc:`m-data:reference/model`.
176+
177+
In the private package, :mod:`message_data.model` also contains:
178+
179+
- A *general-purpose* :class:`~.model.scenario_runner.ScenarioRunner`
180+
*class* to manage and run interdependent sets of Scenarios.
181+
- A runscript for a *standard scenario set*,
182+
based on the scenario protocol of the :doc:`CD-LINKS <m-data:reference/projects/cd_links>` project;
183+
see below.
184+
185+
:ref:`index-projects` (:mod:`message_ix_models.project`)
186+
**Code to create, run, and analyse scenarios
187+
for specific research projects.**
188+
Research projects using MESSAGEix-GLOBIOM often involve a “scenario protocol.”
189+
This is some description of a set of multiple Scenarios with the same
190+
(or very similar) structure,
191+
and different parametrizations
192+
that represent different policies, modeling assumptions, etc.
193+
194+
Each submodule of :mod:`message_ix_models.project`
195+
(for example, :mod:`message_ix_models.project.navigate`) corresponds to a single research project,
196+
and contains tools needed to execute the **project workflow**.
197+
In some cases these are in the form of :class:`.Workflow` instances,
198+
in other cases as ‘runscripts’.
199+
Workflows usually have roughly the following steps:
200+
201+
1. **Start** with one of the :class:`Scenarios <.Scenario>` created by :mod:`message_ix_models.model`.
202+
2. **Build** a set of scenarios from this base,
203+
by applying various code in :mod:`message_ix_models` and :mod:`message_data`,
204+
with various configuration settings and input data.
205+
3. **Solve** each scenario generated in step 2.
206+
4. **Report** the results.
207+
208+
(Sometimes steps 2 and 3 are ‘chained’,
209+
with some scenarios being derived from the solution data
210+
of earlier scenarios.)
211+
212+
:doc:`Reporting and post-processing <api/report/index>` (:mod:`message_ix_models.report`)
213+
This module builds on :mod:`message_ix.report` and :mod:`ixmp.report`
214+
to provide general-purpose reporting functionality
215+
for MESSAGEix-GLOBIOM family models.
216+
217+
This base reporting corresponds to the ‘main’ RES,
218+
and is extended by :mod:`message_ix_models.model` submodules
219+
to cover features of particular model variants;
220+
or by :mod:`message_ix_models.project` submodules to cover variables
221+
or output formats needed for particular projects.
222+
223+
The module was previously at :py:`message_data.reporting`.
224+
225+
:doc:`Tools <api/tools>` (:mod:`message_ix_models.tools`)
226+
This submodule contains **higher-level** tools
227+
that perform operations tailored to the structure of MESSAGEix-GLOBIOM and MESSAGE,
228+
or to particular upstream data sources and their formats.
229+
These are *used by* code in submodules of :mod:`.model` or :mod:`.project`,
230+
but generally not vice versa.
231+
232+
:doc:`Utilities <api/util>` (:mod:`message_ix_models.util`)
233+
This submodule contains a collection of **lower-level**,
234+
general-purpose programming utilities
235+
that can be used across the rest of the code base.
236+
These include convenience wrappers and extensions for basic Python,
237+
:mod:`pandas`, and other upstream packages.
238+
239+
:ref:`repro-testing` (:mod:`message_ix_models.tests`)
240+
The test suite is arranged in modules and submodules
241+
that correspond to the code layout.
242+
For example:
243+
a function named :py:`do_thing()` in a module :py:`message_ix_models.project.foo.report.extra`
244+
will be tested in a module :py:`message_ix_models.tests.project.foo.report.test_extra`,
245+
and a function named :py:`test_do_thing()`.
246+
This arrangement makes it easy to locate the tests for any code,
247+
and vice versa.
248+
249+
:doc:`Test utilities and fixtures <api/testing>` (:mod:`message_ix_models.testing`)
250+
These are both low-level utilities and high-level tools
251+
specifically to be used within the test suite.
252+
They are *not* used anywhere besides :mod:`message_ix_models.tests`.
253+
86254
.. _policy-upstream-versions:
87255

88256
Upstream version policy
@@ -124,3 +292,32 @@ Python
124292
- This indicates that the marked code relies on features only available in certain upstream versions (of one of the packages mentioned above, or another package), newer than those listed in `pyproject.toml <https://github.com/iiasa/message-ix-models/blob/main/pyproject.toml>`__.
125293
- These minima **must** be mentioned in the :mod:`message_ix_models` documentation.
126294
- Users wishing to use this marked code **must** use compatible versions of those packages.
295+
296+
.. _roadmap:
297+
298+
Roadmap
299+
=======
300+
301+
The `message-ix-models Github repository <https://github.com/iiasa/message-ix-models>`_ hosts:
302+
303+
- `Current open issues <https://github.com/iiasa/message-ix-models/issues>`_,
304+
arranged using many `labels <https://github.com/iiasa/message-ix-models/labels>`_.
305+
- `Project boards <https://github.com/iiasa/message-ix-models/projects>`_ for ongoing efforts.
306+
307+
Documentation for particular submodules,
308+
for instance :mod:`message_ix_models.model.material`,
309+
may contain module- or project-specific roadmaps and change logs.
310+
311+
The same features are available for the private :mod:`message_data` repository:
312+
`issues <https://github.com/iiasa/message_data/issues>`_,
313+
`labels <https://github.com/iiasa/message_data/labels>`_, and
314+
`project boards <https://github.com/iiasa/message_data/projects>`_.
315+
316+
Inline TODOs
317+
------------
318+
319+
This is an automatically generated list of every place
320+
where a :code:`.. todo::` directive is used in the documentation,
321+
including in function docstrings.
322+
323+
.. todolist::

0 commit comments

Comments
 (0)